mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
tests: Provide the server state to callbacks
This aims to make it easier to implement custom callbacks. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
7f18a27504
commit
13aa791e7b
@ -749,6 +749,9 @@ void default_handle_session_cb(ssh_event event,
|
||||
goto end;
|
||||
}
|
||||
|
||||
sdata.server_state = (void *)state;
|
||||
cdata.server_state = (void *)state;
|
||||
|
||||
#ifdef WITH_PCAP
|
||||
set_pcap(&sdata, session, state->pcap_file);
|
||||
#endif
|
||||
|
@ -64,6 +64,10 @@ struct channel_data_st {
|
||||
ssh_event event;
|
||||
/* Terminal size struct. */
|
||||
struct winsize *winsize;
|
||||
/* This pointer will hold the server state for default callbacks */
|
||||
void *server_state;
|
||||
/* This pointer is useful to set data for custom callbacks */
|
||||
void *extra_data;
|
||||
};
|
||||
|
||||
/* A userdata struct for session. */
|
||||
@ -77,6 +81,10 @@ struct session_data_st {
|
||||
#ifdef WITH_PCAP
|
||||
ssh_pcap_file pcap;
|
||||
#endif
|
||||
/* This pointer will hold the server state for default callbacks */
|
||||
void *server_state;
|
||||
/* This pointer is useful to set data for custom callbacks */
|
||||
void *extra_data;
|
||||
};
|
||||
|
||||
int auth_password_cb(ssh_session session, const char *user,
|
||||
|
Reference in New Issue
Block a user