summaryrefslogtreecommitdiff
path: root/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>1999-12-07 15:38:31 +1100
committerDamien Miller <djm@mindrot.org>1999-12-07 15:38:31 +1100
commit037a0dc0835bb5a442bdcbeecdd5baed723f0b45 (patch)
treed02954d57ac437fd036e3e9544f24559ca8f0f0f /sshd.c
parenteabf3417bc73ca9546a3ed489cd809ffdf303853 (diff)
- Merged more OpenBSD changes:
- [atomicio.c authfd.c scp.c serverloop.c ssh.h sshconnect.c sshd.c] move atomicio into it's own file. wrap all socket write()s which were doing write(sock, buf, len) != len, with atomicio() calls. - [auth-skey.c] fd leak - [authfile.c] properly name fd variable - [channels.c] display great hatred towards strcpy - [pty.c pty.h sshd.c] use openpty() if it exists (it does on BSD4_4) - [tildexpand.c] check for ~ expansion past MAXPATHLEN - Modified helper.c to use new atomicio function. - Reformat Makefile a little - Moved RC4 routines from rc4.[ch] into helper.c - Added autoconf code to detect /dev/ptmx (Solaris) and /dev/ptc (AIX)
Diffstat (limited to 'sshd.c')
-rw-r--r--sshd.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sshd.c b/sshd.c
index 60d34d8b6..0c15e2837 100644
--- a/sshd.c
+++ b/sshd.c
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13#include "includes.h" 13#include "includes.h"
14RCSID("$Id: sshd.c,v 1.34 1999/12/07 03:56:27 damien Exp $"); 14RCSID("$Id: sshd.c,v 1.35 1999/12/07 04:38:32 damien Exp $");
15 15
16#include "xmalloc.h" 16#include "xmalloc.h"
17#include "rsa.h" 17#include "rsa.h"
@@ -812,7 +812,7 @@ main(int ac, char **av)
812 /* Send our protocol version identification. */ 812 /* Send our protocol version identification. */
813 snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n", 813 snprintf(buf, sizeof buf, "SSH-%d.%d-%.100s\n",
814 PROTOCOL_MAJOR, PROTOCOL_MINOR, SSH_VERSION); 814 PROTOCOL_MAJOR, PROTOCOL_MINOR, SSH_VERSION);
815 if (write(sock_out, buf, strlen(buf)) != strlen(buf)) 815 if (atomicio(write, sock_out, buf, strlen(buf)) != strlen(buf))
816 fatal("Could not write ident string to %s.", get_remote_ipaddr()); 816 fatal("Could not write ident string to %s.", get_remote_ipaddr());
817 817
818 /* Read other side\'s version identification. */ 818 /* Read other side\'s version identification. */
@@ -838,9 +838,10 @@ main(int ac, char **av)
838 * several versions and set appropriate flags to handle them. 838 * several versions and set appropriate flags to handle them.
839 */ 839 */
840 if (sscanf(buf, "SSH-%d.%d-%[^\n]\n", &remote_major, &remote_minor, 840 if (sscanf(buf, "SSH-%d.%d-%[^\n]\n", &remote_major, &remote_minor,
841 remote_version) != 3) { 841 remote_version) != 3) {
842 const char *s = "Protocol mismatch.\n"; 842 char *s = "Protocol mismatch.\n";
843 (void) write(sock_out, s, strlen(s)); 843
844 (void) atomicio(write, sock_out, s, strlen(s));
844 close(sock_in); 845 close(sock_in);
845 close(sock_out); 846 close(sock_out);
846 fatal("Bad protocol version identification '%.100s' from %s", 847 fatal("Bad protocol version identification '%.100s' from %s",
@@ -849,8 +850,9 @@ main(int ac, char **av)
849 debug("Client protocol version %d.%d; client software version %.100s", 850 debug("Client protocol version %d.%d; client software version %.100s",
850 remote_major, remote_minor, remote_version); 851 remote_major, remote_minor, remote_version);
851 if (remote_major != PROTOCOL_MAJOR) { 852 if (remote_major != PROTOCOL_MAJOR) {
852 const char *s = "Protocol major versions differ.\n"; 853 char *s = "Protocol major versions differ.\n";
853 (void) write(sock_out, s, strlen(s)); 854
855 (void) atomicio(write, sock_out, s, strlen(s));
854 close(sock_in); 856 close(sock_in);
855 close(sock_out); 857 close(sock_out);
856 fatal("Protocol major versions differ for %s: %d vs. %d", 858 fatal("Protocol major versions differ for %s: %d vs. %d",
@@ -1737,7 +1739,8 @@ do_authenticated(struct passwd * pw)
1737 debug("Allocating pty."); 1739 debug("Allocating pty.");
1738 1740
1739 /* Allocate a pty and open it. */ 1741 /* Allocate a pty and open it. */
1740 if (!pty_allocate(&ptyfd, &ttyfd, ttyname)) { 1742 if (!pty_allocate(&ptyfd, &ttyfd, ttyname,
1743 sizeof(ttyname))) {
1741 error("Failed to allocate pty."); 1744 error("Failed to allocate pty.");
1742 goto fail; 1745 goto fail;
1743 } 1746 }