=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/Attic/opacket.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- src/usr.bin/ssh/Attic/opacket.c 2015/01/28 21:15:47 1.2 +++ src/usr.bin/ssh/Attic/opacket.c 2015/01/30 01:13:33 1.3 @@ -221,6 +221,8 @@ packet_set_connection(int fd_in, int fd_out) { active_state = ssh_packet_set_connection(active_state, fd_in, fd_out); + if (active_state == NULL) + fatal("%s: ssh_packet_set_connection failed", __func__); } void @@ -253,20 +255,8 @@ u_char type; int r; - if ((r = ssh_packet_read_seqnr(active_state, &type, seqnr)) != 0) { - switch (r) { - case SSH_ERR_CONN_CLOSED: - logit("Connection closed by %.200s", - ssh_remote_ipaddr(active_state)); - cleanup_exit(255); - case SSH_ERR_CONN_TIMEOUT: - logit("Connection to %.200s timed out while " - "waiting to read", ssh_remote_ipaddr(active_state)); - cleanup_exit(255); - default: - fatal("%s: %s", __func__, ssh_err(r)); - } - } + if ((r = ssh_packet_read_seqnr(active_state, &type, seqnr)) != 0) + sshpkt_fatal(active_state, __func__, r); return type; } @@ -277,7 +267,7 @@ int r; if ((r = ssh_packet_read_poll_seqnr(active_state, &type, seqnr))) - fatal("%s: %s", __func__, ssh_err(r)); + sshpkt_fatal(active_state, __func__, r); return type; } @@ -294,5 +284,32 @@ int r; if ((r = ssh_packet_process_incoming(active_state, buf, len)) != 0) - fatal("%s: %s", __func__, ssh_err(r)); + sshpkt_fatal(active_state, __func__, r); +} + +void +packet_write_wait(void) +{ + int r; + + if ((r = ssh_packet_write_wait(active_state)) != 0) + sshpkt_fatal(active_state, __func__, r); +} + +void +packet_write_poll(void) +{ + int r; + + if ((r = ssh_packet_write_poll(active_state)) != 0) + sshpkt_fatal(active_state, __func__, r); +} + +void +packet_read_expect(int expected_type) +{ + int r; + + if ((r = ssh_packet_read_expect(active_state, expected_type)) != 0) + sshpkt_fatal(active_state, __func__, r); }