example: adapt example for gssapi callback
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
родитель
950d8e89a9
Коммит
6bb5063046
@ -60,6 +60,14 @@ static int auth_password(ssh_session session, const char *user,
|
|||||||
return SSH_AUTH_DENIED;
|
return SSH_AUTH_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int auth_gssapi_mic(ssh_session session, const char *user, void *userdata){
|
||||||
|
(void)userdata;
|
||||||
|
printf("Authenticating used %s with gssapi\n",user);
|
||||||
|
printf("authenticated\n");
|
||||||
|
authenticated = 1;
|
||||||
|
return SSH_AUTH_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
static int pty_request(ssh_session session, ssh_channel channel, const char *term,
|
static int pty_request(ssh_session session, ssh_channel channel, const char *term,
|
||||||
int x,int y, int px, int py, void *userdata){
|
int x,int y, int px, int py, void *userdata){
|
||||||
(void) session;
|
(void) session;
|
||||||
@ -209,6 +217,7 @@ int main(int argc, char **argv){
|
|||||||
struct ssh_server_callbacks_struct cb = {
|
struct ssh_server_callbacks_struct cb = {
|
||||||
.userdata = NULL,
|
.userdata = NULL,
|
||||||
.auth_password_function = auth_password,
|
.auth_password_function = auth_password,
|
||||||
|
.auth_gssapi_mic_function = auth_gssapi_mic,
|
||||||
.channel_open_request_session_function = new_session_channel
|
.channel_open_request_session_function = new_session_channel
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -250,6 +259,7 @@ int main(int argc, char **argv){
|
|||||||
printf("ssh_handle_key_exchange: %s\n", ssh_get_error(session));
|
printf("ssh_handle_key_exchange: %s\n", ssh_get_error(session));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
ssh_set_auth_methods(session,SSH_AUTH_METHOD_PASSWORD | SSH_AUTH_METHOD_GSSAPI_MIC);
|
||||||
mainloop = ssh_event_new();
|
mainloop = ssh_event_new();
|
||||||
ssh_event_add_session(mainloop, session);
|
ssh_event_add_session(mainloop, session);
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user