diff options
Diffstat (limited to 'ssh-agent.c')
-rw-r--r-- | ssh-agent.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/ssh-agent.c b/ssh-agent.c index 07dafaa57..6d94c6c29 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.54 2001/04/03 13:56:11 stevesk Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.55 2001/06/23 15:12:20 itojun Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: ssh-agent.c,v 1.54 2001/04/03 13:56:11 stevesk Exp $"); | 40 | RCSID("$OpenBSD: ssh-agent.c,v 1.55 2001/06/23 15:12:20 itojun Exp $"); |
41 | 41 | ||
42 | #include <openssl/evp.h> | 42 | #include <openssl/evp.h> |
43 | #include <openssl/md5.h> | 43 | #include <openssl/md5.h> |
@@ -97,9 +97,7 @@ extern char *__progname; | |||
97 | char *__progname; | 97 | char *__progname; |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | int prepare_select(fd_set **, fd_set **, int *); | 100 | static void |
101 | |||
102 | void | ||
103 | idtab_init(void) | 101 | idtab_init(void) |
104 | { | 102 | { |
105 | int i; | 103 | int i; |
@@ -110,7 +108,7 @@ idtab_init(void) | |||
110 | } | 108 | } |
111 | 109 | ||
112 | /* return private key table for requested protocol version */ | 110 | /* return private key table for requested protocol version */ |
113 | Idtab * | 111 | static Idtab * |
114 | idtab_lookup(int version) | 112 | idtab_lookup(int version) |
115 | { | 113 | { |
116 | if (version < 1 || version > 2) | 114 | if (version < 1 || version > 2) |
@@ -119,7 +117,7 @@ idtab_lookup(int version) | |||
119 | } | 117 | } |
120 | 118 | ||
121 | /* return matching private key for given public key */ | 119 | /* return matching private key for given public key */ |
122 | Key * | 120 | static Key * |
123 | lookup_private_key(Key *key, int *idx, int version) | 121 | lookup_private_key(Key *key, int *idx, int version) |
124 | { | 122 | { |
125 | int i; | 123 | int i; |
@@ -135,7 +133,7 @@ lookup_private_key(Key *key, int *idx, int version) | |||
135 | } | 133 | } |
136 | 134 | ||
137 | /* send list of supported public keys to 'client' */ | 135 | /* send list of supported public keys to 'client' */ |
138 | void | 136 | static void |
139 | process_request_identities(SocketEntry *e, int version) | 137 | process_request_identities(SocketEntry *e, int version) |
140 | { | 138 | { |
141 | Idtab *tab = idtab_lookup(version); | 139 | Idtab *tab = idtab_lookup(version); |
@@ -167,7 +165,7 @@ process_request_identities(SocketEntry *e, int version) | |||
167 | } | 165 | } |
168 | 166 | ||
169 | /* ssh1 only */ | 167 | /* ssh1 only */ |
170 | void | 168 | static void |
171 | process_authentication_challenge1(SocketEntry *e) | 169 | process_authentication_challenge1(SocketEntry *e) |
172 | { | 170 | { |
173 | Key *key, *private; | 171 | Key *key, *private; |
@@ -233,7 +231,7 @@ send: | |||
233 | } | 231 | } |
234 | 232 | ||
235 | /* ssh2 only */ | 233 | /* ssh2 only */ |
236 | void | 234 | static void |
237 | process_sign_request2(SocketEntry *e) | 235 | process_sign_request2(SocketEntry *e) |
238 | { | 236 | { |
239 | extern int datafellows; | 237 | extern int datafellows; |
@@ -278,7 +276,7 @@ process_sign_request2(SocketEntry *e) | |||
278 | } | 276 | } |
279 | 277 | ||
280 | /* shared */ | 278 | /* shared */ |
281 | void | 279 | static void |
282 | process_remove_identity(SocketEntry *e, int version) | 280 | process_remove_identity(SocketEntry *e, int version) |
283 | { | 281 | { |
284 | Key *key = NULL, *private; | 282 | Key *key = NULL, *private; |
@@ -339,7 +337,7 @@ process_remove_identity(SocketEntry *e, int version) | |||
339 | success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE); | 337 | success ? SSH_AGENT_SUCCESS : SSH_AGENT_FAILURE); |
340 | } | 338 | } |
341 | 339 | ||
342 | void | 340 | static void |
343 | process_remove_all_identities(SocketEntry *e, int version) | 341 | process_remove_all_identities(SocketEntry *e, int version) |
344 | { | 342 | { |
345 | u_int i; | 343 | u_int i; |
@@ -360,7 +358,7 @@ process_remove_all_identities(SocketEntry *e, int version) | |||
360 | return; | 358 | return; |
361 | } | 359 | } |
362 | 360 | ||
363 | void | 361 | static void |
364 | process_add_identity(SocketEntry *e, int version) | 362 | process_add_identity(SocketEntry *e, int version) |
365 | { | 363 | { |
366 | Key *k = NULL; | 364 | Key *k = NULL; |
@@ -444,7 +442,7 @@ send: | |||
444 | 442 | ||
445 | /* dispatch incoming messages */ | 443 | /* dispatch incoming messages */ |
446 | 444 | ||
447 | void | 445 | static void |
448 | process_message(SocketEntry *e) | 446 | process_message(SocketEntry *e) |
449 | { | 447 | { |
450 | u_int msg_len; | 448 | u_int msg_len; |
@@ -508,7 +506,7 @@ process_message(SocketEntry *e) | |||
508 | } | 506 | } |
509 | } | 507 | } |
510 | 508 | ||
511 | void | 509 | static void |
512 | new_socket(int type, int fd) | 510 | new_socket(int type, int fd) |
513 | { | 511 | { |
514 | u_int i, old_alloc; | 512 | u_int i, old_alloc; |
@@ -540,7 +538,7 @@ new_socket(int type, int fd) | |||
540 | buffer_init(&sockets[old_alloc].output); | 538 | buffer_init(&sockets[old_alloc].output); |
541 | } | 539 | } |
542 | 540 | ||
543 | int | 541 | static int |
544 | prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl) | 542 | prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl) |
545 | { | 543 | { |
546 | u_int i, sz; | 544 | u_int i, sz; |
@@ -588,7 +586,7 @@ prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl) | |||
588 | return (1); | 586 | return (1); |
589 | } | 587 | } |
590 | 588 | ||
591 | void | 589 | static void |
592 | after_select(fd_set *readset, fd_set *writeset) | 590 | after_select(fd_set *readset, fd_set *writeset) |
593 | { | 591 | { |
594 | u_int i; | 592 | u_int i; |
@@ -660,7 +658,7 @@ after_select(fd_set *readset, fd_set *writeset) | |||
660 | } | 658 | } |
661 | } | 659 | } |
662 | 660 | ||
663 | void | 661 | static void |
664 | check_parent_exists(int sig) | 662 | check_parent_exists(int sig) |
665 | { | 663 | { |
666 | int save_errno = errno; | 664 | int save_errno = errno; |
@@ -674,7 +672,7 @@ check_parent_exists(int sig) | |||
674 | errno = save_errno; | 672 | errno = save_errno; |
675 | } | 673 | } |
676 | 674 | ||
677 | void | 675 | static void |
678 | cleanup_socket(void) | 676 | cleanup_socket(void) |
679 | { | 677 | { |
680 | if (socket_name[0]) | 678 | if (socket_name[0]) |
@@ -683,21 +681,21 @@ cleanup_socket(void) | |||
683 | rmdir(socket_dir); | 681 | rmdir(socket_dir); |
684 | } | 682 | } |
685 | 683 | ||
686 | void | 684 | static void |
687 | cleanup_exit(int i) | 685 | cleanup_exit(int i) |
688 | { | 686 | { |
689 | cleanup_socket(); | 687 | cleanup_socket(); |
690 | exit(i); | 688 | exit(i); |
691 | } | 689 | } |
692 | 690 | ||
693 | void | 691 | static void |
694 | cleanup_handler(int sig) | 692 | cleanup_handler(int sig) |
695 | { | 693 | { |
696 | cleanup_socket(); | 694 | cleanup_socket(); |
697 | _exit(2); | 695 | _exit(2); |
698 | } | 696 | } |
699 | 697 | ||
700 | void | 698 | static void |
701 | usage(void) | 699 | usage(void) |
702 | { | 700 | { |
703 | fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION); | 701 | fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION); |