Lines Matching refs:ssh

96 verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)  in verify_host_key_callback()  argument
235 if ((r = sshpkt_start(ssh, SSH2_MSG_IGNORE)) != 0 || in ssh_kex2()
236 (r = sshpkt_put_cstring(ssh, "markus")) != 0 || in ssh_kex2()
237 (r = sshpkt_send(ssh)) != 0 || in ssh_kex2()
238 (r = ssh_packet_write_wait(ssh)) != 0) in ssh_kex2()
293 int input_userauth_service_accept(int, u_int32_t, struct ssh *);
294 int input_userauth_ext_info(int, u_int32_t, struct ssh *);
295 int input_userauth_success(int, u_int32_t, struct ssh *);
296 int input_userauth_success_unexpected(int, u_int32_t, struct ssh *);
297 int input_userauth_failure(int, u_int32_t, struct ssh *);
298 int input_userauth_banner(int, u_int32_t, struct ssh *);
299 int input_userauth_error(int, u_int32_t, struct ssh *);
300 int input_userauth_info_req(int, u_int32_t, struct ssh *);
301 int input_userauth_pk_ok(int, u_int32_t, struct ssh *);
302 int input_userauth_passwd_changereq(int, u_int32_t, struct ssh *);
312 int input_gssapi_response(int type, u_int32_t, struct ssh *);
313 int input_gssapi_token(int type, u_int32_t, struct ssh *);
314 int input_gssapi_hash(int type, u_int32_t, struct ssh *);
315 int input_gssapi_error(int, u_int32_t, struct ssh *);
316 int input_gssapi_errtok(int, u_int32_t, struct ssh *);
321 static int sign_and_send_pubkey(struct ssh *ssh, Authctxt *, Identity *);
371 struct ssh *ssh = active_state; in ssh_userauth2() local
398 if ((r = sshpkt_start(ssh, SSH2_MSG_SERVICE_REQUEST)) != 0 || in ssh_userauth2()
399 (r = sshpkt_put_cstring(ssh, "ssh-userauth")) != 0 || in ssh_userauth2()
400 (r = sshpkt_send(ssh)) != 0) in ssh_userauth2()
403 ssh->authctxt = &authctxt; in ssh_userauth2()
404 ssh_dispatch_init(ssh, &input_userauth_error); in ssh_userauth2()
405 ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &input_userauth_ext_info); in ssh_userauth2()
406 ssh_dispatch_set(ssh, SSH2_MSG_SERVICE_ACCEPT, &input_userauth_service_accept); in ssh_userauth2()
407 ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt.success); /* loop until success */ in ssh_userauth2()
408 ssh->authctxt = NULL; in ssh_userauth2()
411 ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL); in ssh_userauth2()
420 input_userauth_service_accept(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_service_accept() argument
422 Authctxt *authctxt = ssh->authctxt; in input_userauth_service_accept()
425 if (ssh_packet_remaining(ssh) > 0) { in input_userauth_service_accept()
428 if ((r = sshpkt_get_cstring(ssh, &reply, NULL)) != 0) in input_userauth_service_accept()
435 if ((r = sshpkt_get_end(ssh)) != 0) in input_userauth_service_accept()
442 ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &input_userauth_error); in input_userauth_service_accept()
443 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_SUCCESS, &input_userauth_success); in input_userauth_service_accept()
444 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_FAILURE, &input_userauth_failure); in input_userauth_service_accept()
445 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_BANNER, &input_userauth_banner); in input_userauth_service_accept()
453 input_userauth_ext_info(int type, u_int32_t seqnr, struct ssh *ssh) in input_userauth_ext_info() argument
455 return kex_input_ext_info(type, seqnr, ssh); in input_userauth_ext_info()
461 struct ssh *ssh = active_state; /* XXX */ in userauth() local
482 ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_PER_METHOD_MIN, in userauth()
498 input_userauth_error(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_error() argument
507 input_userauth_banner(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_banner() argument
524 input_userauth_success(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_success() argument
526 Authctxt *authctxt = ssh->authctxt; in input_userauth_success()
541 input_userauth_success_unexpected(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_success_unexpected() argument
543 Authctxt *authctxt = ssh->authctxt; in input_userauth_success_unexpected()
555 input_userauth_failure(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_failure() argument
557 Authctxt *authctxt = ssh->authctxt; in input_userauth_failure()
565 if ((r = sshpkt_get_cstring(ssh, &authlist, NULL)) != 0 || in input_userauth_failure()
566 (r = sshpkt_get_u8(ssh, &partial)) != 0 || in input_userauth_failure()
567 (r = sshpkt_get_end(ssh)) != 0) in input_userauth_failure()
586 input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_pk_ok() argument
588 Authctxt *authctxt = ssh->authctxt; in input_userauth_pk_ok()
600 if ((r = sshpkt_get_cstring(ssh, &pkalg, NULL)) != 0 || in input_userauth_pk_ok()
601 (r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0 || in input_userauth_pk_ok()
602 (r = sshpkt_get_end(ssh)) != 0) in input_userauth_pk_ok()
634 sent = sign_and_send_pubkey(ssh, authctxt, id); in input_userauth_pk_ok()
654 struct ssh *ssh = active_state; /* XXX */ in userauth_gssapi() local
684 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in userauth_gssapi()
685 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_gssapi()
686 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_gssapi()
687 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_gssapi()
688 (r = sshpkt_put_u32(ssh, 1)) != 0 || in userauth_gssapi()
689 (r = sshpkt_put_u32(ssh, in userauth_gssapi()
691 (r = sshpkt_put_u8(ssh, SSH_GSS_OIDTYPE)) != 0 || in userauth_gssapi()
692 (r = sshpkt_put_u8(ssh, in userauth_gssapi()
694 (r = sshpkt_put(ssh, in userauth_gssapi()
697 (r = sshpkt_send(ssh)) != 0) in userauth_gssapi()
700 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_RESPONSE, &input_gssapi_response); in userauth_gssapi()
701 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, &input_gssapi_token); in userauth_gssapi()
702 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERROR, &input_gssapi_error); in userauth_gssapi()
703 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, &input_gssapi_errtok); in userauth_gssapi()
711 process_gssapi_token(struct ssh *ssh, gss_buffer_t recv_tok) in process_gssapi_token() argument
713 Authctxt *authctxt = ssh->authctxt; in process_gssapi_token()
729 if ((r = sshpkt_start(ssh, type)) != 0 || in process_gssapi_token()
730 (r = sshpkt_put_string(ssh, send_tok.value, in process_gssapi_token()
732 (r = sshpkt_send(ssh)) != 0) in process_gssapi_token()
741 if ((r = sshpkt_start(ssh, in process_gssapi_token()
743 (r = sshpkt_send(ssh)) != 0) in process_gssapi_token()
760 if ((r = sshpkt_start(ssh, in process_gssapi_token()
762 (r = sshpkt_put_string(ssh, mic.value, in process_gssapi_token()
764 (r = sshpkt_send(ssh)) != 0) in process_gssapi_token()
778 input_gssapi_response(int type, u_int32_t plen, struct ssh *ssh) in input_gssapi_response() argument
780 Authctxt *authctxt = ssh->authctxt; in input_gssapi_response()
791 if ((r = sshpkt_get_string(ssh, &oidv, &oidlen)) != 0) in input_gssapi_response()
805 if ((r = sshpkt_get_end(ssh)) != 0) in input_gssapi_response()
808 if (GSS_ERROR(process_gssapi_token(ssh, GSS_C_NO_BUFFER))) { in input_gssapi_response()
823 input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh) in input_gssapi_token() argument
825 Authctxt *authctxt = ssh->authctxt; in input_gssapi_token()
835 if ((r = sshpkt_get_string(ssh, &p, &len)) != 0 || in input_gssapi_token()
836 (r = sshpkt_get_end(ssh)) != 0) in input_gssapi_token()
841 status = process_gssapi_token(ssh, &recv_tok); in input_gssapi_token()
856 input_gssapi_errtok(int type, u_int32_t plen, struct ssh *ssh) in input_gssapi_errtok() argument
858 Authctxt *authctxt = ssh->authctxt; in input_gssapi_errtok()
871 if ((r = sshpkt_get_string(ssh, &p, &len)) != 0 || in input_gssapi_errtok()
872 (r = sshpkt_get_end(ssh)) != 0) { in input_gssapi_errtok()
891 input_gssapi_error(int type, u_int32_t plen, struct ssh *ssh) in input_gssapi_error() argument
897 if ((r = sshpkt_get_u32(ssh, NULL)) != 0 || /* maj */ in input_gssapi_error()
898 (r = sshpkt_get_u32(ssh, NULL)) != 0 || /* min */ in input_gssapi_error()
899 (r = sshpkt_get_cstring(ssh, &msg, NULL)) != 0 || in input_gssapi_error()
900 (r = sshpkt_get_cstring(ssh, &lang, NULL)) != 0) in input_gssapi_error()
902 r = sshpkt_get_end(ssh); in input_gssapi_error()
914 struct ssh *ssh = active_state; /* XXX */ in userauth_none() local
918 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in userauth_none()
919 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_none()
920 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_none()
921 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_none()
922 (r = sshpkt_send(ssh)) != 0) in userauth_none()
930 struct ssh *ssh = active_state; /* XXX */ in userauth_passwd() local
947 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in userauth_passwd()
948 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_passwd()
949 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_passwd()
950 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_passwd()
951 (r = sshpkt_put_u8(ssh, 0)) != 0 || in userauth_passwd()
952 (r = sshpkt_put_cstring(ssh, password)) != 0 || in userauth_passwd()
953 (r = sshpkt_add_padding(ssh, 64)) != 0 || in userauth_passwd()
954 (r = sshpkt_send(ssh)) != 0) in userauth_passwd()
960 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, in userauth_passwd()
971 input_userauth_passwd_changereq(int type, u_int32_t seqnr, struct ssh *ssh) in input_userauth_passwd_changereq() argument
973 Authctxt *authctxt = ssh->authctxt; in input_userauth_passwd_changereq()
986 if ((r = sshpkt_get_cstring(ssh, &info, NULL)) != 0 || in input_userauth_passwd_changereq()
987 (r = sshpkt_get_cstring(ssh, &lang, NULL)) != 0) in input_userauth_passwd_changereq()
991 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in input_userauth_passwd_changereq()
992 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in input_userauth_passwd_changereq()
993 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in input_userauth_passwd_changereq()
994 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in input_userauth_passwd_changereq()
995 (r = sshpkt_put_u8(ssh, 1)) != 0) /* additional info */ in input_userauth_passwd_changereq()
1002 if ((r = sshpkt_put_cstring(ssh, password)) != 0) in input_userauth_passwd_changereq()
1028 if ((r = sshpkt_put_cstring(ssh, password)) != 0 || in input_userauth_passwd_changereq()
1029 (r = sshpkt_add_padding(ssh, 64)) != 0 || in input_userauth_passwd_changereq()
1030 (r = sshpkt_send(ssh)) != 0) in input_userauth_passwd_changereq()
1033 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, in input_userauth_passwd_changereq()
1052 key_sig_algorithm(struct ssh *ssh, const struct sshkey *key) in key_sig_algorithm() argument
1061 if (ssh == NULL || ssh->kex->server_sig_algs == NULL || in key_sig_algorithm()
1078 tmp = match_list(sshkey_sigalg_by_name(cp), ssh->kex->server_sig_algs, NULL); in key_sig_algorithm()
1153 sign_and_send_pubkey(struct ssh *ssh, Authctxt *authctxt, Identity *id) in sign_and_send_pubkey() argument
1225 if ((alg = key_sig_algorithm(fallback_sigtype ? NULL : ssh, in sign_and_send_pubkey()
1295 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in sign_and_send_pubkey()
1296 (r = sshpkt_putb(ssh, b)) != 0 || in sign_and_send_pubkey()
1297 (r = sshpkt_send(ssh)) != 0) in sign_and_send_pubkey()
1312 send_pubkey_test(struct ssh *ssh, Authctxt *authctxt, Identity *id) in send_pubkey_test() argument
1320 if ((alg = key_sig_algorithm(ssh, id->key)) == NULL) { in send_pubkey_test()
1331 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_PK_OK, &input_userauth_pk_ok); in send_pubkey_test()
1333 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in send_pubkey_test()
1334 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in send_pubkey_test()
1335 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in send_pubkey_test()
1336 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in send_pubkey_test()
1337 (r = sshpkt_put_u8(ssh, have_sig)) != 0 || in send_pubkey_test()
1338 (r = sshpkt_put_cstring(ssh, alg)) != 0 || in send_pubkey_test()
1339 (r = sshpkt_put_string(ssh, blob, bloblen)) != 0 || in send_pubkey_test()
1340 (r = sshpkt_send(ssh)) != 0) in send_pubkey_test()
1625 struct ssh *ssh = active_state; /* XXX */ in userauth_pubkey() local
1653 sent = send_pubkey_test(ssh, authctxt, id); in userauth_pubkey()
1661 sent = sign_and_send_pubkey(ssh, in userauth_pubkey()
1681 struct ssh *ssh = active_state; /* XXX */ in userauth_kbdint() local
1690 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_INFO_REQUEST, NULL); in userauth_kbdint()
1695 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in userauth_kbdint()
1696 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_kbdint()
1697 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_kbdint()
1698 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_kbdint()
1699 (r = sshpkt_put_cstring(ssh, "")) != 0 || /* lang */ in userauth_kbdint()
1700 (r = sshpkt_put_cstring(ssh, options.kbd_interactive_devices ? in userauth_kbdint()
1702 (r = sshpkt_send(ssh)) != 0) in userauth_kbdint()
1705 ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_INFO_REQUEST, &input_userauth_info_req); in userauth_kbdint()
1713 input_userauth_info_req(int type, u_int32_t seq, struct ssh *ssh) in input_userauth_info_req() argument
1715 Authctxt *authctxt = ssh->authctxt; in input_userauth_info_req()
1729 if ((r = sshpkt_get_cstring(ssh, &name, NULL)) != 0 || in input_userauth_info_req()
1730 (r = sshpkt_get_cstring(ssh, &inst, NULL)) != 0 || in input_userauth_info_req()
1731 (r = sshpkt_get_cstring(ssh, &lang, NULL)) != 0) in input_userauth_info_req()
1738 if ((r = sshpkt_get_u32(ssh, &num_prompts)) != 0) in input_userauth_info_req()
1746 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_INFO_RESPONSE)) != 0 || in input_userauth_info_req()
1747 (r = sshpkt_put_u32(ssh, num_prompts)) != 0) in input_userauth_info_req()
1752 if ((r = sshpkt_get_cstring(ssh, &prompt, NULL)) != 0 || in input_userauth_info_req()
1753 (r = sshpkt_get_u8(ssh, &echo)) != 0) in input_userauth_info_req()
1756 if ((r = sshpkt_put_cstring(ssh, response)) != 0) in input_userauth_info_req()
1763 if ((r = sshpkt_get_end(ssh)) != 0 || in input_userauth_info_req()
1764 (r = sshpkt_add_padding(ssh, 64)) != 0) in input_userauth_info_req()
1766 r = sshpkt_send(ssh); in input_userauth_info_req()
1894 struct ssh *ssh = active_state; /* XXX */ in userauth_hostbased() local
1999 if ((r = sshpkt_start(ssh, SSH2_MSG_USERAUTH_REQUEST)) != 0 || in userauth_hostbased()
2000 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_hostbased()
2001 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_hostbased()
2002 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_hostbased()
2003 (r = sshpkt_put_cstring(ssh, sshkey_ssh_name(private))) != 0 || in userauth_hostbased()
2004 (r = sshpkt_put_string(ssh, keyblob, keylen)) != 0 || in userauth_hostbased()
2005 (r = sshpkt_put_cstring(ssh, chost)) != 0 || in userauth_hostbased()
2006 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 || in userauth_hostbased()
2007 (r = sshpkt_put_string(ssh, sig, siglen)) != 0 || in userauth_hostbased()
2008 (r = sshpkt_send(ssh)) != 0) { in userauth_hostbased()