From ba4f10dc4657952ec47f71dfae90d9fba2eb6759 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 16 Nov 2011 11:32:06 +0100 Subject: agent: Improve logging. --- src/agent.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/agent.c') diff --git a/src/agent.c b/src/agent.c index be6ab1c0..47d203ac 100644 --- a/src/agent.c +++ b/src/agent.c @@ -211,19 +211,19 @@ static int agent_talk(struct ssh_session_struct *session, uint8_t payload[1024] = {0}; len = buffer_get_rest_len(request); - ssh_log(session, SSH_LOG_PACKET, "agent_talk - len of request: %u", len); + SSH_LOG(session, SSH_LOG_TRACE, "Request length: %u", len); agent_put_u32(payload, len); /* send length and then the request packet */ if (atomicio(session->agent->sock, payload, 4, 0) == 4) { if (atomicio(session->agent->sock, buffer_get_rest(request), len, 0) != len) { - ssh_log(session, SSH_LOG_PACKET, "atomicio sending request failed: %s", + SSH_LOG(session, SSH_LOG_WARN, "atomicio sending request failed: %s", strerror(errno)); return -1; } } else { - ssh_log(session, SSH_LOG_PACKET, + SSH_LOG(session, SSH_LOG_WARN, "atomicio sending request length failed: %s", strerror(errno)); return -1; @@ -231,7 +231,7 @@ static int agent_talk(struct ssh_session_struct *session, /* wait for response, read the length of the response packet */ if (atomicio(session->agent->sock, payload, 4, 1) != 4) { - ssh_log(session, SSH_LOG_PACKET, "atomicio read response length failed: %s", + SSH_LOG(session, SSH_LOG_WARN, "atomicio read response length failed: %s", strerror(errno)); return -1; } @@ -242,7 +242,7 @@ static int agent_talk(struct ssh_session_struct *session, "Authentication response too long: %u", len); return -1; } - ssh_log(session, SSH_LOG_PACKET, "agent_talk - response length: %u", len); + SSH_LOG(session, SSH_LOG_TRACE, "Response length: %u", len); while (len > 0) { size_t n = len; @@ -250,13 +250,12 @@ static int agent_talk(struct ssh_session_struct *session, n = sizeof(payload); } if (atomicio(session->agent->sock, payload, n, 1) != n) { - ssh_log(session, SSH_LOG_RARE, + SSH_LOG(session, SSH_LOG_WARN, "Error reading response from authentication socket."); return -1; } if (buffer_add_data(reply, payload, n) < 0) { - ssh_log(session, SSH_LOG_FUNCTIONS, - "Not enough space"); + SSH_LOG(session, SSH_LOG_WARN, "Not enough space"); return -1; } len -= n; @@ -306,8 +305,8 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) { /* get message type and verify the answer */ buffer_get_u8(reply, (uint8_t *) &type); - ssh_log(session, SSH_LOG_PACKET, - "agent_ident_count - answer type: %d, expected answer: %d", + SSH_LOG(session, SSH_LOG_WARN, + "Answer type: %d, expected answer: %d", type, c2); if (agent_failed(type)) { return 0; @@ -319,7 +318,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) { buffer_get_u32(reply, (uint32_t *) buf); session->agent->count = agent_get_u32(buf); - ssh_log(session, SSH_LOG_PACKET, "agent_ident_count - count: %d", + SSH_LOG(session, SSH_LOG_DEBUG, "Agent count: %d", session->agent->count); if (session->agent->count > 1024) { ssh_set_error(session, SSH_FATAL, @@ -492,7 +491,7 @@ ssh_string ssh_agent_sign_data(ssh_session session, } if (agent_failed(type)) { - ssh_log(session, SSH_LOG_RARE, "Agent reports failure in signing the key"); + SSH_LOG(session, SSH_LOG_WARN, "Agent reports failure in signing the key"); ssh_buffer_free(reply); return NULL; } else if (type != SSH2_AGENT_SIGN_RESPONSE) { -- cgit v1.2.3