techvice
techvice

Reputation: 1301

How to programmatically update subversion password on local machine?

I am building a small internal tool for use with the developers in my company. One of the small goals is to update multiple locations when we change our passwords. One of these locations that needs to be updated is subversion. Most of the developers use TortoiseSvn but not all do (so I'd prefer a program neutral solution but it's not a requirement).

From my research around this topic, my first impression was that Tortoise or another application would have a change password function that I could use. This isn't so from what I can find. So my next thought was to change the encrypted password that is stored in %APPDATA%\Subversion\auth\svn.simple. This way, we could bypass any program and just fix the local machine credentials and be on our merry way.

For a Windows machine, subversion uses the wincrypt password-store for encryption. Working with that code was fairly straight forward. I found this DPAPI (from Obviex) code that would work to handle the encryption for me. It just takes care of the details for me (small note: I had some small issues with System.Security.Cryptography.ProtectedData so I decided to stick with this other way).

With this code, I was able to decrypt the password from the svn.simple folder and find that it worked (Previously saved authentication was decrypted and turned up the right password). However, when I would encrypt the password and store it in the proper place, I will always get a login screen from TortoiseSvn. It doesn't like my encrypted password.

So what's my question... has anyone accomplished something similar to what I am trying to do? Should I just forget trying to update the subversion password? Should I force a checkout of a repository and provide the credentials (I can do this using SharpSvn) and then delete the repository once it finishes?

Guess I am just hoping to find that someone has solved this problem already and can point me in the right direction. Please let me know if you have questions.

Other noteworthy links:

Upvotes: 3

Views: 780

Answers (1)

TylerOhlsen
TylerOhlsen

Reputation: 5578

I know this is a completely different direction than you were asking but in the right circumstance, it achieves your goal...

If you are using Active Directory to manage your users and you are willing to switch your SVN server applications, you should consider VisualSVN server. It has support for authentication against LDAP and it uses the user's SID in the authz file so user name and password changes are transparent. Plus it's free for commercial use.

Upvotes: 0

Related Questions