diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -11,7 +11,7 @@ */ #include "includes.h" -RCSID("$Id: sshd.c,v 1.34 1999/12/07 03:56:27 damien Exp $"); +RCSID("$Id: sshd.c,v 1.35 1999/12/07 04:38:32 damien Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -812,7 +812,7 @@ 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 (write(sock_out, buf, strlen(buf)) != strlen(buf)) + if (atomicio(write, sock_out, buf, strlen(buf)) != strlen(buf)) fatal("Could not write ident string to %s.", get_remote_ipaddr()); /* Read other side\'s version identification. */ @@ -838,9 +838,10 @@ main(int ac, char **av) * several versions and set appropriate flags to handle them. */ if (sscanf(buf, "SSH-%d.%d-%[^\n]\n", &remote_major, &remote_minor, - remote_version) != 3) { - const char *s = "Protocol mismatch.\n"; - (void) write(sock_out, s, strlen(s)); + remote_version) != 3) { + char *s = "Protocol mismatch.\n"; + + (void) atomicio(write, sock_out, s, strlen(s)); close(sock_in); close(sock_out); fatal("Bad protocol version identification '%.100s' from %s", @@ -849,8 +850,9 @@ main(int ac, char **av) debug("Client protocol version %d.%d; client software version %.100s", remote_major, remote_minor, remote_version); if (remote_major != PROTOCOL_MAJOR) { - const char *s = "Protocol major versions differ.\n"; - (void) write(sock_out, s, strlen(s)); + char *s = "Protocol major versions differ.\n"; + + (void) atomicio(write, sock_out, s, strlen(s)); close(sock_in); close(sock_out); fatal("Protocol major versions differ for %s: %d vs. %d", @@ -1737,7 +1739,8 @@ do_authenticated(struct passwd * pw) debug("Allocating pty."); /* Allocate a pty and open it. */ - if (!pty_allocate(&ptyfd, &ttyfd, ttyname)) { + if (!pty_allocate(&ptyfd, &ttyfd, ttyname, + sizeof(ttyname))) { error("Failed to allocate pty."); goto fail; } |