diff options
author | Colin Watson <cjwatson@debian.org> | 2004-03-01 02:25:32 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2004-03-01 02:25:32 +0000 |
commit | ea8116a11e3de70036dbc665ccb0d486cf89cac9 (patch) | |
tree | d73ccdff78d8608e156465af42e6a1b3527fb2d6 /ssh-agent.c | |
parent | e39b311381a5609cc05acf298c42fba196dc524b (diff) | |
parent | f5bda272678ec6dccaa5f29379cf60cb855018e8 (diff) |
Merge 3.8p1 to the trunk. This builds and runs, but I haven't tested it
extensively yet.
ProtocolKeepAlives is now just a compatibility alias for
ServerAliveInterval.
Diffstat (limited to 'ssh-agent.c')
-rw-r--r-- | ssh-agent.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/ssh-agent.c b/ssh-agent.c index c05c61468..e5232fc9b 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | #include "openbsd-compat/sys-queue.h" | 37 | #include "openbsd-compat/sys-queue.h" |
38 | RCSID("$OpenBSD: ssh-agent.c,v 1.111 2003/06/12 19:12:03 markus Exp $"); | 38 | RCSID("$OpenBSD: ssh-agent.c,v 1.117 2003/12/02 17:01:15 markus Exp $"); |
39 | 39 | ||
40 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
41 | #include <openssl/md5.h> | 41 | #include <openssl/md5.h> |
@@ -179,7 +179,7 @@ confirm_key(Identity *id) | |||
179 | p = read_passphrase(prompt, RP_ALLOW_EOF); | 179 | p = read_passphrase(prompt, RP_ALLOW_EOF); |
180 | if (p != NULL) { | 180 | if (p != NULL) { |
181 | /* | 181 | /* |
182 | * Accept empty responses and responses consisting | 182 | * Accept empty responses and responses consisting |
183 | * of the word "yes" as affirmative. | 183 | * of the word "yes" as affirmative. |
184 | */ | 184 | */ |
185 | if (*p == '\0' || *p == '\n' || strcasecmp(p, "yes") == 0) | 185 | if (*p == '\0' || *p == '\n' || strcasecmp(p, "yes") == 0) |
@@ -784,7 +784,7 @@ process_message(SocketEntry *e) | |||
784 | static void | 784 | static void |
785 | new_socket(sock_type type, int fd) | 785 | new_socket(sock_type type, int fd) |
786 | { | 786 | { |
787 | u_int i, old_alloc; | 787 | u_int i, old_alloc, new_alloc; |
788 | 788 | ||
789 | if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) | 789 | if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) |
790 | error("fcntl O_NONBLOCK: %s", strerror(errno)); | 790 | error("fcntl O_NONBLOCK: %s", strerror(errno)); |
@@ -795,25 +795,26 @@ new_socket(sock_type type, int fd) | |||
795 | for (i = 0; i < sockets_alloc; i++) | 795 | for (i = 0; i < sockets_alloc; i++) |
796 | if (sockets[i].type == AUTH_UNUSED) { | 796 | if (sockets[i].type == AUTH_UNUSED) { |
797 | sockets[i].fd = fd; | 797 | sockets[i].fd = fd; |
798 | sockets[i].type = type; | ||
799 | buffer_init(&sockets[i].input); | 798 | buffer_init(&sockets[i].input); |
800 | buffer_init(&sockets[i].output); | 799 | buffer_init(&sockets[i].output); |
801 | buffer_init(&sockets[i].request); | 800 | buffer_init(&sockets[i].request); |
801 | sockets[i].type = type; | ||
802 | return; | 802 | return; |
803 | } | 803 | } |
804 | old_alloc = sockets_alloc; | 804 | old_alloc = sockets_alloc; |
805 | sockets_alloc += 10; | 805 | new_alloc = sockets_alloc + 10; |
806 | if (sockets) | 806 | if (sockets) |
807 | sockets = xrealloc(sockets, sockets_alloc * sizeof(sockets[0])); | 807 | sockets = xrealloc(sockets, new_alloc * sizeof(sockets[0])); |
808 | else | 808 | else |
809 | sockets = xmalloc(sockets_alloc * sizeof(sockets[0])); | 809 | sockets = xmalloc(new_alloc * sizeof(sockets[0])); |
810 | for (i = old_alloc; i < sockets_alloc; i++) | 810 | for (i = old_alloc; i < new_alloc; i++) |
811 | sockets[i].type = AUTH_UNUSED; | 811 | sockets[i].type = AUTH_UNUSED; |
812 | sockets[old_alloc].type = type; | 812 | sockets_alloc = new_alloc; |
813 | sockets[old_alloc].fd = fd; | 813 | sockets[old_alloc].fd = fd; |
814 | buffer_init(&sockets[old_alloc].input); | 814 | buffer_init(&sockets[old_alloc].input); |
815 | buffer_init(&sockets[old_alloc].output); | 815 | buffer_init(&sockets[old_alloc].output); |
816 | buffer_init(&sockets[old_alloc].request); | 816 | buffer_init(&sockets[old_alloc].request); |
817 | sockets[old_alloc].type = type; | ||
817 | } | 818 | } |
818 | 819 | ||
819 | static int | 820 | static int |
@@ -948,7 +949,7 @@ after_select(fd_set *readset, fd_set *writeset) | |||
948 | } | 949 | } |
949 | 950 | ||
950 | static void | 951 | static void |
951 | cleanup_socket(void *p) | 952 | cleanup_socket(void) |
952 | { | 953 | { |
953 | if (socket_name[0]) | 954 | if (socket_name[0]) |
954 | unlink(socket_name); | 955 | unlink(socket_name); |
@@ -956,17 +957,17 @@ cleanup_socket(void *p) | |||
956 | rmdir(socket_dir); | 957 | rmdir(socket_dir); |
957 | } | 958 | } |
958 | 959 | ||
959 | static void | 960 | void |
960 | cleanup_exit(int i) | 961 | cleanup_exit(int i) |
961 | { | 962 | { |
962 | cleanup_socket(NULL); | 963 | cleanup_socket(); |
963 | exit(i); | 964 | _exit(i); |
964 | } | 965 | } |
965 | 966 | ||
966 | static void | 967 | static void |
967 | cleanup_handler(int sig) | 968 | cleanup_handler(int sig) |
968 | { | 969 | { |
969 | cleanup_socket(NULL); | 970 | cleanup_socket(); |
970 | _exit(2); | 971 | _exit(2); |
971 | } | 972 | } |
972 | 973 | ||
@@ -1099,7 +1100,7 @@ main(int ac, char **av) | |||
1099 | 1100 | ||
1100 | if (agentsocket == NULL) { | 1101 | if (agentsocket == NULL) { |
1101 | /* Create private directory for agent socket */ | 1102 | /* Create private directory for agent socket */ |
1102 | strlcpy(socket_dir, "/tmp/ssh-XXXXXXXX", sizeof socket_dir); | 1103 | strlcpy(socket_dir, "/tmp/ssh-XXXXXXXXXX", sizeof socket_dir); |
1103 | if (mkdtemp(socket_dir) == NULL) { | 1104 | if (mkdtemp(socket_dir) == NULL) { |
1104 | perror("mkdtemp: private socket dir"); | 1105 | perror("mkdtemp: private socket dir"); |
1105 | exit(1); | 1106 | exit(1); |
@@ -1137,7 +1138,7 @@ main(int ac, char **av) | |||
1137 | #ifdef HAVE_CYGWIN | 1138 | #ifdef HAVE_CYGWIN |
1138 | umask(prev_mask); | 1139 | umask(prev_mask); |
1139 | #endif | 1140 | #endif |
1140 | if (listen(sock, 128) < 0) { | 1141 | if (listen(sock, SSH_LISTEN_BACKLOG) < 0) { |
1141 | perror("listen"); | 1142 | perror("listen"); |
1142 | cleanup_exit(1); | 1143 | cleanup_exit(1); |
1143 | } | 1144 | } |
@@ -1208,7 +1209,6 @@ main(int ac, char **av) | |||
1208 | #endif | 1209 | #endif |
1209 | 1210 | ||
1210 | skip: | 1211 | skip: |
1211 | fatal_add_cleanup(cleanup_socket, NULL); | ||
1212 | new_socket(AUTH_SOCKET, sock); | 1212 | new_socket(AUTH_SOCKET, sock); |
1213 | if (ac > 0) { | 1213 | if (ac > 0) { |
1214 | mysignal(SIGALRM, check_parent_exists); | 1214 | mysignal(SIGALRM, check_parent_exists); |