summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2000-01-20 15:19:22 +0000
committermarkus <markus@openbsd.org>2000-01-20 15:19:22 +0000
commit9490206958e581c66ee25bcb0c151e52a7c2bc44 (patch)
tree31389cf7d0e7d1b66413d22a3e18dbf9779985de
parentuse getpeername() in packet_connection_is_on_socket(), fixes sshd -i; (diff)
downloadwireguard-openbsd-9490206958e581c66ee25bcb0c151e52a7c2bc44.tar.xz
wireguard-openbsd-9490206958e581c66ee25bcb0c151e52a7c2bc44.zip
log with level log() not fatal() if peer behaves badly.
-rw-r--r--usr.bin/ssh/sshd.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 621e6fabf57..0f270b4e598 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -11,7 +11,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.79 2000/01/18 13:45:05 markus Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.80 2000/01/20 15:19:22 markus Exp $");
#include "xmalloc.h"
#include "rsa.h"
@@ -777,13 +777,17 @@ main(int ac, char **av)
/* Send our protocol version identification. */
snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n",
PROTOCOL_MAJOR, PROTOCOL_MINOR, SSH_VERSION);
- if (atomicio(write, sock_out, buf, strlen(buf)) != strlen(buf))
- fatal("Could not write ident string to %s.", remote_ip);
+ if (atomicio(write, sock_out, buf, strlen(buf)) != strlen(buf)) {
+ log("Could not write ident string to %s.", remote_ip);
+ fatal_cleanup();
+ }
/* Read other side\'s version identification. */
for (i = 0; i < sizeof(buf) - 1; i++) {
- if (read(sock_in, &buf[i], 1) != 1)
- fatal("Did not receive ident string from %s.", remote_ip);
+ if (read(sock_in, &buf[i], 1) != 1) {
+ log("Did not receive ident string from %s.", remote_ip);
+ fatal_cleanup();
+ }
if (buf[i] == '\r') {
buf[i] = '\n';
buf[i + 1] = 0;
@@ -809,8 +813,9 @@ main(int ac, char **av)
(void) atomicio(write, sock_out, s, strlen(s));
close(sock_in);
close(sock_out);
- fatal("Bad protocol version identification '%.100s' from %s",
- buf, remote_ip);
+ log("Bad protocol version identification '%.100s' from %s",
+ buf, remote_ip);
+ fatal_cleanup();
}
debug("Client protocol version %d.%d; client software version %.100s",
remote_major, remote_minor, remote_version);
@@ -820,8 +825,9 @@ main(int ac, char **av)
(void) atomicio(write, sock_out, s, strlen(s));
close(sock_in);
close(sock_out);
- fatal("Protocol major versions differ for %s: %d vs. %d",
- remote_ip, PROTOCOL_MAJOR, remote_major);
+ log("Protocol major versions differ for %s: %d vs. %d",
+ remote_ip, PROTOCOL_MAJOR, remote_major);
+ fatal_cleanup();
}
/* Check that the client has sufficiently high software version. */
if (remote_major == 1 && remote_minor < 3)