Lines Matching refs:ssh
92 static int input_service_request(int, u_int32_t, struct ssh *);
93 static int input_userauth_request(int, u_int32_t, struct ssh *);
140 userauth_send_banner(struct ssh *ssh, const char *msg) in userauth_send_banner() argument
144 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_BANNER)) != 0 || in userauth_send_banner()
145 (r = sshpkt_put_cstring(ssh, msg)) != 0 || in userauth_send_banner()
146 (r = sshpkt_put_cstring(ssh, "")) != 0 || /* language, unused */ in userauth_send_banner()
147 (r = sshpkt_send(ssh)) != 0) in userauth_send_banner()
153 userauth_banner(struct ssh *ssh) in userauth_banner() argument
162 userauth_send_banner(ssh, banner); in userauth_banner()
172 do_authentication2(struct ssh *ssh) in do_authentication2() argument
174 Authctxt *authctxt = ssh->authctxt; in do_authentication2()
176 ssh_dispatch_init(ssh, &dispatch_protocol_error); in do_authentication2()
177 if (ssh->kex->ext_info_c) in do_authentication2()
178 ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &kex_input_ext_info); in do_authentication2()
179 ssh_dispatch_set(ssh, SSH2_MSG_SERVICE_REQUEST, &input_service_request); in do_authentication2()
180 ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt->success); in do_authentication2()
181 ssh->authctxt = NULL; in do_authentication2()
185 input_service_request(int type, u_int32_t seq, struct ssh *ssh) in input_service_request() argument
187 Authctxt *authctxt = ssh->authctxt; in input_service_request()
191 if ((r = sshpkt_get_cstring(ssh, &service, NULL)) != 0 || in input_service_request()
192 (r = sshpkt_get_end(ssh)) != 0) in input_service_request()
202 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_REQUEST, in input_service_request()
209 if ((r = sshpkt_start(ssh, SSH2_MSG_SERVICE_ACCEPT)) != 0 || in input_service_request()
210 (r = sshpkt_put_cstring(ssh, service)) != 0 || in input_service_request()
211 (r = sshpkt_send(ssh)) != 0 || in input_service_request()
212 (r = ssh_packet_write_wait(ssh)) != 0) in input_service_request()
216 ssh_packet_disconnect(ssh, "bad service request %s", service); in input_service_request()
218 ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &dispatch_protocol_error); in input_service_request()
270 input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_request() argument
272 Authctxt *authctxt = ssh->authctxt; in input_userauth_request()
281 if ((r = sshpkt_get_cstring(ssh, &user, NULL)) != 0 || in input_userauth_request()
282 (r = sshpkt_get_cstring(ssh, &service, NULL)) != 0 || in input_userauth_request()
283 (r = sshpkt_get_cstring(ssh, &method, NULL)) != 0) in input_userauth_request()
292 auth_maxtries_exceeded(ssh); in input_userauth_request()
295 authctxt->pw = mm_getpwnamallow(ssh, user); in input_userauth_request()
305 mm_audit_event(ssh, SSH_INVALID_USER); in input_userauth_request()
310 mm_start_pam(ssh); in input_userauth_request()
312 ssh_packet_set_log_preamble(ssh, "%suser %s", in input_userauth_request()
318 userauth_banner(ssh); in input_userauth_request()
319 if ((r = kex_server_update_ext_info(ssh)) != 0) in input_userauth_request()
322 ssh_packet_disconnect(ssh, in input_userauth_request()
326 ssh_packet_disconnect(ssh, "Change of username or service " in input_userauth_request()
331 auth2_challenge_stop(ssh); in input_userauth_request()
335 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL); in input_userauth_request()
336 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); in input_userauth_request()
347 authenticated = m->userauth(ssh, method); in input_userauth_request()
352 userauth_finish(ssh, authenticated, method, NULL); in input_userauth_request()
362 userauth_finish(struct ssh *ssh, int authenticated, const char *packet_method, in userauth_finish() argument
365 Authctxt *authctxt = ssh->authctxt; in userauth_finish()
386 !auth_root_allowed(ssh, method)) { in userauth_finish()
389 mm_audit_event(ssh, SSH_LOGIN_ROOT_DENIED); in userauth_finish()
401 auth_log(ssh, authenticated, partial, method, submethod); in userauth_finish()
419 userauth_send_banner(ssh, sshbuf_ptr(loginmsg)); in userauth_finish()
420 if ((r = ssh_packet_write_wait(ssh)) != 0) { in userauth_finish()
421 sshpkt_fatal(ssh, r, in userauth_finish()
434 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_REQUEST, in userauth_finish()
436 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_SUCCESS)) != 0 || in userauth_finish()
437 (r = sshpkt_send(ssh)) != 0 || in userauth_finish()
438 (r = ssh_packet_write_wait(ssh)) != 0) in userauth_finish()
442 ssh_packet_set_log_preamble(ssh, "user %s", authctxt->user); in userauth_finish()
448 BLACKLIST_NOTIFY(ssh, BLACKLIST_AUTH_FAIL, "ssh"); in userauth_finish()
452 mm_audit_event(ssh, SSH_LOGIN_EXCEED_MAXTRIES); in userauth_finish()
454 auth_maxtries_exceeded(ssh); in userauth_finish()
459 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_FAILURE)) != 0 || in userauth_finish()
460 (r = sshpkt_put_cstring(ssh, methods)) != 0 || in userauth_finish()
461 (r = sshpkt_put_u8(ssh, partial)) != 0 || in userauth_finish()
462 (r = sshpkt_send(ssh)) != 0 || in userauth_finish()
463 (r = ssh_packet_write_wait(ssh)) != 0) in userauth_finish()