Fix a few log strings and levels in auth.c

This commit is contained in:
Aris Adamantiadis
2009-12-26 22:12:08 +01:00
parent a229cb4676
commit 77baa2df15

View File

@@ -919,13 +919,13 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
return rc; return rc;
} else if (rc != SSH_AUTH_SUCCESS) { } else if (rc != SSH_AUTH_SUCCESS) {
ssh_log(session, SSH_LOG_PACKET, "Public key refused by server\n"); ssh_log(session, SSH_LOG_PROTOCOL, "Public key refused by server");
SAFE_FREE(id); SAFE_FREE(id);
SAFE_FREE(privkeyfile); SAFE_FREE(privkeyfile);
publickey_free(publickey); publickey_free(publickey);
continue; continue;
} }
ssh_log(session, SSH_LOG_RARE, "Public key accepted"); ssh_log(session, SSH_LOG_PROTOCOL, "Public key accepted");
/* pubkey accepted by server ! */ /* pubkey accepted by server ! */
rc = ssh_userauth_agent_pubkey(session, NULL, publickey); rc = ssh_userauth_agent_pubkey(session, NULL, publickey);
if (rc == SSH_AUTH_ERROR) { if (rc == SSH_AUTH_ERROR) {
@@ -937,15 +937,15 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
return rc; return rc;
} else if (rc != SSH_AUTH_SUCCESS) { } else if (rc != SSH_AUTH_SUCCESS) {
ssh_log(session, SSH_LOG_RARE, ssh_log(session, SSH_LOG_RARE,
"Server accepted public key but refused the signature\n" "Server accepted public key but refused the signature ;"
"It might be a bug of libssh\n"); " It might be a bug of libssh");
SAFE_FREE(id); SAFE_FREE(id);
SAFE_FREE(privkeyfile); SAFE_FREE(privkeyfile);
publickey_free(publickey); publickey_free(publickey);
continue; continue;
} }
/* auth success */ /* auth success */
ssh_log(session, SSH_LOG_RARE, "Authentication using %s success\n", ssh_log(session, SSH_LOG_PROTOCOL, "Authentication using %s success",
privkeyfile); privkeyfile);
SAFE_FREE(id); SAFE_FREE(id);
SAFE_FREE(privkeyfile); SAFE_FREE(privkeyfile);
@@ -964,8 +964,8 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
size = ARRAY_SIZE(keytab); size = ARRAY_SIZE(keytab);
if (session->identity) { if (session->identity) {
ssh_log(session, SSH_LOG_RARE, ssh_log(session, SSH_LOG_PROTOCOL,
"Trying identity file %s\n", session->identity); "Trying identity file %s", session->identity);
id = malloc(strlen(session->identity) + 1 + 4); id = malloc(strlen(session->identity) + 1 + 4);
if (id == NULL) { if (id == NULL) {
@@ -1001,7 +1001,7 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
return rc; return rc;
} else { } else {
if (rc != SSH_AUTH_SUCCESS){ if (rc != SSH_AUTH_SUCCESS){
ssh_log(session, SSH_LOG_RARE, "Publickey refused by server"); ssh_log(session, SSH_LOG_PROTOCOL, "Publickey refused by server");
string_free(pubkey); string_free(pubkey);
pubkey = NULL; pubkey = NULL;
SAFE_FREE(privkeyfile); SAFE_FREE(privkeyfile);
@@ -1011,10 +1011,10 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
} }
/* Public key accepted by server! */ /* Public key accepted by server! */
ssh_log(session, SSH_LOG_RARE, "Trying to read privatekey %s", privkeyfile); ssh_log(session, SSH_LOG_PROTOCOL, "Trying to read privatekey %s", privkeyfile);
privkey = privatekey_from_file(session, privkeyfile, type, passphrase); privkey = privatekey_from_file(session, privkeyfile, type, passphrase);
if (privkey == NULL) { if (privkey == NULL) {
ssh_log(session, SSH_LOG_FUNCTIONS, ssh_log(session, SSH_LOG_RARE,
"Reading private key %s failed (bad passphrase ?)", "Reading private key %s failed (bad passphrase ?)",
privkeyfile); privkeyfile);
string_free(pubkey); string_free(pubkey);
@@ -1038,7 +1038,7 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
return rc; return rc;
} else { } else {
if (rc != SSH_AUTH_SUCCESS){ if (rc != SSH_AUTH_SUCCESS){
ssh_log(session, SSH_LOG_FUNCTIONS, ssh_log(session, SSH_LOG_RARE,
"The server accepted the public key but refused the signature"); "The server accepted the public key but refused the signature");
string_free(pubkey); string_free(pubkey);
pubkey = NULL; pubkey = NULL;
@@ -1050,7 +1050,7 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
} }
/* auth success */ /* auth success */
ssh_log(session, SSH_LOG_RARE, ssh_log(session, SSH_LOG_PROTOCOL,
"Successfully authenticated using %s", privkeyfile); "Successfully authenticated using %s", privkeyfile);
string_free(pubkey); string_free(pubkey);
privatekey_free(privkey); privatekey_free(privkey);
@@ -1065,7 +1065,7 @@ int ssh_userauth_autopubkey(ssh_session session, const char *passphrase) {
return SSH_AUTH_SUCCESS; return SSH_AUTH_SUCCESS;
} }
/* at this point, pubkey is NULL and so is privkeyfile */ /* at this point, pubkey is NULL and so is privkeyfile */
ssh_log(session, SSH_LOG_FUNCTIONS, ssh_log(session, SSH_LOG_PROTOCOL,
"Tried every public key, none matched"); "Tried every public key, none matched");
ssh_set_error(session,SSH_NO_ERROR,"No public key matched"); ssh_set_error(session,SSH_NO_ERROR,"No public key matched");
if (id) { if (id) {