Lines Matching +full:0 +full:m

98 	if ((r = sshbuf_put_u32(log_msg, 0)) != 0 || /* length; filled below */  in mm_log_handler()
99 (r = sshbuf_put_u32(log_msg, level)) != 0 || in mm_log_handler()
100 (r = sshbuf_put_u32(log_msg, forced)) != 0 || in mm_log_handler()
101 (r = sshbuf_put_cstring(log_msg, msg)) != 0) in mm_log_handler()
103 if ((len = sshbuf_len(log_msg)) < 4 || len > 0xffffffff) in mm_log_handler()
119 return (pmonitor && pmonitor->m_pid > 0); in mm_is_monitor()
123 mm_request_send(int sock, enum monitor_reqtype type, struct sshbuf *m) in mm_request_send() argument
125 size_t mlen = sshbuf_len(m); in mm_request_send()
130 if (mlen >= 0xffffffff) in mm_request_send()
136 if (atomicio(vwrite, sock, sshbuf_mutable_ptr(m), mlen) != mlen) in mm_request_send()
141 mm_request_receive(int sock, struct sshbuf *m) in mm_request_receive() argument
157 sshbuf_reset(m); in mm_request_receive()
158 if ((r = sshbuf_reserve(m, msg_len, &p)) != 0) in mm_request_receive()
165 mm_request_receive_expect(int sock, enum monitor_reqtype type, struct sshbuf *m) in mm_request_receive_expect() argument
172 mm_request_receive(sock, m); in mm_request_receive_expect()
173 if ((r = sshbuf_get_u8(m, &rtype)) != 0) in mm_request_receive_expect()
185 u_char success = 0; in mm_choose_dh()
186 struct sshbuf *m; in mm_choose_dh() local
188 if ((m = sshbuf_new()) == NULL) in mm_choose_dh()
190 if ((r = sshbuf_put_u32(m, min)) != 0 || in mm_choose_dh()
191 (r = sshbuf_put_u32(m, nbits)) != 0 || in mm_choose_dh()
192 (r = sshbuf_put_u32(m, max)) != 0) in mm_choose_dh()
195 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_MODULI, m); in mm_choose_dh()
198 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_MODULI, m); in mm_choose_dh()
200 if ((r = sshbuf_get_u8(m, &success)) != 0) in mm_choose_dh()
202 if (success == 0) in mm_choose_dh()
205 if ((r = sshbuf_get_bignum2(m, &p)) != 0 || in mm_choose_dh()
206 (r = sshbuf_get_bignum2(m, &g)) != 0) in mm_choose_dh()
209 debug3_f("remaining %zu", sshbuf_len(m)); in mm_choose_dh()
210 sshbuf_free(m); in mm_choose_dh()
222 struct sshbuf *m; in mm_sshkey_sign() local
223 u_int ndx = kex->host_key_index(key, 0, ssh); in mm_sshkey_sign()
227 if ((m = sshbuf_new()) == NULL) in mm_sshkey_sign()
229 if ((r = sshbuf_put_u32(m, ndx)) != 0 || in mm_sshkey_sign()
230 (r = sshbuf_put_string(m, data, datalen)) != 0 || in mm_sshkey_sign()
231 (r = sshbuf_put_cstring(m, hostkey_alg)) != 0 || in mm_sshkey_sign()
232 (r = sshbuf_put_u32(m, compat)) != 0) in mm_sshkey_sign()
235 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SIGN, m); in mm_sshkey_sign()
238 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SIGN, m); in mm_sshkey_sign()
239 if ((r = sshbuf_get_string(m, sigp, lenp)) != 0) in mm_sshkey_sign()
241 sshbuf_free(m); in mm_sshkey_sign()
243 return (0); in mm_sshkey_sign()
248 if ((r = sshbuf_get_string_direct(b, &p, &len)) != 0) \
253 } while (0)
258 struct sshbuf *m; in mm_getpwnamallow() local
269 if ((m = sshbuf_new()) == NULL) in mm_getpwnamallow()
271 if ((r = sshbuf_put_cstring(m, username)) != 0) in mm_getpwnamallow()
274 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PWNAM, m); in mm_getpwnamallow()
277 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PWNAM, m); in mm_getpwnamallow()
279 if ((r = sshbuf_get_u8(m, &ok)) != 0) in mm_getpwnamallow()
281 if (ok == 0) { in mm_getpwnamallow()
288 GETPW(m, pw_uid); in mm_getpwnamallow()
289 GETPW(m, pw_gid); in mm_getpwnamallow()
291 GETPW(m, pw_change); in mm_getpwnamallow()
294 GETPW(m, pw_expire); in mm_getpwnamallow()
296 if ((r = sshbuf_get_cstring(m, &pw->pw_name, NULL)) != 0 || in mm_getpwnamallow()
297 (r = sshbuf_get_cstring(m, &pw->pw_passwd, NULL)) != 0 || in mm_getpwnamallow()
299 (r = sshbuf_get_cstring(m, &pw->pw_gecos, NULL)) != 0 || in mm_getpwnamallow()
302 (r = sshbuf_get_cstring(m, &pw->pw_class, NULL)) != 0 || in mm_getpwnamallow()
304 (r = sshbuf_get_cstring(m, &pw->pw_dir, NULL)) != 0 || in mm_getpwnamallow()
305 (r = sshbuf_get_cstring(m, &pw->pw_shell, NULL)) != 0) in mm_getpwnamallow()
310 if ((r = sshbuf_get_string_direct(m, &p, &len)) != 0) in mm_getpwnamallow()
319 (r = sshbuf_get_cstring(m, &newopts->x, NULL)) != 0) \ in mm_getpwnamallow()
321 } while (0) in mm_getpwnamallow()
323 newopts->x = newopts->nx == 0 ? \ in mm_getpwnamallow()
325 for (i = 0; i < newopts->nx; i++) { \ in mm_getpwnamallow()
326 if ((r = sshbuf_get_cstring(m, \ in mm_getpwnamallow()
327 &newopts->x[i], NULL)) != 0) \ in mm_getpwnamallow()
330 } while (0) in mm_getpwnamallow()
339 for (i = 0; i < options.num_log_verbose; i++) in mm_getpwnamallow()
345 sshbuf_free(m); in mm_getpwnamallow()
353 struct sshbuf *m; in mm_auth2_read_banner() local
359 if ((m = sshbuf_new()) == NULL) in mm_auth2_read_banner()
361 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTH2_READ_BANNER, m); in mm_auth2_read_banner()
362 sshbuf_reset(m); in mm_auth2_read_banner()
365 MONITOR_ANS_AUTH2_READ_BANNER, m); in mm_auth2_read_banner()
366 if ((r = sshbuf_get_cstring(m, &banner, NULL)) != 0) in mm_auth2_read_banner()
368 sshbuf_free(m); in mm_auth2_read_banner()
371 if (strlen(banner) == 0) { in mm_auth2_read_banner()
383 struct sshbuf *m; in mm_inform_authserv() local
388 if ((m = sshbuf_new()) == NULL) in mm_inform_authserv()
390 if ((r = sshbuf_put_cstring(m, service)) != 0 || in mm_inform_authserv()
391 (r = sshbuf_put_cstring(m, style ? style : "")) != 0) in mm_inform_authserv()
394 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, m); in mm_inform_authserv()
396 sshbuf_free(m); in mm_inform_authserv()
403 struct sshbuf *m; in mm_auth_password() local
404 int r, authenticated = 0; in mm_auth_password()
406 u_int maxtries = 0; in mm_auth_password()
411 if ((m = sshbuf_new()) == NULL) in mm_auth_password()
413 if ((r = sshbuf_put_cstring(m, password)) != 0) in mm_auth_password()
415 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHPASSWORD, m); in mm_auth_password()
419 MONITOR_ANS_AUTHPASSWORD, m); in mm_auth_password()
421 if ((r = sshbuf_get_u32(m, &authenticated)) != 0) in mm_auth_password()
424 if ((r = sshbuf_get_u32(m, &maxtries)) != 0) in mm_auth_password()
431 sshbuf_free(m); in mm_auth_password()
449 return (mm_key_allowed(MM_HOSTKEY, user, host, key, 0, NULL)); in mm_hostbased_key_allowed()
456 struct sshbuf *m; in mm_key_allowed() local
457 int r, allowed = 0; in mm_key_allowed()
465 if ((m = sshbuf_new()) == NULL) in mm_key_allowed()
467 if ((r = sshbuf_put_u32(m, type)) != 0 || in mm_key_allowed()
468 (r = sshbuf_put_cstring(m, user ? user : "")) != 0 || in mm_key_allowed()
469 (r = sshbuf_put_cstring(m, host ? host : "")) != 0 || in mm_key_allowed()
470 (r = sshkey_puts(key, m)) != 0 || in mm_key_allowed()
471 (r = sshbuf_put_u32(m, pubkey_auth_attempt)) != 0) in mm_key_allowed()
474 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYALLOWED, m); in mm_key_allowed()
478 MONITOR_ANS_KEYALLOWED, m); in mm_key_allowed()
480 if ((r = sshbuf_get_u32(m, &allowed)) != 0) in mm_key_allowed()
483 (r = sshauthopt_deserialise(m, &opts)) != 0) in mm_key_allowed()
485 sshbuf_free(m); in mm_key_allowed()
507 struct sshbuf *m; in mm_sshkey_verify() local
508 u_int encoded_ret = 0; in mm_sshkey_verify()
517 if ((m = sshbuf_new()) == NULL) in mm_sshkey_verify()
519 if ((r = sshkey_puts(key, m)) != 0 || in mm_sshkey_verify()
520 (r = sshbuf_put_string(m, sig, siglen)) != 0 || in mm_sshkey_verify()
521 (r = sshbuf_put_string(m, data, datalen)) != 0 || in mm_sshkey_verify()
522 (r = sshbuf_put_cstring(m, sigalg == NULL ? "" : sigalg)) != 0) in mm_sshkey_verify()
525 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_KEYVERIFY, m); in mm_sshkey_verify()
529 MONITOR_ANS_KEYVERIFY, m); in mm_sshkey_verify()
531 if ((r = sshbuf_get_u32(m, &encoded_ret)) != 0 || in mm_sshkey_verify()
532 (r = sshbuf_get_u8(m, &sig_details_present)) != 0) in mm_sshkey_verify()
534 if (sig_details_present && encoded_ret == 0) { in mm_sshkey_verify()
535 if ((r = sshbuf_get_u32(m, &counter)) != 0 || in mm_sshkey_verify()
536 (r = sshbuf_get_u8(m, &flags)) != 0) in mm_sshkey_verify()
545 sshbuf_free(m); in mm_sshkey_verify()
547 if (encoded_ret != 0) in mm_sshkey_verify()
549 return 0; in mm_sshkey_verify()
555 struct sshbuf *m; in mm_send_keystate() local
558 if ((m = sshbuf_new()) == NULL) in mm_send_keystate()
560 if ((r = ssh_packet_get_state(ssh, m)) != 0) in mm_send_keystate()
562 mm_request_send(monitor->m_recvfd, MONITOR_REQ_KEYEXPORT, m); in mm_send_keystate()
564 sshbuf_free(m); in mm_send_keystate()
570 struct sshbuf *m; in mm_pty_allocate() local
572 int success = 0, tmp1 = -1, tmp2 = -1, r; in mm_pty_allocate()
578 if (tmp1 >= 0) in mm_pty_allocate()
580 return 0; in mm_pty_allocate()
585 if ((m = sshbuf_new()) == NULL) in mm_pty_allocate()
587 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTY, m); in mm_pty_allocate()
590 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PTY, m); in mm_pty_allocate()
592 if ((r = sshbuf_get_u32(m, &success)) != 0) in mm_pty_allocate()
594 if (success == 0) { in mm_pty_allocate()
596 sshbuf_free(m); in mm_pty_allocate()
597 return (0); in mm_pty_allocate()
599 if ((r = sshbuf_get_cstring(m, &p, NULL)) != 0 || in mm_pty_allocate()
600 (r = sshbuf_get_cstring(m, &msg, NULL)) != 0) in mm_pty_allocate()
602 sshbuf_free(m); in mm_pty_allocate()
607 if ((r = sshbuf_put(loginmsg, msg, strlen(msg))) != 0) in mm_pty_allocate()
622 struct sshbuf *m; in mm_session_pty_cleanup2() local
627 if ((m = sshbuf_new()) == NULL) in mm_session_pty_cleanup2()
629 if ((r = sshbuf_put_cstring(m, s->tty)) != 0) in mm_session_pty_cleanup2()
631 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PTYCLEANUP, m); in mm_session_pty_cleanup2()
632 sshbuf_free(m); in mm_session_pty_cleanup2()
647 struct sshbuf *m; in mm_start_pam() local
652 if ((m = sshbuf_new()) == NULL) in mm_start_pam()
654 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_START, m); in mm_start_pam()
656 sshbuf_free(m); in mm_start_pam()
662 struct sshbuf *m; in mm_do_pam_account() local
672 if ((m = sshbuf_new()) == NULL) in mm_do_pam_account()
674 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_ACCOUNT, m); in mm_do_pam_account()
677 MONITOR_ANS_PAM_ACCOUNT, m); in mm_do_pam_account()
678 if ((r = sshbuf_get_u32(m, &ret)) != 0 || in mm_do_pam_account()
679 (r = sshbuf_get_cstring(m, &msg, &msglen)) != 0 || in mm_do_pam_account()
680 (r = sshbuf_put(loginmsg, msg, msglen)) != 0) in mm_do_pam_account()
684 sshbuf_free(m); in mm_do_pam_account()
694 struct sshbuf *m; in mm_sshpam_init_ctx() local
698 if ((m = sshbuf_new()) == NULL) in mm_sshpam_init_ctx()
700 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_INIT_CTX, m); in mm_sshpam_init_ctx()
703 MONITOR_ANS_PAM_INIT_CTX, m); in mm_sshpam_init_ctx()
704 if ((r = sshbuf_get_u32(m, &success)) != 0) in mm_sshpam_init_ctx()
706 if (success == 0) { in mm_sshpam_init_ctx()
708 sshbuf_free(m); in mm_sshpam_init_ctx()
711 sshbuf_free(m); in mm_sshpam_init_ctx()
719 struct sshbuf *m; in mm_sshpam_query() local
724 if ((m = sshbuf_new()) == NULL) in mm_sshpam_query()
726 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_QUERY, m); in mm_sshpam_query()
728 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_PAM_QUERY, m); in mm_sshpam_query()
729 if ((r = sshbuf_get_u32(m, &ret)) != 0 || in mm_sshpam_query()
730 (r = sshbuf_get_cstring(m, name, NULL)) != 0 || in mm_sshpam_query()
731 (r = sshbuf_get_cstring(m, info, NULL)) != 0 || in mm_sshpam_query()
732 (r = sshbuf_get_u32(m, &n)) != 0 || in mm_sshpam_query()
733 (r = sshbuf_get_u32(m, num)) != 0) in mm_sshpam_query()
742 for (i = 0; i < *num; ++i) { in mm_sshpam_query()
743 if ((r = sshbuf_get_cstring(m, &((*prompts)[i]), NULL)) != 0 || in mm_sshpam_query()
744 (r = sshbuf_get_u32(m, &((*echo_on)[i]))) != 0) in mm_sshpam_query()
747 sshbuf_free(m); in mm_sshpam_query()
754 struct sshbuf *m; in mm_sshpam_respond() local
759 if ((m = sshbuf_new()) == NULL) in mm_sshpam_respond()
761 if ((r = sshbuf_put_u32(m, num)) != 0) in mm_sshpam_respond()
763 for (i = 0; i < num; ++i) { in mm_sshpam_respond()
764 if ((r = sshbuf_put_cstring(m, resp[i])) != 0) in mm_sshpam_respond()
767 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_RESPOND, m); in mm_sshpam_respond()
770 MONITOR_ANS_PAM_RESPOND, m); in mm_sshpam_respond()
771 if ((r = sshbuf_get_u32(m, &n)) != 0) in mm_sshpam_respond()
775 sshbuf_free(m); in mm_sshpam_respond()
782 struct sshbuf *m; in mm_sshpam_free_ctx() local
785 if ((m = sshbuf_new()) == NULL) in mm_sshpam_free_ctx()
787 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_FREE_CTX, m); in mm_sshpam_free_ctx()
790 MONITOR_ANS_PAM_FREE_CTX, m); in mm_sshpam_free_ctx()
791 sshbuf_free(m); in mm_sshpam_free_ctx()
800 struct sshbuf *m; in mm_terminate() local
802 if ((m = sshbuf_new()) == NULL) in mm_terminate()
804 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_TERM, m); in mm_terminate()
805 sshbuf_free(m); in mm_terminate()
817 (*echo_on)[0] = 0; in mm_chall_setup()
824 struct sshbuf *m; in mm_bsdauth_query() local
831 if ((m = sshbuf_new()) == NULL) in mm_bsdauth_query()
833 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, m); in mm_bsdauth_query()
836 MONITOR_ANS_BSDAUTHQUERY, m); in mm_bsdauth_query()
837 if ((r = sshbuf_get_u32(m, &success)) != 0) in mm_bsdauth_query()
839 if (success == 0) { in mm_bsdauth_query()
841 sshbuf_free(m); in mm_bsdauth_query()
846 if ((r = sshbuf_get_cstring(m, &challenge, NULL)) != 0) in mm_bsdauth_query()
848 sshbuf_free(m); in mm_bsdauth_query()
851 (*prompts)[0] = challenge; in mm_bsdauth_query()
855 return (0); in mm_bsdauth_query()
861 struct sshbuf *m; in mm_bsdauth_respond() local
868 if ((m = sshbuf_new()) == NULL) in mm_bsdauth_respond()
870 if ((r = sshbuf_put_cstring(m, responses[0])) != 0) in mm_bsdauth_respond()
872 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHRESPOND, m); in mm_bsdauth_respond()
875 MONITOR_ANS_BSDAUTHRESPOND, m); in mm_bsdauth_respond()
877 if ((r = sshbuf_get_u32(m, &authok)) != 0) in mm_bsdauth_respond()
879 sshbuf_free(m); in mm_bsdauth_respond()
881 return ((authok == 0) ? -1 : 0); in mm_bsdauth_respond()
888 struct sshbuf *m; in mm_audit_event() local
893 if ((m = sshbuf_new()) == NULL) in mm_audit_event()
895 if ((r = sshbuf_put_u32(m, event)) != 0) in mm_audit_event()
898 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUDIT_EVENT, m); in mm_audit_event()
899 sshbuf_free(m); in mm_audit_event()
905 struct sshbuf *m; in mm_audit_run_command() local
910 if ((m = sshbuf_new()) == NULL) in mm_audit_run_command()
912 if ((r = sshbuf_put_cstring(m, command)) != 0) in mm_audit_run_command()
915 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUDIT_COMMAND, m); in mm_audit_run_command()
916 sshbuf_free(m); in mm_audit_run_command()
924 struct sshbuf *m; in mm_ssh_gssapi_server_ctx() local
931 if ((m = sshbuf_new()) == NULL) in mm_ssh_gssapi_server_ctx()
933 if ((r = sshbuf_put_string(m, goid->elements, goid->length)) != 0) in mm_ssh_gssapi_server_ctx()
936 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSETUP, m); in mm_ssh_gssapi_server_ctx()
937 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSETUP, m); in mm_ssh_gssapi_server_ctx()
939 if ((r = sshbuf_get_u32(m, &major)) != 0) in mm_ssh_gssapi_server_ctx()
942 sshbuf_free(m); in mm_ssh_gssapi_server_ctx()
950 struct sshbuf *m; in mm_ssh_gssapi_accept_ctx() local
955 if ((m = sshbuf_new()) == NULL) in mm_ssh_gssapi_accept_ctx()
957 if ((r = sshbuf_put_string(m, in->value, in->length)) != 0) in mm_ssh_gssapi_accept_ctx()
960 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSSTEP, m); in mm_ssh_gssapi_accept_ctx()
961 mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_GSSSTEP, m); in mm_ssh_gssapi_accept_ctx()
963 if ((r = sshbuf_get_u32(m, &major)) != 0 || in mm_ssh_gssapi_accept_ctx()
964 (r = ssh_gssapi_get_buffer_desc(m, out)) != 0) in mm_ssh_gssapi_accept_ctx()
967 if ((r = sshbuf_get_u32(m, &flags)) != 0) in mm_ssh_gssapi_accept_ctx()
972 sshbuf_free(m); in mm_ssh_gssapi_accept_ctx()
980 struct sshbuf *m; in mm_ssh_gssapi_checkmic() local
984 if ((m = sshbuf_new()) == NULL) in mm_ssh_gssapi_checkmic()
986 if ((r = sshbuf_put_string(m, gssbuf->value, gssbuf->length)) != 0 || in mm_ssh_gssapi_checkmic()
987 (r = sshbuf_put_string(m, gssmic->value, gssmic->length)) != 0) in mm_ssh_gssapi_checkmic()
990 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSCHECKMIC, m); in mm_ssh_gssapi_checkmic()
992 MONITOR_ANS_GSSCHECKMIC, m); in mm_ssh_gssapi_checkmic()
994 if ((r = sshbuf_get_u32(m, &major)) != 0) in mm_ssh_gssapi_checkmic()
996 sshbuf_free(m); in mm_ssh_gssapi_checkmic()
1003 struct sshbuf *m; in mm_ssh_gssapi_userok() local
1004 int r, authenticated = 0; in mm_ssh_gssapi_userok()
1006 if ((m = sshbuf_new()) == NULL) in mm_ssh_gssapi_userok()
1009 mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_GSSUSEROK, m); in mm_ssh_gssapi_userok()
1011 MONITOR_ANS_GSSUSEROK, m); in mm_ssh_gssapi_userok()
1013 if ((r = sshbuf_get_u32(m, &authenticated)) != 0) in mm_ssh_gssapi_userok()
1016 sshbuf_free(m); in mm_ssh_gssapi_userok()