diff options
author | Andreas Schneider <mail@cynapses.org> | 2008-12-29 11:33:51 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2008-12-29 11:33:51 +0000 |
commit | f9f8ded7f0a691c0b46ccff596944ef1b06cf8a8 (patch) | |
tree | 592e5ac919e74c6c44bc2762918de2eac0b45f63 /libssh/auth.c | |
parent | 6ea38880543478fb7d23de731f56fbe33632f5f7 (diff) | |
download | libssh-f9f8ded7f0a691c0b46ccff596944ef1b06cf8a8.tar.gz libssh-f9f8ded7f0a691c0b46ccff596944ef1b06cf8a8.tar.xz libssh-f9f8ded7f0a691c0b46ccff596944ef1b06cf8a8.zip |
Add a more generic auth callback function.
You should be able to obtain passwords or usernames with this
function.
Signed-off-by: Andreas Schneider <mail@cynapses.org>
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@198 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/auth.c')
-rw-r--r-- | libssh/auth.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libssh/auth.c b/libssh/auth.c index a0707500..eb212f75 100644 --- a/libssh/auth.c +++ b/libssh/auth.c @@ -405,6 +405,9 @@ static char *pub_keys_path[]={NULL,"%s/.ssh/identity.pub","%s/.ssh/id_dsa.pub"," * asker for passphrases (in case the private key is encrypted) * \brief Tries to automaticaly authenticate with public key and "none" * \param session ssh session + * \param passphrase use this passphrase to unlock the privatekey. Use + * NULL if you don't want to use a passphrase or the + * user should be asked. * \returns SSH_AUTH_ERROR : a serious error happened\n * SSH_AUTH_DENIED : Authentication failed : use another method\n * SSH_AUTH_PARTIAL : You've been partially authenticated, you still have to use another method\n @@ -414,7 +417,7 @@ static char *pub_keys_path[]={NULL,"%s/.ssh/identity.pub","%s/.ssh/id_dsa.pub"," * \see ssh_options_set_identity() */ -int ssh_userauth_autopubkey(SSH_SESSION *session){ +int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) { int count=1; /* bypass identity */ int type=0; int err; @@ -460,7 +463,7 @@ int ssh_userauth_autopubkey(SSH_SESSION *session){ continue; } /* pubkey accepted by server ! */ - privkey=privatekey_from_file(session,privkeyfile,type,NULL); + privkey=privatekey_from_file(session,privkeyfile,type,passphrase); if(!privkey){ ssh_say(0,"Reading private key %s failed (bad passphrase ?)\n",privkeyfile); free(pubkey); |