Lines Matching refs:ssh
158 static void client_init_dispatch(struct ssh *ssh);
218 set_control_persist_exit_time(struct ssh *ssh) in set_control_persist_exit_time() argument
224 } else if (channel_still_open(ssh)) { in set_control_persist_exit_time()
262 client_x11_get_proto(struct ssh *ssh, const char *display, in client_x11_get_proto() argument
357 channel_set_x11_refuse_time(ssh, in client_x11_get_proto()
433 client_check_window_change(struct ssh *ssh) in client_check_window_change() argument
439 channel_send_window_changes(ssh); in client_check_window_change()
443 client_global_request_reply(int type, u_int32_t seq, struct ssh *ssh) in client_global_request_reply() argument
450 gc->cb(ssh, type, seq, gc->ctx); in client_global_request_reply()
456 ssh_packet_set_alive_timeouts(ssh, 0); in client_global_request_reply()
468 server_alive_check(struct ssh *ssh) in server_alive_check() argument
472 if (ssh_packet_inc_alive_timeouts(ssh) > options.server_alive_count_max) { in server_alive_check()
476 if ((r = sshpkt_start(ssh, SSH2_MSG_GLOBAL_REQUEST)) != 0 || in server_alive_check()
477 (r = sshpkt_put_cstring(ssh, "[email protected]")) != 0 || in server_alive_check()
478 (r = sshpkt_put_u8(ssh, 1)) != 0 || /* boolean: want reply */ in server_alive_check()
479 (r = sshpkt_send(ssh)) != 0) in server_alive_check()
491 client_wait_until_can_do_something(struct ssh *ssh, in client_wait_until_can_do_something() argument
501 channel_prepare_select(ssh, readsetp, writesetp, maxfdp, in client_wait_until_can_do_something()
505 if (session_closed && !channel_still_open(ssh) && in client_wait_until_can_do_something()
506 !ssh_packet_have_data_to_write(ssh)) { in client_wait_until_can_do_something()
516 if (ssh_packet_have_data_to_write(ssh)) in client_wait_until_can_do_something()
530 ssh_packet_get_rekey_timeout(ssh)); in client_wait_until_can_do_something()
531 set_control_persist_exit_time(ssh); in client_wait_until_can_do_something()
571 server_alive_check(ssh); in client_wait_until_can_do_something()
601 client_process_net_input(struct ssh *ssh, fd_set *readset) in client_process_net_input() argument
646 ssh_packet_process_incoming(ssh, buf, len); in client_process_net_input()
651 client_status_confirm(struct ssh *ssh, int type, Channel *c, void *ctx) in client_status_confirm() argument
705 mux_tty_alloc_failed(ssh, c); in client_status_confirm()
707 chan_read_failed(ssh, c); in client_status_confirm()
708 chan_write_failed(ssh, c); in client_status_confirm()
715 client_abandon_status_confirm(struct ssh *ssh, Channel *c, void *ctx) in client_abandon_status_confirm() argument
721 client_expect_confirm(struct ssh *ssh, int id, const char *request, in client_expect_confirm() argument
729 channel_register_status_confirm(ssh, id, client_status_confirm, in client_expect_confirm()
755 process_cmdline(struct ssh *ssh) in process_cmdline() argument
829 ok = channel_request_rforward_cancel(ssh, &fwd) == 0; in process_cmdline()
831 ok = channel_cancel_lport_listener(ssh, &fwd, in process_cmdline()
834 ok = channel_cancel_lport_listener(ssh, &fwd, in process_cmdline()
848 if (!channel_setup_local_fwd_listener(ssh, &fwd, in process_cmdline()
854 if (channel_request_remote_forwarding(ssh, &fwd) < 0) { in process_cmdline()
932 process_escapes(struct ssh *ssh, Channel *c, in process_escapes() argument
967 chan_read_failed(ssh, c); in process_escapes()
968 chan_write_failed(ssh, c); in process_escapes()
970 c->detach_user(ssh, in process_escapes()
975 chan_ibuf_empty(ssh, c); in process_escapes()
1013 channel_request_start(ssh, c->self, "break", 0); in process_escapes()
1014 if ((r = sshpkt_put_u32(ssh, 1000)) != 0 || in process_escapes()
1015 (r = sshpkt_send(ssh)) != 0) in process_escapes()
1020 if (ssh->compat & SSH_BUG_NOREKEY) in process_escapes()
1065 channel_stop_listening(ssh); in process_escapes()
1096 s = channel_open_message(ssh); in process_escapes()
1105 process_cmdline(ssh); in process_escapes()
1158 client_process_buffered_input_packets(struct ssh *ssh) in client_process_buffered_input_packets() argument
1160 ssh_dispatch_run_fatal(ssh, DISPATCH_NONBLOCK, &quit_pending); in client_process_buffered_input_packets()
1179 client_filter_cleanup(struct ssh *ssh, int cid, void *ctx) in client_filter_cleanup() argument
1185 client_simple_escape_filter(struct ssh *ssh, Channel *c, char *buf, int len) in client_simple_escape_filter() argument
1190 return process_escapes(ssh, c, c->input, c->output, c->extended, in client_simple_escape_filter()
1195 client_channel_closed(struct ssh *ssh, int id, void *arg) in client_channel_closed() argument
1197 channel_cancel_cleanup(ssh, id); in client_channel_closed()
1209 client_loop(struct ssh *ssh, int have_pty, int escape_char_arg, in client_loop() argument
1256 connection_in = ssh_packet_get_connection_in(ssh); in client_loop()
1257 connection_out = ssh_packet_get_connection_out(ssh); in client_loop()
1266 client_init_dispatch(ssh); in client_loop()
1288 channel_register_filter(ssh, session_ident, in client_loop()
1294 channel_register_cleanup(ssh, session_ident, in client_loop()
1304 client_process_buffered_input_packets(ssh); in client_loop()
1306 if (session_closed && !channel_still_open(ssh)) in client_loop()
1309 if (ssh_packet_is_rekeying(ssh)) { in client_loop()
1314 if ((r = kex_start_rekex(ssh)) != 0) in client_loop()
1322 if (ssh_packet_not_very_much_data_to_write(ssh)) in client_loop()
1323 channel_output_poll(ssh); in client_loop()
1329 client_check_window_change(ssh); in client_loop()
1339 client_wait_until_can_do_something(ssh, &readset, &writeset, in client_loop()
1340 &max_fd2, &nalloc, ssh_packet_is_rekeying(ssh)); in client_loop()
1346 if (!ssh_packet_is_rekeying(ssh)) in client_loop()
1347 channel_after_select(ssh, readset, writeset); in client_loop()
1350 client_process_net_input(ssh, readset); in client_loop()
1356 if ((r = ssh_packet_check_rekey(ssh)) != 0) in client_loop()
1364 if ((r = ssh_packet_write_poll(ssh)) != 0) { in client_loop()
1365 sshpkt_fatal(ssh, r, in client_loop()
1390 if ((r = sshpkt_start(ssh, SSH2_MSG_DISCONNECT)) != 0 || in client_loop()
1391 (r = sshpkt_put_u32(ssh, SSH2_DISCONNECT_BY_APPLICATION)) != 0 || in client_loop()
1392 (r = sshpkt_put_cstring(ssh, "disconnected by user")) != 0 || in client_loop()
1393 (r = sshpkt_put_cstring(ssh, "")) != 0 || /* language tag */ in client_loop()
1394 (r = sshpkt_send(ssh)) != 0 || in client_loop()
1395 (r = ssh_packet_write_wait(ssh)) != 0) in client_loop()
1398 channel_free_all(ssh); in client_loop()
1445 ssh_packet_get_bytes(ssh, &ibytes, &obytes); in client_loop()
1459 client_request_forwarded_tcpip(struct ssh *ssh, const char *request_type, in client_request_forwarded_tcpip() argument
1469 if ((r = sshpkt_get_cstring(ssh, &listen_address, NULL)) != 0 || in client_request_forwarded_tcpip()
1470 (r = sshpkt_get_u32(ssh, &listen_port)) != 0 || in client_request_forwarded_tcpip()
1471 (r = sshpkt_get_cstring(ssh, &originator_address, NULL)) != 0 || in client_request_forwarded_tcpip()
1472 (r = sshpkt_get_u32(ssh, &originator_port)) != 0 || in client_request_forwarded_tcpip()
1473 (r = sshpkt_get_end(ssh)) != 0) in client_request_forwarded_tcpip()
1484 c = channel_connect_by_listen_address(ssh, in client_request_forwarded_tcpip()
1519 client_request_forwarded_streamlocal(struct ssh *ssh, in client_request_forwarded_streamlocal() argument
1527 if ((r = sshpkt_get_cstring(ssh, &listen_path, NULL)) != 0 || in client_request_forwarded_streamlocal()
1528 (r = sshpkt_get_string(ssh, NULL, NULL)) != 0 || /* reserved */ in client_request_forwarded_streamlocal()
1529 (r = sshpkt_get_end(ssh)) != 0) in client_request_forwarded_streamlocal()
1534 c = channel_connect_by_listen_path(ssh, listen_path, in client_request_forwarded_streamlocal()
1541 client_request_x11(struct ssh *ssh, const char *request_type, int rchan) in client_request_x11() argument
1559 if ((r = sshpkt_get_cstring(ssh, &originator, NULL)) != 0 || in client_request_x11()
1560 (r = sshpkt_get_u32(ssh, &originator_port)) != 0 || in client_request_x11()
1561 (r = sshpkt_get_end(ssh)) != 0) in client_request_x11()
1568 sock = x11_connect_display(ssh); in client_request_x11()
1571 c = channel_new(ssh, "x11", in client_request_x11()
1579 client_request_agent(struct ssh *ssh, const char *request_type, int rchan) in client_request_agent() argument
1600 c = channel_new(ssh, "authentication agent connection", in client_request_agent()
1609 client_request_tun_fwd(struct ssh *ssh, int tun_mode, in client_request_tun_fwd() argument
1628 c = channel_new(ssh, "tun", SSH_CHANNEL_OPENING, fd, fd, -1, in client_request_tun_fwd()
1634 channel_register_filter(ssh, c->self, sys_tun_infilter, in client_request_tun_fwd()
1639 channel_register_open_confirm(ssh, c->self, cb, cbctx); in client_request_tun_fwd()
1641 if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_OPEN)) != 0 || in client_request_tun_fwd()
1642 (r = sshpkt_put_cstring(ssh, "[email protected]")) != 0 || in client_request_tun_fwd()
1643 (r = sshpkt_put_u32(ssh, c->self)) != 0 || in client_request_tun_fwd()
1644 (r = sshpkt_put_u32(ssh, c->local_window_max)) != 0 || in client_request_tun_fwd()
1645 (r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0 || in client_request_tun_fwd()
1646 (r = sshpkt_put_u32(ssh, tun_mode)) != 0 || in client_request_tun_fwd()
1647 (r = sshpkt_put_u32(ssh, remote_tun)) != 0 || in client_request_tun_fwd()
1648 (r = sshpkt_send(ssh)) != 0) in client_request_tun_fwd()
1649 sshpkt_fatal(ssh, r, "%s: send reply", __func__); in client_request_tun_fwd()
1656 client_input_channel_open(int type, u_int32_t seq, struct ssh *ssh) in client_input_channel_open() argument
1665 if ((r = sshpkt_get_cstring(ssh, &ctype, &len)) != 0 || in client_input_channel_open()
1666 (r = sshpkt_get_u32(ssh, &rchan)) != 0 || in client_input_channel_open()
1667 (r = sshpkt_get_u32(ssh, &rwindow)) != 0 || in client_input_channel_open()
1668 (r = sshpkt_get_u32(ssh, &rmaxpack)) != 0) in client_input_channel_open()
1675 c = client_request_forwarded_tcpip(ssh, ctype, rchan, rwindow, in client_input_channel_open()
1678 c = client_request_forwarded_streamlocal(ssh, ctype, rchan); in client_input_channel_open()
1680 c = client_request_x11(ssh, ctype, rchan); in client_input_channel_open()
1682 c = client_request_agent(ssh, ctype, rchan); in client_input_channel_open()
1693 if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION)) != 0 || in client_input_channel_open()
1694 (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || in client_input_channel_open()
1695 (r = sshpkt_put_u32(ssh, c->self)) != 0 || in client_input_channel_open()
1696 (r = sshpkt_put_u32(ssh, c->local_window)) != 0 || in client_input_channel_open()
1697 (r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0 || in client_input_channel_open()
1698 (r = sshpkt_send(ssh)) != 0) in client_input_channel_open()
1699 sshpkt_fatal(ssh, r, "%s: send reply", __func__); in client_input_channel_open()
1703 if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_OPEN_FAILURE)) != 0 || in client_input_channel_open()
1704 (r = sshpkt_put_u32(ssh, rchan)) != 0 || in client_input_channel_open()
1705 (r = sshpkt_put_u32(ssh, SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED)) != 0 || in client_input_channel_open()
1706 (r = sshpkt_put_cstring(ssh, "open failed")) != 0 || in client_input_channel_open()
1707 (r = sshpkt_put_cstring(ssh, "")) != 0 || in client_input_channel_open()
1708 (r = sshpkt_send(ssh)) != 0) in client_input_channel_open()
1709 sshpkt_fatal(ssh, r, "%s: send failure", __func__); in client_input_channel_open()
1718 client_input_channel_req(int type, u_int32_t seq, struct ssh *ssh) in client_input_channel_req() argument
1726 if ((r = sshpkt_get_u32(ssh, &id)) != 0) in client_input_channel_req()
1729 c = channel_lookup(ssh, id); in client_input_channel_req()
1730 if (channel_proxy_upstream(c, type, seq, ssh)) in client_input_channel_req()
1732 if ((r = sshpkt_get_cstring(ssh, &rtype, NULL)) != 0 || in client_input_channel_req()
1733 (r = sshpkt_get_u8(ssh, &reply)) != 0) in client_input_channel_req()
1743 if ((r = sshpkt_get_end(ssh)) != 0) in client_input_channel_req()
1745 chan_rcvd_eow(ssh, c); in client_input_channel_req()
1747 if ((r = sshpkt_get_u32(ssh, &exitval)) != 0) in client_input_channel_req()
1750 mux_exit_message(ssh, c, exitval); in client_input_channel_req()
1761 if ((r = sshpkt_get_end(ssh)) != 0) in client_input_channel_req()
1767 if ((r = sshpkt_start(ssh, success ? in client_input_channel_req()
1769 (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || in client_input_channel_req()
1770 (r = sshpkt_send(ssh)) != 0) in client_input_channel_req()
1771 sshpkt_fatal(ssh, r, "%s: send failure", __func__); in client_input_channel_req()
2095 client_global_hostkeys_private_confirm(struct ssh *ssh, int type, in client_global_hostkeys_private_confirm() argument
2114 sshkey_type_from_name(ssh->kex->hostkey_alg)); in client_global_hostkeys_private_confirm()
2131 ssh->kex->session_id)) != 0 || in client_global_hostkeys_private_confirm()
2135 if ((r = sshpkt_get_string_direct(ssh, &sig, &siglen)) != 0) { in client_global_hostkeys_private_confirm()
2147 use_kexsigtype ? ssh->kex->hostkey_alg : "default"); in client_global_hostkeys_private_confirm()
2150 use_kexsigtype ? ssh->kex->hostkey_alg : NULL, 0, in client_global_hostkeys_private_confirm()
2163 if ((r = sshpkt_get_end(ssh)) != 0) { in client_global_hostkeys_private_confirm()
2199 client_input_hostkeys(struct ssh *ssh) in client_input_hostkeys() argument
2221 while (ssh_packet_remaining(ssh) > 0) { in client_input_hostkeys()
2224 if ((r = sshpkt_get_string_direct(ssh, &blob, &len)) != 0) { in client_input_hostkeys()
2367 if ((r = sshpkt_start(ssh, SSH2_MSG_GLOBAL_REQUEST)) != 0 || in client_input_hostkeys()
2368 (r = sshpkt_put_cstring(ssh, in client_input_hostkeys()
2370 (r = sshpkt_put_u8(ssh, 1)) != 0) /* bool: want reply */ in client_input_hostkeys()
2379 (r = sshpkt_put_stringb(ssh, buf)) != 0) in client_input_hostkeys()
2382 if ((r = sshpkt_send(ssh)) != 0) in client_input_hostkeys()
2401 client_input_global_request(int type, u_int32_t seq, struct ssh *ssh) in client_input_global_request() argument
2407 if ((r = sshpkt_get_cstring(ssh, &rtype, NULL)) != 0 || in client_input_global_request()
2408 (r = sshpkt_get_u8(ssh, &want_reply)) != 0) in client_input_global_request()
2413 success = client_input_hostkeys(ssh); in client_input_global_request()
2415 if ((r = sshpkt_start(ssh, success ? SSH2_MSG_REQUEST_SUCCESS : in client_input_global_request()
2417 (r = sshpkt_send(ssh)) != 0 || in client_input_global_request()
2418 (r = ssh_packet_write_wait(ssh)) != 0) in client_input_global_request()
2428 client_send_env(struct ssh *ssh, int id, const char *name, const char *val) in client_send_env() argument
2433 channel_request_start(ssh, id, "env", 0); in client_send_env()
2434 if ((r = sshpkt_put_cstring(ssh, name)) != 0 || in client_send_env()
2435 (r = sshpkt_put_cstring(ssh, val)) != 0 || in client_send_env()
2436 (r = sshpkt_send(ssh)) != 0) in client_send_env()
2441 client_session2_setup(struct ssh *ssh, int id, int want_tty, int want_subsystem, in client_session2_setup() argument
2451 if ((c = channel_lookup(ssh, id)) == NULL) in client_session2_setup()
2454 ssh_packet_set_interactive(ssh, want_tty, in client_session2_setup()
2464 channel_request_start(ssh, id, "pty-req", 1); in client_session2_setup()
2465 client_expect_confirm(ssh, id, "PTY allocation", CONFIRM_TTY); in client_session2_setup()
2466 if ((r = sshpkt_put_cstring(ssh, term != NULL ? term : "")) in client_session2_setup()
2468 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_col)) != 0 || in client_session2_setup()
2469 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_row)) != 0 || in client_session2_setup()
2470 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_xpixel)) != 0 || in client_session2_setup()
2471 (r = sshpkt_put_u32(ssh, (u_int)ws.ws_ypixel)) != 0) in client_session2_setup()
2475 ssh_tty_make_modes(ssh, -1, tiop); in client_session2_setup()
2476 if ((r = sshpkt_send(ssh)) != 0) in client_session2_setup()
2506 client_send_env(ssh, id, name, val); in client_session2_setup()
2518 client_send_env(ssh, id, name, val); in client_session2_setup()
2529 channel_request_start(ssh, id, "subsystem", 1); in client_session2_setup()
2530 client_expect_confirm(ssh, id, "subsystem", in client_session2_setup()
2535 channel_request_start(ssh, id, "exec", 1); in client_session2_setup()
2536 client_expect_confirm(ssh, id, "exec", CONFIRM_CLOSE); in client_session2_setup()
2538 if ((r = sshpkt_put_stringb(ssh, cmd)) != 0 || in client_session2_setup()
2539 (r = sshpkt_send(ssh)) != 0) in client_session2_setup()
2542 channel_request_start(ssh, id, "shell", 1); in client_session2_setup()
2543 client_expect_confirm(ssh, id, "shell", CONFIRM_CLOSE); in client_session2_setup()
2544 if ((r = sshpkt_send(ssh)) != 0) in client_session2_setup()
2550 client_init_dispatch(struct ssh *ssh) in client_init_dispatch() argument
2552 ssh_dispatch_init(ssh, &dispatch_protocol_error); in client_init_dispatch()
2554 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_CLOSE, &channel_input_oclose); in client_init_dispatch()
2555 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_DATA, &channel_input_data); in client_init_dispatch()
2556 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_EOF, &channel_input_ieof); in client_init_dispatch()
2557 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_EXTENDED_DATA, &channel_input_extended_data); in client_init_dispatch()
2558 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_OPEN, &client_input_channel_open); in client_init_dispatch()
2559 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation); in client_init_dispatch()
2560 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); in client_init_dispatch()
2561 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_REQUEST, &client_input_channel_req); in client_init_dispatch()
2562 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust); in client_init_dispatch()
2563 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_SUCCESS, &channel_input_status_confirm); in client_init_dispatch()
2564 ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_FAILURE, &channel_input_status_confirm); in client_init_dispatch()
2565 ssh_dispatch_set(ssh, SSH2_MSG_GLOBAL_REQUEST, &client_input_global_request); in client_init_dispatch()
2568 ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit); in client_init_dispatch()
2571 ssh_dispatch_set(ssh, SSH2_MSG_REQUEST_FAILURE, &client_global_request_reply); in client_init_dispatch()
2572 ssh_dispatch_set(ssh, SSH2_MSG_REQUEST_SUCCESS, &client_global_request_reply); in client_init_dispatch()