Lines Matching defs:ssh

53 #include "ssh-gss.h"
88 static int input_service_request(int, u_int32_t, struct ssh *);
89 static int input_userauth_request(int, u_int32_t, struct ssh *);
136 userauth_banner(struct ssh *ssh)
147 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_BANNER)) != 0 ||
148 (r = sshpkt_put_cstring(ssh, banner)) != 0 ||
149 (r = sshpkt_put_cstring(ssh, "")) != 0 || /* language, unused */
150 (r = sshpkt_send(ssh)) != 0)
161 do_authentication2(struct ssh *ssh)
163 Authctxt *authctxt = ssh->authctxt;
165 ssh_dispatch_init(ssh, &dispatch_protocol_error);
166 if (ssh->kex->ext_info_c)
167 ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &kex_input_ext_info);
168 ssh_dispatch_set(ssh, SSH2_MSG_SERVICE_REQUEST, &input_service_request);
169 ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt->success);
170 ssh->authctxt = NULL;
174 input_service_request(int type, u_int32_t seq, struct ssh *ssh)
176 Authctxt *authctxt = ssh->authctxt;
180 if ((r = sshpkt_get_cstring(ssh, &service, NULL)) != 0 ||
181 (r = sshpkt_get_end(ssh)) != 0)
187 if (strcmp(service, "ssh-userauth") == 0) {
191 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_REQUEST,
198 if ((r = sshpkt_start(ssh, SSH2_MSG_SERVICE_ACCEPT)) != 0 ||
199 (r = sshpkt_put_cstring(ssh, service)) != 0 ||
200 (r = sshpkt_send(ssh)) != 0 ||
201 (r = ssh_packet_write_wait(ssh)) != 0)
205 ssh_packet_disconnect(ssh, "bad service request %s", service);
207 ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &dispatch_protocol_error);
259 input_userauth_request(int type, u_int32_t seq, struct ssh *ssh)
261 Authctxt *authctxt = ssh->authctxt;
270 if ((r = sshpkt_get_cstring(ssh, &user, NULL)) != 0 ||
271 (r = sshpkt_get_cstring(ssh, &service, NULL)) != 0 ||
272 (r = sshpkt_get_cstring(ssh, &method, NULL)) != 0)
281 auth_maxtries_exceeded(ssh);
284 authctxt->pw = mm_getpwnamallow(ssh, user);
285 if (authctxt->pw && strcmp(service, "ssh-connection")==0) {
293 ssh_packet_set_log_preamble(ssh, "%suser %s",
300 userauth_banner(ssh);
301 if ((r = kex_server_update_ext_info(ssh)) != 0)
304 ssh_packet_disconnect(ssh,
308 ssh_packet_disconnect(ssh, "Change of username or service "
313 auth2_challenge_stop(ssh);
317 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
318 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
329 authenticated = m->userauth(ssh, method);
334 userauth_finish(ssh, authenticated, method, NULL);
344 userauth_finish(struct ssh *ssh, int authenticated, const char *packet_method,
347 Authctxt *authctxt = ssh->authctxt;
368 !auth_root_allowed(ssh, method))
379 auth_log(ssh, authenticated, partial, method, submethod);
390 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_REQUEST,
392 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_SUCCESS)) != 0 ||
393 (r = sshpkt_send(ssh)) != 0 ||
394 (r = ssh_packet_write_wait(ssh)) != 0)
398 ssh_packet_set_log_preamble(ssh, "user %s", authctxt->user);
405 auth_maxtries_exceeded(ssh);
409 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_FAILURE)) != 0 ||
410 (r = sshpkt_put_cstring(ssh, methods)) != 0 ||
411 (r = sshpkt_put_u8(ssh, partial)) != 0 ||
412 (r = sshpkt_send(ssh)) != 0 ||
413 (r = ssh_packet_write_wait(ssh)) != 0)