summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-01-22 19:47:21 +1100
committerDamien Miller <djm@mindrot.org>2000-01-22 19:47:21 +1100
commitf052aaf9f6ed50de9c91d3fbda72be77a9770624 (patch)
treeb9e219b31e4a6ad52d5182c15af3dd02d61cc081 /sshd.c
parent8dbbe6e546020e880cc01b5c6eb68484df766369 (diff)
- OpenBSD CVS updates:
- [packet.c] use getpeername() in packet_connection_is_on_socket(), fixes sshd -i; from Holger.Trapp@Informatik.TU-Chemnitz.DE - [sshd.c] log with level log() not fatal() if peer behaves badly. - [readpass.c] instead of blocking SIGINT, catch it ourselves, so that we can clean the tty modes up and kill ourselves -- instead of our process group leader (scp, cvs, ...) going away and leaving us in noecho mode. people with cbreak shells never even noticed..
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sshd.c b/sshd.c
index 03a9ce120..7f761bb14 100644
--- a/sshd.c
+++ b/sshd.c
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13#include "includes.h" 13#include "includes.h"
14RCSID("$OpenBSD: sshd.c,v 1.79 2000/01/18 13:45:05 markus Exp $"); 14RCSID("$OpenBSD: sshd.c,v 1.80 2000/01/20 15:19:22 markus Exp $");
15 15
16#include "xmalloc.h" 16#include "xmalloc.h"
17#include "rsa.h" 17#include "rsa.h"
@@ -784,13 +784,17 @@ main(int ac, char **av)
784 /* Send our protocol version identification. */ 784 /* Send our protocol version identification. */
785 snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", 785 snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n",
786 PROTOCOL_MAJOR, PROTOCOL_MINOR, SSH_VERSION); 786 PROTOCOL_MAJOR, PROTOCOL_MINOR, SSH_VERSION);
787 if (atomicio(write, sock_out, buf, strlen(buf)) != strlen(buf)) 787 if (atomicio(write, sock_out, buf, strlen(buf)) != strlen(buf)) {
788 fatal("Could not write ident string to %s.", remote_ip); 788 log("Could not write ident string to %s.", remote_ip);
789 fatal_cleanup();
790 }
789 791
790 /* Read other side\'s version identification. */ 792 /* Read other side\'s version identification. */
791 for (i = 0; i < sizeof(buf) - 1; i++) { 793 for (i = 0; i < sizeof(buf) - 1; i++) {
792 if (read(sock_in, &buf[i], 1) != 1) 794 if (read(sock_in, &buf[i], 1) != 1) {
793 fatal("Did not receive ident string from %s.", remote_ip); 795 log("Did not receive ident string from %s.", remote_ip);
796 fatal_cleanup();
797 }
794 if (buf[i] == '\r') { 798 if (buf[i] == '\r') {
795 buf[i] = '\n'; 799 buf[i] = '\n';
796 buf[i + 1] = 0; 800 buf[i + 1] = 0;
@@ -816,8 +820,9 @@ main(int ac, char **av)
816 (void) atomicio(write, sock_out, s, strlen(s)); 820 (void) atomicio(write, sock_out, s, strlen(s));
817 close(sock_in); 821 close(sock_in);
818 close(sock_out); 822 close(sock_out);
819 fatal("Bad protocol version identification '%.100s' from %s", 823 log("Bad protocol version identification '%.100s' from %s",
820 buf, remote_ip); 824 buf, remote_ip);
825 fatal_cleanup();
821 } 826 }
822 debug("Client protocol version %d.%d; client software version %.100s", 827 debug("Client protocol version %d.%d; client software version %.100s",
823 remote_major, remote_minor, remote_version); 828 remote_major, remote_minor, remote_version);
@@ -827,8 +832,9 @@ main(int ac, char **av)
827 (void) atomicio(write, sock_out, s, strlen(s)); 832 (void) atomicio(write, sock_out, s, strlen(s));
828 close(sock_in); 833 close(sock_in);
829 close(sock_out); 834 close(sock_out);
830 fatal("Protocol major versions differ for %s: %d vs. %d", 835 log("Protocol major versions differ for %s: %d vs. %d",
831 remote_ip, PROTOCOL_MAJOR, remote_major); 836 remote_ip, PROTOCOL_MAJOR, remote_major);
837 fatal_cleanup();
832 } 838 }
833 /* Check that the client has sufficiently high software version. */ 839 /* Check that the client has sufficiently high software version. */
834 if (remote_major == 1 && remote_minor < 3) 840 if (remote_major == 1 && remote_minor < 3)