aboutsummaryrefslogtreecommitdiff
path: root/libssh/auth.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2005-10-26 12:06:11 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2005-10-26 12:06:11 +0000
commit0f67ff89d9918344965897887ca47c9bb7471752 (patch)
treee7c58cbabcc205eb93582c00cebb2fa8dc63cadd /libssh/auth.c
parent9a2683f183338da7c82261d502cdeff0855c210c (diff)
downloadlibssh-0f67ff89d9918344965897887ca47c9bb7471752.tar.gz
libssh-0f67ff89d9918344965897887ca47c9bb7471752.tar.xz
libssh-0f67ff89d9918344965897887ca47c9bb7471752.zip
patches from Norbert merged in. I have made some little changes here and there.
It still doesn't compile because of the O1 thing passed to ld. git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@41 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/auth.c')
-rw-r--r--libssh/auth.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libssh/auth.c b/libssh/auth.c
index 12b90bf4..8c7fb2db 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -311,11 +311,15 @@ int ssh_userauth_autopubkey(SSH_SESSION *session){
free(id);
}
free(pubkey);
+ free(privkeyfile);
return err;
} else
if(err != SSH_AUTH_SUCCESS){
ssh_say(2,"Public key refused by server\n");
free(pubkey);
+ pubkey=NULL;
+ free(privkeyfile);
+ privkeyfile=NULL;
continue;
}
/* pubkey accepted by server ! */
@@ -323,6 +327,9 @@ int ssh_userauth_autopubkey(SSH_SESSION *session){
if(!privkey){
ssh_say(0,"Reading private key %s failed (bad passphrase ?)\n",privkeyfile);
free(pubkey);
+ pubkey=NULL;
+ free(privkeyfile);
+ privkeyfile=NULL;
continue; /* continue the loop with other pubkey */
}
err=ssh_userauth_pubkey(session,NULL,pubkey,privkey);
@@ -333,12 +340,16 @@ int ssh_userauth_autopubkey(SSH_SESSION *session){
free(id);
}
free(pubkey);
+ free(privkeyfile);
private_key_free(privkey);
return err;
} else
if(err != SSH_AUTH_SUCCESS){
ssh_say(0,"Weird : server accepted our public key but refused the signature\nit might be a bug of libssh\n");
free(pubkey);
+ pubkey=NULL;
+ free(privkeyfile);
+ privkeyfile=NULL;
private_key_free(privkey);
continue;
}
@@ -354,6 +365,7 @@ int ssh_userauth_autopubkey(SSH_SESSION *session){
}
return SSH_AUTH_SUCCESS;
}
+ /* at this point, pubkey is NULL and so is privkeyfile */
ssh_say(1,"Tried every public key, none matched\n");
ssh_set_error(session,SSH_NO_ERROR,"no public key matched");
if(id){