channels: implement callback for agent forwarding request
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
e809fa881e
Коммит
81e769ec6a
@ -481,6 +481,16 @@ typedef int (*ssh_channel_pty_request_callback) (ssh_session session,
|
|||||||
typedef int (*ssh_channel_shell_request_callback) (ssh_session session,
|
typedef int (*ssh_channel_shell_request_callback) (ssh_session session,
|
||||||
ssh_channel channel,
|
ssh_channel channel,
|
||||||
void *userdata);
|
void *userdata);
|
||||||
|
/**
|
||||||
|
* @brief SSH auth-agent-request from the client. This request is
|
||||||
|
* sent by a client when agent forwarding is available.
|
||||||
|
* Server is free to ignore this callback, no answer is expected.
|
||||||
|
* @param channel the channel
|
||||||
|
* @param userdata Userdata to be passed to the callback function.
|
||||||
|
*/
|
||||||
|
typedef void (*channel_auth_agent_req_callback) (ssh_session session,
|
||||||
|
ssh_channel channel,
|
||||||
|
void *userdata);
|
||||||
struct ssh_channel_callbacks_struct {
|
struct ssh_channel_callbacks_struct {
|
||||||
/** DON'T SET THIS use ssh_callbacks_init() instead. */
|
/** DON'T SET THIS use ssh_callbacks_init() instead. */
|
||||||
size_t size;
|
size_t size;
|
||||||
@ -520,6 +530,10 @@ struct ssh_channel_callbacks_struct {
|
|||||||
* This function will be called when a client requests a shell
|
* This function will be called when a client requests a shell
|
||||||
*/
|
*/
|
||||||
ssh_channel_shell_request_callback channel_shell_request_function;
|
ssh_channel_shell_request_callback channel_shell_request_function;
|
||||||
|
/** This function will be called when a client requests agent
|
||||||
|
* authentication forwarding.
|
||||||
|
*/
|
||||||
|
channel_auth_agent_req_callback channel_auth_agent_req_function;
|
||||||
};
|
};
|
||||||
typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
|
typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
|
||||||
|
|
||||||
|
@ -833,6 +833,16 @@ SSH_PACKET_CALLBACK(channel_rcv_request) {
|
|||||||
return SSH_PACKET_USED;
|
return SSH_PACKET_USED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(request, "auth-agent-req@openssh.com") == 0) {
|
||||||
|
SAFE_FREE(request);
|
||||||
|
ssh_log(session, SSH_LOG_PROTOCOL, "Received an auth-agent-req request");
|
||||||
|
if(ssh_callbacks_exists(channel->callbacks, channel_auth_agent_req_function)) {
|
||||||
|
channel->callbacks->channel_auth_agent_req_function(channel->session, channel,
|
||||||
|
channel->callbacks->userdata);
|
||||||
|
}
|
||||||
|
leave_function();
|
||||||
|
return SSH_PACKET_USED;
|
||||||
|
}
|
||||||
/* If we are here, that means we have a request that is not in the understood
|
/* If we are here, that means we have a request that is not in the understood
|
||||||
* client requests. That means we need to create a ssh message to be passed
|
* client requests. That means we need to create a ssh message to be passed
|
||||||
* to the user code handling ssh messages
|
* to the user code handling ssh messages
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user