=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/packet.c,v retrieving revision 1.102.2.1 retrieving revision 1.102.2.2 diff -u -r1.102.2.1 -r1.102.2.2 --- src/usr.bin/ssh/packet.c 2003/09/16 20:50:43 1.102.2.1 +++ src/usr.bin/ssh/packet.c 2004/03/04 18:18:16 1.102.2.2 @@ -37,7 +37,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: packet.c,v 1.102.2.1 2003/09/16 20:50:43 brad Exp $"); +RCSID("$OpenBSD: packet.c,v 1.102.2.2 2004/03/04 18:18:16 brad Exp $"); #include @@ -165,8 +165,6 @@ buffer_init(&incoming_packet); TAILQ_INIT(&outgoing); } - /* Kludge: arrange the close function to be called from fatal(). */ - fatal_add_cleanup((void (*) (void *)) packet_close, NULL); } /* Returns 1 if remote host is connected via socket, 0 if not. */ @@ -865,7 +863,7 @@ len = read(connection_in, buf, sizeof(buf)); if (len == 0) { logit("Connection closed by %.200s", get_remote_ipaddr()); - fatal_cleanup(); + cleanup_exit(255); } if (len < 0) fatal("Read from socket failed: %.100s", strerror(errno)); @@ -1015,7 +1013,9 @@ cp = buffer_ptr(&incoming_packet); packet_length = GET_32BIT(cp); if (packet_length < 1 + 4 || packet_length > 256 * 1024) { +#ifdef PACKET_DEBUG buffer_dump(&incoming_packet); +#endif packet_disconnect("Bad packet length %u.", packet_length); } DBG(debug("input: packet len %u", packet_length+4)); @@ -1129,7 +1129,7 @@ logit("Received disconnect from %s: %u: %.400s", get_remote_ipaddr(), reason, msg); xfree(msg); - fatal_cleanup(); + cleanup_exit(255); break; case SSH2_MSG_UNIMPLEMENTED: seqnr = packet_get_int(); @@ -1154,7 +1154,7 @@ msg = packet_get_string(NULL); logit("Received disconnect from %s: %.400s", get_remote_ipaddr(), msg); - fatal_cleanup(); + cleanup_exit(255); xfree(msg); break; default: @@ -1331,8 +1331,7 @@ /* Close the connection. */ packet_close(); - - fatal_cleanup(); + cleanup_exit(255); } /* Checks if there is any buffered output, and tries to write some of the output. */