aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-09-21 15:54:49 +0200
committerAndreas Schneider <mail@cynapses.org>2009-09-21 15:54:49 +0200
commit88f4e9ea24257bfdce511272a65a8d0f7eab8b35 (patch)
tree2cb02dfee365e760a87b4d77a6d926f7c87fd816 /libssh
parent4133f484ae317909169ad8e1bc689d25cabd9a77 (diff)
downloadlibssh-88f4e9ea24257bfdce511272a65a8d0f7eab8b35.tar.gz
libssh-88f4e9ea24257bfdce511272a65a8d0f7eab8b35.tar.xz
libssh-88f4e9ea24257bfdce511272a65a8d0f7eab8b35.zip
Added more logging output for publickey auth.
Diffstat (limited to 'libssh')
-rw-r--r--libssh/auth.c4
-rw-r--r--libssh/keyfiles.c16
2 files changed, 14 insertions, 6 deletions
diff --git a/libssh/auth.c b/libssh/auth.c
index 8a3e597e..1aa2b8c9 100644
--- a/libssh/auth.c
+++ b/libssh/auth.c
@@ -929,11 +929,12 @@ int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) {
}
string_free(pubkey);
SAFE_FREE(privkeyfile);
+ ssh_log(session, SSH_LOG_RARE, "Publickey authentication error");
leave_function();
return rc;
} else {
if (rc != SSH_AUTH_SUCCESS){
- ssh_log(session, SSH_LOG_RARE, "Public key refused by server");
+ ssh_log(session, SSH_LOG_RARE, "Publickey refused by server");
string_free(pubkey);
pubkey = NULL;
SAFE_FREE(privkeyfile);
@@ -943,6 +944,7 @@ int ssh_userauth_autopubkey(SSH_SESSION *session, const char *passphrase) {
}
/* Public key accepted by server! */
+ ssh_log(session, SSH_LOG_RARE, "Trying to read privatekey %s", privkeyfile);
privkey = privatekey_from_file(session, privkeyfile, type, passphrase);
if (privkey == NULL) {
ssh_log(session, SSH_LOG_FUNCTIONS,
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index ec81c828..e9006fd7 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -583,6 +583,8 @@ static int pem_get_password(char *buf, int size, int rwflag, void *userdata) {
(void) rwflag;
ZERO_STRUCTP(buf);
+ ssh_log(session, SSH_LOG_RARE,
+ "Trying to call external authentication function");
if (session && session->options->auth_function) {
if ((*session->options->auth_function)("Passphrase for private key:", buf, size, 0, 0,
@@ -624,6 +626,7 @@ ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
DSA *dsa = NULL;
RSA *rsa = NULL;
#endif
+ ssh_log(session, SSH_LOG_RARE, "Trying to open %s", filename);
file = fopen(filename,"r");
if (file == NULL) {
ssh_set_error(session, SSH_REQUEST_DENIED,
@@ -631,6 +634,9 @@ ssh_private_key privatekey_from_file(SSH_SESSION *session, const char *filename,
return NULL;
}
+ ssh_log(session, SSH_LOG_RARE, "Trying to read %s, passphase=%s, authcb=%s",
+ filename, passphrase ? "true" : "false",
+ session->options->auth_function ? "true" : "false");
switch (type) {
case TYPE_DSS:
if (passphrase == NULL) {
@@ -953,20 +959,20 @@ ssh_string try_publickey_from_file(SSH_SESSION *session, struct ssh_keys_struct
/* are them readable ? */
snprintf(public, sizeof(public), pub, home);
- ssh_log(session, SSH_LOG_PACKET, "Trying to open public key %s", public);
+ ssh_log(session, SSH_LOG_PACKET, "Trying to open publickey %s", public);
if (!ssh_file_readaccess_ok(public)) {
- ssh_log(session, SSH_LOG_PACKET, "Failed");
+ ssh_log(session, SSH_LOG_PACKET, "Failed to open publickey %s", public);
return NULL;
}
snprintf(private, sizeof(private), priv, home);
- ssh_log(session, SSH_LOG_PACKET, "Trying to open private key %s", private);
+ ssh_log(session, SSH_LOG_PACKET, "Trying to open privatekey %s", private);
if (!ssh_file_readaccess_ok(private)) {
- ssh_log(session, SSH_LOG_PACKET, "Failed");
+ ssh_log(session, SSH_LOG_PACKET, "Failed to open privatekey %s", private);
return NULL;
}
- ssh_log(session, SSH_LOG_PACKET, "Success reading public and private key");
+ ssh_log(session, SSH_LOG_PACKET, "Success opening public and private key");
/*
* We are sure both the private and public key file is readable. We return