diff options
Diffstat (limited to 'include/libssh')
-rw-r--r-- | include/libssh/libssh.h | 1 | ||||
-rw-r--r-- | include/libssh/priv.h | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index cf63774..f3ad2f5 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -52,6 +52,7 @@ typedef struct public_key_struct PUBLIC_KEY; typedef struct private_key_struct PRIVATE_KEY; typedef struct ssh_options_struct SSH_OPTIONS; typedef struct channel_struct CHANNEL; +typedef struct agent_struct AGENT; typedef struct ssh_session SSH_SESSION; typedef struct ssh_kbdint SSH_KBDINT; diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 34731a6..907fd19 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -286,6 +286,12 @@ struct channel_struct { int blocking; }; +struct agent_struct { + struct socket *sock; + STRING *ident; + unsigned int count; +}; + struct ssh_session { struct error_struct error; struct socket *socket; @@ -337,6 +343,7 @@ struct ssh_session { int maxchannel; int exec_channel_opened; /* version 1 only. more info in channels1.c */ + AGENT *agent; /* ssh agent */ /* keyb interactive data */ struct ssh_kbdint *kbdint; @@ -417,6 +424,34 @@ struct ssh_message { struct ssh_channel_request channel_request; }; +/* agent.c */ +/** + * @brief Create a new ssh agent structure. + * + * @return An allocated ssh agent structure or NULL on error. + */ +struct agent_struct *agent_new(struct ssh_session *session); + +void agent_close(struct agent_struct *agent); +/** + * @brief Free an allocated ssh agent structure. + * + * @param agent The ssh agent structure to free. + */ +void agent_free(struct agent_struct *agent); +#ifndef _WIN32 +/** + * @brief Check if the ssh agent is running. + * + * @param session The ssh session to check for the agent. + * + * @return 1 if it is running, 0 if not. + */ +int agent_running(struct ssh_session *session); + +int agent_ident_count(struct ssh_session *session); +#endif + /* socket.c */ struct socket; @@ -425,6 +460,9 @@ struct socket *ssh_socket_new(SSH_SESSION *session); void ssh_socket_free(struct socket *s); void ssh_socket_set_fd(struct socket *s, socket_t fd); socket_t ssh_socket_get_fd(struct socket *s); +#ifndef _WIN32 +int ssh_socket_unix(struct socket *s, const char *path); +#endif void ssh_socket_close(struct socket *s); int ssh_socket_read(struct socket *s, void *buffer, int len); int ssh_socket_write(struct socket *s,const void *buffer, int len); @@ -637,6 +675,9 @@ int ssh_handle_packets(SSH_SESSION *session); #define enter_function() _enter_function(session) #define leave_function() _leave_function(session) +/** Free memory space */ +#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0) + /** Zero a structure */ #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x)) |