[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 01/11] cleanup: use ssh_ prefix in the agent (non-static) functions
[Thread Prev] | [Thread Next]
- Subject: [PATCH 01/11] cleanup: use ssh_ prefix in the agent (non-static) functions
- From: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 17 Sep 2015 16:37:35 +0200
- To: libssh@xxxxxxxxxx
- Cc: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
Having "ssh_" prefix in the functions' name will avoid possible clashes when compiling libssh statically. Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> --- include/libssh/agent.h | 8 ++++---- src/agent.c | 10 +++++----- src/auth.c | 2 +- src/session.c | 4 ++-- tests/client/torture_auth.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/libssh/agent.h b/include/libssh/agent.h index 77209d0..c739273 100644 --- a/include/libssh/agent.h +++ b/include/libssh/agent.h @@ -81,16 +81,16 @@ struct ssh_agent_struct { * * @return An allocated ssh agent structure or NULL on error. */ -struct ssh_agent_struct *agent_new(struct ssh_session_struct *session); +struct ssh_agent_struct *ssh_agent_new(struct ssh_session_struct *session); -void agent_close(struct ssh_agent_struct *agent); +void ssh_agent_close(struct ssh_agent_struct *agent); /** * @brief Free an allocated ssh agent structure. * * @param agent The ssh agent structure to free. */ -void agent_free(struct ssh_agent_struct *agent); +void ssh_agent_free(struct ssh_agent_struct *agent); /** * @brief Check if the ssh agent is running. @@ -99,7 +99,7 @@ void agent_free(struct ssh_agent_struct *agent); * * @return 1 if it is running, 0 if not. */ -int agent_is_running(struct ssh_session_struct *session); +int ssh_agent_is_running(struct ssh_session_struct *session); int ssh_agent_get_ident_count(struct ssh_session_struct *session); diff --git a/src/agent.c b/src/agent.c index 922d753..1cbb9cd 100644 --- a/src/agent.c +++ b/src/agent.c @@ -143,7 +143,7 @@ static size_t atomicio(struct ssh_agent_struct *agent, void *buf, size_t n, int } } -ssh_agent agent_new(struct ssh_session_struct *session) { +ssh_agent ssh_agent_new(struct ssh_session_struct *session) { ssh_agent agent = NULL; agent = malloc(sizeof(struct ssh_agent_struct)); @@ -205,7 +205,7 @@ int ssh_set_agent_socket(ssh_session session, socket_t fd){ return SSH_OK; } -void agent_close(struct ssh_agent_struct *agent) { +void ssh_agent_close(struct ssh_agent_struct *agent) { if (agent == NULL) { return; } @@ -213,13 +213,13 @@ void agent_close(struct ssh_agent_struct *agent) { ssh_socket_close(agent->sock); } -void agent_free(ssh_agent agent) { +void ssh_agent_free(ssh_agent agent) { if (agent) { if (agent->ident) { ssh_buffer_free(agent->ident); } if (agent->sock) { - agent_close(agent); + ssh_agent_close(agent); ssh_socket_free(agent->sock); } SAFE_FREE(agent); @@ -481,7 +481,7 @@ ssh_key ssh_agent_get_next_ident(struct ssh_session_struct *session, return key; } -int agent_is_running(ssh_session session) { +int ssh_agent_is_running(ssh_session session) { if (session == NULL || session->agent == NULL) { return 0; } diff --git a/src/auth.c b/src/auth.c index 1381774..eeed8c3 100644 --- a/src/auth.c +++ b/src/auth.c @@ -771,7 +771,7 @@ int ssh_userauth_agent(ssh_session session, return SSH_AUTH_ERROR; } - if (!agent_is_running(session)) { + if (!ssh_agent_is_running(session)) { return SSH_AUTH_DENIED; } if (!session->agent_state){ diff --git a/src/session.c b/src/session.c index ad1b3a8..c1ef290 100644 --- a/src/session.c +++ b/src/session.c @@ -92,7 +92,7 @@ ssh_session ssh_new(void) { session->maxchannel = FIRST_CHANNEL; #ifndef _WIN32 - session->agent = agent_new(session); + session->agent = ssh_agent_new(session); if (session->agent == NULL) { goto err; } @@ -222,7 +222,7 @@ void ssh_free(ssh_session session) { crypto_free(session->next_crypto); #ifndef _WIN32 - agent_free(session->agent); + ssh_agent_free(session->agent); #endif /* _WIN32 */ ssh_key_free(session->srv.dsa_key); diff --git a/tests/client/torture_auth.c b/tests/client/torture_auth.c index d686b4c..bbd72be 100644 --- a/tests/client/torture_auth.c +++ b/tests/client/torture_auth.c @@ -308,7 +308,7 @@ static void torture_auth_agent(void **state) { " to enable this test!!\n"); return; } - if (!agent_is_running(session)){ + if (!ssh_agent_is_running(session)){ print_message("*** Agent not running. Test ignored\n"); return; } @@ -340,7 +340,7 @@ static void torture_auth_agent_nonblocking(void **state) { " to enable this test!!\n"); return; } - if (!agent_is_running(session)){ + if (!ssh_agent_is_running(session)){ print_message("*** Agent not running. Test ignored\n"); return; } -- 2.4.3
[PATCH 00/11] cleanup and removing some warnings | Fabiano Fidêncio <fidencio@xxxxxxxxxx> |