diff options
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index 3a0eb761a..6950c5ee6 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: sshconnect2.c,v 1.102 2002/05/25 08:50:39 markus Exp $"); | 26 | RCSID("$OpenBSD: sshconnect2.c,v 1.103 2002/05/31 10:30:33 markus Exp $"); |
27 | 27 | ||
28 | #include "ssh.h" | 28 | #include "ssh.h" |
29 | #include "ssh2.h" | 29 | #include "ssh2.h" |
@@ -902,7 +902,7 @@ ssh_keysign( | |||
902 | Buffer b; | 902 | Buffer b; |
903 | struct stat st; | 903 | struct stat st; |
904 | pid_t pid; | 904 | pid_t pid; |
905 | int to[2], from[2], status, version = 1; | 905 | int to[2], from[2], status, version = 2; |
906 | 906 | ||
907 | debug("ssh_keysign called"); | 907 | debug("ssh_keysign called"); |
908 | 908 | ||
@@ -933,6 +933,8 @@ ssh_keysign( | |||
933 | close(to[1]); | 933 | close(to[1]); |
934 | if (dup2(to[0], STDIN_FILENO) < 0) | 934 | if (dup2(to[0], STDIN_FILENO) < 0) |
935 | fatal("ssh_keysign: dup2: %s", strerror(errno)); | 935 | fatal("ssh_keysign: dup2: %s", strerror(errno)); |
936 | close(from[1]); | ||
937 | close(to[0]); | ||
936 | execl(_PATH_SSH_KEY_SIGN, _PATH_SSH_KEY_SIGN, (char *) 0); | 938 | execl(_PATH_SSH_KEY_SIGN, _PATH_SSH_KEY_SIGN, (char *) 0); |
937 | fatal("ssh_keysign: exec(%s): %s", _PATH_SSH_KEY_SIGN, | 939 | fatal("ssh_keysign: exec(%s): %s", _PATH_SSH_KEY_SIGN, |
938 | strerror(errno)); | 940 | strerror(errno)); |
@@ -941,6 +943,7 @@ ssh_keysign( | |||
941 | close(to[0]); | 943 | close(to[0]); |
942 | 944 | ||
943 | buffer_init(&b); | 945 | buffer_init(&b); |
946 | buffer_put_int(&b, packet_get_connection_in()); /* send # of socket */ | ||
944 | buffer_put_string(&b, data, datalen); | 947 | buffer_put_string(&b, data, datalen); |
945 | msg_send(to[1], version, &b); | 948 | msg_send(to[1], version, &b); |
946 | 949 | ||
@@ -952,9 +955,9 @@ ssh_keysign( | |||
952 | close(from[0]); | 955 | close(from[0]); |
953 | close(to[1]); | 956 | close(to[1]); |
954 | 957 | ||
955 | while (waitpid(pid, &status, 0) < 0) | 958 | while (waitpid(pid, &status, 0) < 0) |
956 | if (errno != EINTR) | 959 | if (errno != EINTR) |
957 | break; | 960 | break; |
958 | 961 | ||
959 | if (buffer_get_char(&b) != version) { | 962 | if (buffer_get_char(&b) != version) { |
960 | error("ssh_keysign: bad version"); | 963 | error("ssh_keysign: bad version"); |