diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | auth-rhosts.c | 4 | ||||
-rw-r--r-- | auth1.c | 6 | ||||
-rw-r--r-- | auth2-chall.c | 16 | ||||
-rw-r--r-- | auth2.c | 56 | ||||
-rw-r--r-- | authfd.c | 8 | ||||
-rw-r--r-- | authfile.c | 16 | ||||
-rw-r--r-- | canohost.c | 14 | ||||
-rw-r--r-- | channels.c | 74 | ||||
-rw-r--r-- | cipher.c | 63 | ||||
-rw-r--r-- | clientloop.c | 60 | ||||
-rw-r--r-- | deattack.c | 7 | ||||
-rw-r--r-- | dh.c | 4 | ||||
-rw-r--r-- | hostfile.c | 6 | ||||
-rw-r--r-- | kex.c | 33 | ||||
-rw-r--r-- | kexdh.c | 8 | ||||
-rw-r--r-- | kexgex.c | 8 | ||||
-rw-r--r-- | key.c | 16 | ||||
-rw-r--r-- | nchan.c | 14 | ||||
-rw-r--r-- | packet.c | 16 | ||||
-rw-r--r-- | radix.c | 4 | ||||
-rw-r--r-- | readpass.c | 4 | ||||
-rw-r--r-- | scp.c | 9 | ||||
-rw-r--r-- | servconf.c | 10 | ||||
-rw-r--r-- | serverloop.c | 46 | ||||
-rw-r--r-- | session.c | 69 | ||||
-rw-r--r-- | sftp-client.c | 18 | ||||
-rw-r--r-- | sftp-glob.c | 20 | ||||
-rw-r--r-- | sftp-int.c | 30 | ||||
-rw-r--r-- | sftp-server.c | 90 | ||||
-rw-r--r-- | sftp.c | 6 | ||||
-rw-r--r-- | ssh-add.c | 12 | ||||
-rw-r--r-- | ssh-agent.c | 42 | ||||
-rw-r--r-- | ssh-keygen.c | 24 | ||||
-rw-r--r-- | ssh-keyscan.c | 44 | ||||
-rw-r--r-- | ssh.c | 30 | ||||
-rw-r--r-- | sshconnect.c | 12 | ||||
-rw-r--r-- | sshconnect1.c | 20 | ||||
-rw-r--r-- | sshconnect2.c | 38 | ||||
-rw-r--r-- | sshd.c | 37 |
40 files changed, 510 insertions, 497 deletions
@@ -67,6 +67,17 @@ | |||
67 | [ssh-keygen.c] | 67 | [ssh-keygen.c] |
68 | try to decode ssh-3.0.0 private rsa keys | 68 | try to decode ssh-3.0.0 private rsa keys |
69 | (allow migration to openssh, not vice versa), #910 | 69 | (allow migration to openssh, not vice versa), #910 |
70 | - itojun@cvs.openbsd.org 2001/06/23 15:12:20 | ||
71 | [auth1.c auth2.c auth2-chall.c authfd.c authfile.c auth-rhosts.c | ||
72 | canohost.c channels.c cipher.c clientloop.c deattack.c dh.c | ||
73 | hostfile.c kex.c kexdh.c kexgex.c key.c nchan.c packet.c radix.c | ||
74 | readpass.c scp.c servconf.c serverloop.c session.c sftp.c | ||
75 | sftp-client.c sftp-glob.c sftp-int.c sftp-server.c ssh-add.c | ||
76 | ssh-agent.c ssh.c sshconnect1.c sshconnect2.c sshconnect.c sshd.c | ||
77 | ssh-keygen.c ssh-keyscan.c] | ||
78 | more strict prototypes. raise warning level in Makefile.inc. | ||
79 | markus ok'ed | ||
80 | TODO; cleanup headers | ||
70 | 81 | ||
71 | 20010622 | 82 | 20010622 |
72 | - (stevesk) handle systems without pw_expire and pw_change. | 83 | - (stevesk) handle systems without pw_expire and pw_change. |
@@ -5751,4 +5762,4 @@ | |||
5751 | - Wrote replacements for strlcpy and mkdtemp | 5762 | - Wrote replacements for strlcpy and mkdtemp |
5752 | - Released 1.0pre1 | 5763 | - Released 1.0pre1 |
5753 | 5764 | ||
5754 | $Id: ChangeLog,v 1.1314 2001/06/25 04:47:54 mouring Exp $ | 5765 | $Id: ChangeLog,v 1.1315 2001/06/25 05:01:22 mouring Exp $ |
diff --git a/auth-rhosts.c b/auth-rhosts.c index 324a0f925..9ba64dbc3 100644 --- a/auth-rhosts.c +++ b/auth-rhosts.c | |||
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$OpenBSD: auth-rhosts.c,v 1.23 2001/04/12 19:15:24 markus Exp $"); | 17 | RCSID("$OpenBSD: auth-rhosts.c,v 1.24 2001/06/23 15:12:17 itojun Exp $"); |
18 | 18 | ||
19 | #include "packet.h" | 19 | #include "packet.h" |
20 | #include "xmalloc.h" | 20 | #include "xmalloc.h" |
@@ -34,7 +34,7 @@ extern ServerOptions options; | |||
34 | * based on the file, and returns zero otherwise. | 34 | * based on the file, and returns zero otherwise. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | int | 37 | static int |
38 | check_rhosts_file(const char *filename, const char *hostname, | 38 | check_rhosts_file(const char *filename, const char *hostname, |
39 | const char *ipaddr, const char *client_user, | 39 | const char *ipaddr, const char *client_user, |
40 | const char *server_user) | 40 | const char *server_user) |
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "includes.h" | 12 | #include "includes.h" |
13 | RCSID("$OpenBSD: auth1.c,v 1.23 2001/05/18 14:13:28 markus Exp $"); | 13 | RCSID("$OpenBSD: auth1.c,v 1.24 2001/06/23 15:12:17 itojun Exp $"); |
14 | 14 | ||
15 | #include "xmalloc.h" | 15 | #include "xmalloc.h" |
16 | #include "rsa.h" | 16 | #include "rsa.h" |
@@ -35,7 +35,7 @@ extern char *aixloginmsg; | |||
35 | /* | 35 | /* |
36 | * convert ssh auth msg type into description | 36 | * convert ssh auth msg type into description |
37 | */ | 37 | */ |
38 | char * | 38 | static char * |
39 | get_authname(int type) | 39 | get_authname(int type) |
40 | { | 40 | { |
41 | static char buf[1024]; | 41 | static char buf[1024]; |
@@ -64,7 +64,7 @@ get_authname(int type) | |||
64 | * read packets, try to authenticate the user and | 64 | * read packets, try to authenticate the user and |
65 | * return only if authentication is successful | 65 | * return only if authentication is successful |
66 | */ | 66 | */ |
67 | void | 67 | static void |
68 | do_authloop(Authctxt *authctxt) | 68 | do_authloop(Authctxt *authctxt) |
69 | { | 69 | { |
70 | int authenticated = 0; | 70 | int authenticated = 0; |
diff --git a/auth2-chall.c b/auth2-chall.c index be741010e..5afd7d769 100644 --- a/auth2-chall.c +++ b/auth2-chall.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ | 24 | */ |
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2-chall.c,v 1.6 2001/06/03 20:06:11 markus Exp $"); | 26 | RCSID("$OpenBSD: auth2-chall.c,v 1.7 2001/06/23 15:12:17 itojun Exp $"); |
27 | 27 | ||
28 | #include "ssh2.h" | 28 | #include "ssh2.h" |
29 | #include "auth.h" | 29 | #include "auth.h" |
@@ -33,9 +33,9 @@ RCSID("$OpenBSD: auth2-chall.c,v 1.6 2001/06/03 20:06:11 markus Exp $"); | |||
33 | #include "auth.h" | 33 | #include "auth.h" |
34 | #include "log.h" | 34 | #include "log.h" |
35 | 35 | ||
36 | static int auth2_challenge_start(Authctxt *authctxt); | 36 | static int auth2_challenge_start(Authctxt *); |
37 | static int send_userauth_info_request(Authctxt *authctxt); | 37 | static int send_userauth_info_request(Authctxt *); |
38 | static void input_userauth_info_response(int type, int plen, void *ctxt); | 38 | static void input_userauth_info_response(int, int, void *); |
39 | 39 | ||
40 | #ifdef BSD_AUTH | 40 | #ifdef BSD_AUTH |
41 | extern KbdintDevice bsdauth_device; | 41 | extern KbdintDevice bsdauth_device; |
@@ -64,7 +64,7 @@ struct KbdintAuthctxt | |||
64 | KbdintDevice *device; | 64 | KbdintDevice *device; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | KbdintAuthctxt * | 67 | static KbdintAuthctxt * |
68 | kbdint_alloc(const char *devs) | 68 | kbdint_alloc(const char *devs) |
69 | { | 69 | { |
70 | KbdintAuthctxt *kbdintctxt; | 70 | KbdintAuthctxt *kbdintctxt; |
@@ -89,7 +89,7 @@ kbdint_alloc(const char *devs) | |||
89 | 89 | ||
90 | return kbdintctxt; | 90 | return kbdintctxt; |
91 | } | 91 | } |
92 | void | 92 | static void |
93 | kbdint_reset_device(KbdintAuthctxt *kbdintctxt) | 93 | kbdint_reset_device(KbdintAuthctxt *kbdintctxt) |
94 | { | 94 | { |
95 | if (kbdintctxt->ctxt) { | 95 | if (kbdintctxt->ctxt) { |
@@ -98,7 +98,7 @@ kbdint_reset_device(KbdintAuthctxt *kbdintctxt) | |||
98 | } | 98 | } |
99 | kbdintctxt->device = NULL; | 99 | kbdintctxt->device = NULL; |
100 | } | 100 | } |
101 | void | 101 | static void |
102 | kbdint_free(KbdintAuthctxt *kbdintctxt) | 102 | kbdint_free(KbdintAuthctxt *kbdintctxt) |
103 | { | 103 | { |
104 | if (kbdintctxt->device) | 104 | if (kbdintctxt->device) |
@@ -110,7 +110,7 @@ kbdint_free(KbdintAuthctxt *kbdintctxt) | |||
110 | xfree(kbdintctxt); | 110 | xfree(kbdintctxt); |
111 | } | 111 | } |
112 | /* get next device */ | 112 | /* get next device */ |
113 | int | 113 | static int |
114 | kbdint_next_device(KbdintAuthctxt *kbdintctxt) | 114 | kbdint_next_device(KbdintAuthctxt *kbdintctxt) |
115 | { | 115 | { |
116 | size_t len; | 116 | size_t len; |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2.c,v 1.65 2001/06/23 03:04:43 markus Exp $"); | 26 | RCSID("$OpenBSD: auth2.c,v 1.66 2001/06/23 15:12:17 itojun Exp $"); |
27 | 27 | ||
28 | #include <openssl/evp.h> | 28 | #include <openssl/evp.h> |
29 | 29 | ||
@@ -74,25 +74,23 @@ struct Authmethod { | |||
74 | 74 | ||
75 | /* protocol */ | 75 | /* protocol */ |
76 | 76 | ||
77 | void input_service_request(int type, int plen, void *ctxt); | 77 | static void input_service_request(int, int, void *); |
78 | void input_userauth_request(int type, int plen, void *ctxt); | 78 | static void input_userauth_request(int, int, void *); |
79 | void protocol_error(int type, int plen, void *ctxt); | 79 | static void protocol_error(int, int, void *); |
80 | 80 | ||
81 | /* helper */ | 81 | /* helper */ |
82 | Authmethod *authmethod_lookup(const char *name); | 82 | static Authmethod *authmethod_lookup(const char *); |
83 | char *authmethods_get(void); | 83 | char *authmethods_get(void); |
84 | int user_key_allowed(struct passwd *pw, Key *key); | 84 | static int user_key_allowed(struct passwd *, Key *); |
85 | int | 85 | static int hostbased_key_allowed(struct passwd *, const char *, char *, Key *); |
86 | hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost, | ||
87 | Key *key); | ||
88 | 86 | ||
89 | /* auth */ | 87 | /* auth */ |
90 | void userauth_banner(void); | 88 | static void userauth_banner(void); |
91 | int userauth_none(Authctxt *authctxt); | 89 | static int userauth_none(Authctxt *); |
92 | int userauth_passwd(Authctxt *authctxt); | 90 | static int userauth_passwd(Authctxt *); |
93 | int userauth_pubkey(Authctxt *authctxt); | 91 | static int userauth_pubkey(Authctxt *); |
94 | int userauth_hostbased(Authctxt *authctxt); | 92 | static int userauth_hostbased(Authctxt *); |
95 | int userauth_kbdint(Authctxt *authctxt); | 93 | static int userauth_kbdint(Authctxt *); |
96 | 94 | ||
97 | Authmethod authmethods[] = { | 95 | Authmethod authmethods[] = { |
98 | {"none", | 96 | {"none", |
@@ -136,7 +134,7 @@ do_authentication2() | |||
136 | do_authenticated(authctxt); | 134 | do_authenticated(authctxt); |
137 | } | 135 | } |
138 | 136 | ||
139 | void | 137 | static void |
140 | protocol_error(int type, int plen, void *ctxt) | 138 | protocol_error(int type, int plen, void *ctxt) |
141 | { | 139 | { |
142 | log("auth: protocol error: type %d plen %d", type, plen); | 140 | log("auth: protocol error: type %d plen %d", type, plen); |
@@ -146,7 +144,7 @@ protocol_error(int type, int plen, void *ctxt) | |||
146 | packet_write_wait(); | 144 | packet_write_wait(); |
147 | } | 145 | } |
148 | 146 | ||
149 | void | 147 | static void |
150 | input_service_request(int type, int plen, void *ctxt) | 148 | input_service_request(int type, int plen, void *ctxt) |
151 | { | 149 | { |
152 | Authctxt *authctxt = ctxt; | 150 | Authctxt *authctxt = ctxt; |
@@ -179,7 +177,7 @@ input_service_request(int type, int plen, void *ctxt) | |||
179 | xfree(service); | 177 | xfree(service); |
180 | } | 178 | } |
181 | 179 | ||
182 | void | 180 | static void |
183 | input_userauth_request(int type, int plen, void *ctxt) | 181 | input_userauth_request(int type, int plen, void *ctxt) |
184 | { | 182 | { |
185 | Authctxt *authctxt = ctxt; | 183 | Authctxt *authctxt = ctxt; |
@@ -297,7 +295,7 @@ userauth_finish(Authctxt *authctxt, int authenticated, char *method) | |||
297 | } | 295 | } |
298 | } | 296 | } |
299 | 297 | ||
300 | void | 298 | static void |
301 | userauth_banner(void) | 299 | userauth_banner(void) |
302 | { | 300 | { |
303 | struct stat st; | 301 | struct stat st; |
@@ -328,7 +326,7 @@ done: | |||
328 | return; | 326 | return; |
329 | } | 327 | } |
330 | 328 | ||
331 | int | 329 | static int |
332 | userauth_none(Authctxt *authctxt) | 330 | userauth_none(Authctxt *authctxt) |
333 | { | 331 | { |
334 | /* disable method "none", only allowed one time */ | 332 | /* disable method "none", only allowed one time */ |
@@ -354,7 +352,7 @@ userauth_none(Authctxt *authctxt) | |||
354 | #endif /* USE_PAM */ | 352 | #endif /* USE_PAM */ |
355 | } | 353 | } |
356 | 354 | ||
357 | int | 355 | static int |
358 | userauth_passwd(Authctxt *authctxt) | 356 | userauth_passwd(Authctxt *authctxt) |
359 | { | 357 | { |
360 | char *password; | 358 | char *password; |
@@ -383,7 +381,7 @@ userauth_passwd(Authctxt *authctxt) | |||
383 | return authenticated; | 381 | return authenticated; |
384 | } | 382 | } |
385 | 383 | ||
386 | int | 384 | static int |
387 | userauth_kbdint(Authctxt *authctxt) | 385 | userauth_kbdint(Authctxt *authctxt) |
388 | { | 386 | { |
389 | int authenticated = 0; | 387 | int authenticated = 0; |
@@ -411,7 +409,7 @@ userauth_kbdint(Authctxt *authctxt) | |||
411 | return authenticated; | 409 | return authenticated; |
412 | } | 410 | } |
413 | 411 | ||
414 | int | 412 | static int |
415 | userauth_pubkey(Authctxt *authctxt) | 413 | userauth_pubkey(Authctxt *authctxt) |
416 | { | 414 | { |
417 | Buffer b; | 415 | Buffer b; |
@@ -517,7 +515,7 @@ userauth_pubkey(Authctxt *authctxt) | |||
517 | return authenticated; | 515 | return authenticated; |
518 | } | 516 | } |
519 | 517 | ||
520 | int | 518 | static int |
521 | userauth_hostbased(Authctxt *authctxt) | 519 | userauth_hostbased(Authctxt *authctxt) |
522 | { | 520 | { |
523 | Buffer b; | 521 | Buffer b; |
@@ -634,7 +632,7 @@ authmethods_get(void) | |||
634 | return list; | 632 | return list; |
635 | } | 633 | } |
636 | 634 | ||
637 | Authmethod * | 635 | static Authmethod * |
638 | authmethod_lookup(const char *name) | 636 | authmethod_lookup(const char *name) |
639 | { | 637 | { |
640 | Authmethod *method = NULL; | 638 | Authmethod *method = NULL; |
@@ -649,7 +647,7 @@ authmethod_lookup(const char *name) | |||
649 | } | 647 | } |
650 | 648 | ||
651 | /* return 1 if user allows given key */ | 649 | /* return 1 if user allows given key */ |
652 | int | 650 | static int |
653 | user_key_allowed2(struct passwd *pw, Key *key, char *file) | 651 | user_key_allowed2(struct passwd *pw, Key *key, char *file) |
654 | { | 652 | { |
655 | char line[8192]; | 653 | char line[8192]; |
@@ -737,7 +735,7 @@ user_key_allowed2(struct passwd *pw, Key *key, char *file) | |||
737 | } | 735 | } |
738 | 736 | ||
739 | /* check whether given key is in .ssh/authorized_keys* */ | 737 | /* check whether given key is in .ssh/authorized_keys* */ |
740 | int | 738 | static int |
741 | user_key_allowed(struct passwd *pw, Key *key) | 739 | user_key_allowed(struct passwd *pw, Key *key) |
742 | { | 740 | { |
743 | int success; | 741 | int success; |
@@ -757,7 +755,7 @@ user_key_allowed(struct passwd *pw, Key *key) | |||
757 | } | 755 | } |
758 | 756 | ||
759 | /* return 1 if given hostkey is allowed */ | 757 | /* return 1 if given hostkey is allowed */ |
760 | int | 758 | static int |
761 | hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost, | 759 | hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost, |
762 | Key *key) | 760 | Key *key) |
763 | { | 761 | { |
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: authfd.c,v 1.40 2001/06/07 20:23:03 markus Exp $"); | 38 | RCSID("$OpenBSD: authfd.c,v 1.41 2001/06/23 15:12:17 itojun Exp $"); |
39 | 39 | ||
40 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
41 | 41 | ||
@@ -96,7 +96,7 @@ ssh_get_authentication_socket(void) | |||
96 | return sock; | 96 | return sock; |
97 | } | 97 | } |
98 | 98 | ||
99 | int | 99 | static int |
100 | ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply) | 100 | ssh_request_reply(AuthenticationConnection *auth, Buffer *request, Buffer *reply) |
101 | { | 101 | { |
102 | int l, len; | 102 | int l, len; |
@@ -419,7 +419,7 @@ ssh_agent_sign(AuthenticationConnection *auth, | |||
419 | 419 | ||
420 | /* Encode key for a message to the agent. */ | 420 | /* Encode key for a message to the agent. */ |
421 | 421 | ||
422 | void | 422 | static void |
423 | ssh_encode_identity_rsa1(Buffer *b, RSA *key, const char *comment) | 423 | ssh_encode_identity_rsa1(Buffer *b, RSA *key, const char *comment) |
424 | { | 424 | { |
425 | buffer_clear(b); | 425 | buffer_clear(b); |
@@ -435,7 +435,7 @@ ssh_encode_identity_rsa1(Buffer *b, RSA *key, const char *comment) | |||
435 | buffer_put_cstring(b, comment); | 435 | buffer_put_cstring(b, comment); |
436 | } | 436 | } |
437 | 437 | ||
438 | void | 438 | static void |
439 | ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment) | 439 | ssh_encode_identity_ssh2(Buffer *b, Key *key, const char *comment) |
440 | { | 440 | { |
441 | buffer_clear(b); | 441 | buffer_clear(b); |
diff --git a/authfile.c b/authfile.c index c4da9aad3..b4b985c95 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "includes.h" | 38 | #include "includes.h" |
39 | RCSID("$OpenBSD: authfile.c,v 1.36 2001/06/07 20:23:03 markus Exp $"); | 39 | RCSID("$OpenBSD: authfile.c,v 1.37 2001/06/23 15:12:17 itojun Exp $"); |
40 | 40 | ||
41 | #include <openssl/err.h> | 41 | #include <openssl/err.h> |
42 | #include <openssl/evp.h> | 42 | #include <openssl/evp.h> |
@@ -62,7 +62,7 @@ static const char authfile_id_string[] = | |||
62 | * passphrase. | 62 | * passphrase. |
63 | */ | 63 | */ |
64 | 64 | ||
65 | int | 65 | static int |
66 | key_save_private_rsa1(Key *key, const char *filename, const char *passphrase, | 66 | key_save_private_rsa1(Key *key, const char *filename, const char *passphrase, |
67 | const char *comment) | 67 | const char *comment) |
68 | { | 68 | { |
@@ -159,7 +159,7 @@ key_save_private_rsa1(Key *key, const char *filename, const char *passphrase, | |||
159 | } | 159 | } |
160 | 160 | ||
161 | /* save SSH v2 key in OpenSSL PEM format */ | 161 | /* save SSH v2 key in OpenSSL PEM format */ |
162 | int | 162 | static int |
163 | key_save_private_pem(Key *key, const char *filename, const char *_passphrase, | 163 | key_save_private_pem(Key *key, const char *filename, const char *_passphrase, |
164 | const char *comment) | 164 | const char *comment) |
165 | { | 165 | { |
@@ -226,7 +226,7 @@ key_save_private(Key *key, const char *filename, const char *passphrase, | |||
226 | * otherwise. | 226 | * otherwise. |
227 | */ | 227 | */ |
228 | 228 | ||
229 | Key * | 229 | static Key * |
230 | key_load_public_rsa1(int fd, const char *filename, char **commentp) | 230 | key_load_public_rsa1(int fd, const char *filename, char **commentp) |
231 | { | 231 | { |
232 | Buffer buffer; | 232 | Buffer buffer; |
@@ -306,7 +306,7 @@ key_load_public_type(int type, const char *filename, char **commentp) | |||
306 | * Assumes we are called under uid of the owner of the file. | 306 | * Assumes we are called under uid of the owner of the file. |
307 | */ | 307 | */ |
308 | 308 | ||
309 | Key * | 309 | static Key * |
310 | key_load_private_rsa1(int fd, const char *filename, const char *passphrase, | 310 | key_load_private_rsa1(int fd, const char *filename, const char *passphrase, |
311 | char **commentp) | 311 | char **commentp) |
312 | { | 312 | { |
@@ -430,7 +430,7 @@ fail: | |||
430 | return NULL; | 430 | return NULL; |
431 | } | 431 | } |
432 | 432 | ||
433 | Key * | 433 | static Key * |
434 | key_load_private_pem(int fd, int type, const char *passphrase, | 434 | key_load_private_pem(int fd, int type, const char *passphrase, |
435 | char **commentp) | 435 | char **commentp) |
436 | { | 436 | { |
@@ -481,7 +481,7 @@ key_load_private_pem(int fd, int type, const char *passphrase, | |||
481 | return prv; | 481 | return prv; |
482 | } | 482 | } |
483 | 483 | ||
484 | int | 484 | static int |
485 | key_perm_ok(int fd, const char *filename) | 485 | key_perm_ok(int fd, const char *filename) |
486 | { | 486 | { |
487 | struct stat st; | 487 | struct stat st; |
@@ -571,7 +571,7 @@ key_load_private(const char *filename, const char *passphrase, | |||
571 | return prv; | 571 | return prv; |
572 | } | 572 | } |
573 | 573 | ||
574 | int | 574 | static int |
575 | key_try_load_public(Key *k, const char *filename, char **commentp) | 575 | key_try_load_public(Key *k, const char *filename, char **commentp) |
576 | { | 576 | { |
577 | FILE *f; | 577 | FILE *f; |
diff --git a/canohost.c b/canohost.c index 5d345eb27..6e6a04505 100644 --- a/canohost.c +++ b/canohost.c | |||
@@ -12,21 +12,21 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: canohost.c,v 1.26 2001/04/18 14:15:00 markus Exp $"); | 15 | RCSID("$OpenBSD: canohost.c,v 1.27 2001/06/23 15:12:17 itojun Exp $"); |
16 | 16 | ||
17 | #include "packet.h" | 17 | #include "packet.h" |
18 | #include "xmalloc.h" | 18 | #include "xmalloc.h" |
19 | #include "log.h" | 19 | #include "log.h" |
20 | #include "canohost.h" | 20 | #include "canohost.h" |
21 | 21 | ||
22 | void check_ip_options(int socket, char *ipaddr); | 22 | static void check_ip_options(int, char *); |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * Return the canonical name of the host at the other end of the socket. The | 25 | * Return the canonical name of the host at the other end of the socket. The |
26 | * caller should free the returned string with xfree. | 26 | * caller should free the returned string with xfree. |
27 | */ | 27 | */ |
28 | 28 | ||
29 | char * | 29 | static char * |
30 | get_remote_hostname(int socket, int reverse_mapping_check) | 30 | get_remote_hostname(int socket, int reverse_mapping_check) |
31 | { | 31 | { |
32 | struct sockaddr_storage from; | 32 | struct sockaddr_storage from; |
@@ -140,7 +140,7 @@ get_remote_hostname(int socket, int reverse_mapping_check) | |||
140 | * exit here if we detect any IP options. | 140 | * exit here if we detect any IP options. |
141 | */ | 141 | */ |
142 | /* IPv4 only */ | 142 | /* IPv4 only */ |
143 | void | 143 | static void |
144 | check_ip_options(int socket, char *ipaddr) | 144 | check_ip_options(int socket, char *ipaddr) |
145 | { | 145 | { |
146 | u_char options[200]; | 146 | u_char options[200]; |
@@ -202,7 +202,7 @@ get_canonical_hostname(int reverse_mapping_check) | |||
202 | * Returns the remote IP-address of socket as a string. The returned | 202 | * Returns the remote IP-address of socket as a string. The returned |
203 | * string must be freed. | 203 | * string must be freed. |
204 | */ | 204 | */ |
205 | char * | 205 | static char * |
206 | get_socket_address(int socket, int remote, int flags) | 206 | get_socket_address(int socket, int remote, int flags) |
207 | { | 207 | { |
208 | struct sockaddr_storage addr; | 208 | struct sockaddr_storage addr; |
@@ -293,7 +293,7 @@ get_remote_name_or_ip(u_int utmp_len, int reverse_mapping_check) | |||
293 | 293 | ||
294 | /* Returns the local/remote port for the socket. */ | 294 | /* Returns the local/remote port for the socket. */ |
295 | 295 | ||
296 | int | 296 | static int |
297 | get_sock_port(int sock, int local) | 297 | get_sock_port(int sock, int local) |
298 | { | 298 | { |
299 | struct sockaddr_storage from; | 299 | struct sockaddr_storage from; |
@@ -323,7 +323,7 @@ get_sock_port(int sock, int local) | |||
323 | 323 | ||
324 | /* Returns remote/local port number for the current connection. */ | 324 | /* Returns remote/local port number for the current connection. */ |
325 | 325 | ||
326 | int | 326 | static int |
327 | get_port(int local) | 327 | get_port(int local) |
328 | { | 328 | { |
329 | /* | 329 | /* |
diff --git a/channels.c b/channels.c index d9513fada..ce4c5952d 100644 --- a/channels.c +++ b/channels.c | |||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: channels.c,v 1.126 2001/06/20 13:56:39 markus Exp $"); | 43 | RCSID("$OpenBSD: channels.c,v 1.127 2001/06/23 15:12:17 itojun Exp $"); |
44 | 44 | ||
45 | #include "ssh.h" | 45 | #include "ssh.h" |
46 | #include "ssh1.h" | 46 | #include "ssh1.h" |
@@ -133,12 +133,11 @@ static u_int x11_fake_data_len; | |||
133 | static char *auth_sock_name = NULL; | 133 | static char *auth_sock_name = NULL; |
134 | static char *auth_sock_dir = NULL; | 134 | static char *auth_sock_dir = NULL; |
135 | 135 | ||
136 | |||
137 | /* AF_UNSPEC or AF_INET or AF_INET6 */ | 136 | /* AF_UNSPEC or AF_INET or AF_INET6 */ |
138 | extern int IPv4or6; | 137 | extern int IPv4or6; |
139 | 138 | ||
140 | /* helper */ | 139 | /* helper */ |
141 | void port_open_helper(Channel *c, char *rtype); | 140 | static void port_open_helper(Channel *c, char *rtype); |
142 | 141 | ||
143 | /* -- channel core */ | 142 | /* -- channel core */ |
144 | 143 | ||
@@ -164,7 +163,7 @@ channel_lookup(int id) | |||
164 | * when the channel consumer/producer is ready, e.g. shell exec'd | 163 | * when the channel consumer/producer is ready, e.g. shell exec'd |
165 | */ | 164 | */ |
166 | 165 | ||
167 | void | 166 | static void |
168 | channel_register_fds(Channel *c, int rfd, int wfd, int efd, | 167 | channel_register_fds(Channel *c, int rfd, int wfd, int efd, |
169 | int extusage, int nonblock) | 168 | int extusage, int nonblock) |
170 | { | 169 | { |
@@ -270,7 +269,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
270 | 269 | ||
271 | /* Close all channel fd/socket. */ | 270 | /* Close all channel fd/socket. */ |
272 | 271 | ||
273 | void | 272 | static void |
274 | channel_close_fds(Channel *c) | 273 | channel_close_fds(Channel *c) |
275 | { | 274 | { |
276 | debug3("channel_close_fds: channel %d: r %d w %d e %d", | 275 | debug3("channel_close_fds: channel %d: r %d w %d e %d", |
@@ -633,20 +632,20 @@ typedef void chan_fn(Channel *c, fd_set * readset, fd_set * writeset); | |||
633 | chan_fn *channel_pre[SSH_CHANNEL_MAX_TYPE]; | 632 | chan_fn *channel_pre[SSH_CHANNEL_MAX_TYPE]; |
634 | chan_fn *channel_post[SSH_CHANNEL_MAX_TYPE]; | 633 | chan_fn *channel_post[SSH_CHANNEL_MAX_TYPE]; |
635 | 634 | ||
636 | void | 635 | static void |
637 | channel_pre_listener(Channel *c, fd_set * readset, fd_set * writeset) | 636 | channel_pre_listener(Channel *c, fd_set * readset, fd_set * writeset) |
638 | { | 637 | { |
639 | FD_SET(c->sock, readset); | 638 | FD_SET(c->sock, readset); |
640 | } | 639 | } |
641 | 640 | ||
642 | void | 641 | static void |
643 | channel_pre_connecting(Channel *c, fd_set * readset, fd_set * writeset) | 642 | channel_pre_connecting(Channel *c, fd_set * readset, fd_set * writeset) |
644 | { | 643 | { |
645 | debug3("channel %d: waiting for connection", c->self); | 644 | debug3("channel %d: waiting for connection", c->self); |
646 | FD_SET(c->sock, writeset); | 645 | FD_SET(c->sock, writeset); |
647 | } | 646 | } |
648 | 647 | ||
649 | void | 648 | static void |
650 | channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset) | 649 | channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset) |
651 | { | 650 | { |
652 | if (buffer_len(&c->input) < packet_get_maxsize()) | 651 | if (buffer_len(&c->input) < packet_get_maxsize()) |
@@ -655,7 +654,7 @@ channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset) | |||
655 | FD_SET(c->sock, writeset); | 654 | FD_SET(c->sock, writeset); |
656 | } | 655 | } |
657 | 656 | ||
658 | void | 657 | static void |
659 | channel_pre_open_15(Channel *c, fd_set * readset, fd_set * writeset) | 658 | channel_pre_open_15(Channel *c, fd_set * readset, fd_set * writeset) |
660 | { | 659 | { |
661 | /* test whether sockets are 'alive' for read/write */ | 660 | /* test whether sockets are 'alive' for read/write */ |
@@ -672,7 +671,7 @@ channel_pre_open_15(Channel *c, fd_set * readset, fd_set * writeset) | |||
672 | } | 671 | } |
673 | } | 672 | } |
674 | 673 | ||
675 | void | 674 | static void |
676 | channel_pre_open_20(Channel *c, fd_set * readset, fd_set * writeset) | 675 | channel_pre_open_20(Channel *c, fd_set * readset, fd_set * writeset) |
677 | { | 676 | { |
678 | if (c->istate == CHAN_INPUT_OPEN && | 677 | if (c->istate == CHAN_INPUT_OPEN && |
@@ -698,7 +697,7 @@ channel_pre_open_20(Channel *c, fd_set * readset, fd_set * writeset) | |||
698 | } | 697 | } |
699 | } | 698 | } |
700 | 699 | ||
701 | void | 700 | static void |
702 | channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset) | 701 | channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset) |
703 | { | 702 | { |
704 | if (buffer_len(&c->input) == 0) { | 703 | if (buffer_len(&c->input) == 0) { |
@@ -710,7 +709,7 @@ channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset) | |||
710 | } | 709 | } |
711 | } | 710 | } |
712 | 711 | ||
713 | void | 712 | static void |
714 | channel_pre_output_draining(Channel *c, fd_set * readset, fd_set * writeset) | 713 | channel_pre_output_draining(Channel *c, fd_set * readset, fd_set * writeset) |
715 | { | 714 | { |
716 | if (buffer_len(&c->output) == 0) | 715 | if (buffer_len(&c->output) == 0) |
@@ -728,7 +727,7 @@ channel_pre_output_draining(Channel *c, fd_set * readset, fd_set * writeset) | |||
728 | * XXX All this happens at the client side. | 727 | * XXX All this happens at the client side. |
729 | * Returns: 0 = need more data, -1 = wrong cookie, 1 = ok | 728 | * Returns: 0 = need more data, -1 = wrong cookie, 1 = ok |
730 | */ | 729 | */ |
731 | int | 730 | static int |
732 | x11_open_helper(Buffer *b) | 731 | x11_open_helper(Buffer *b) |
733 | { | 732 | { |
734 | u_char *ucp; | 733 | u_char *ucp; |
@@ -786,7 +785,7 @@ x11_open_helper(Buffer *b) | |||
786 | return 1; | 785 | return 1; |
787 | } | 786 | } |
788 | 787 | ||
789 | void | 788 | static void |
790 | channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) | 789 | channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) |
791 | { | 790 | { |
792 | int ret = x11_open_helper(&c->output); | 791 | int ret = x11_open_helper(&c->output); |
@@ -811,7 +810,7 @@ channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset) | |||
811 | } | 810 | } |
812 | } | 811 | } |
813 | 812 | ||
814 | void | 813 | static void |
815 | channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset) | 814 | channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset) |
816 | { | 815 | { |
817 | int ret = x11_open_helper(&c->output); | 816 | int ret = x11_open_helper(&c->output); |
@@ -830,7 +829,7 @@ channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset) | |||
830 | } | 829 | } |
831 | 830 | ||
832 | /* try to decode a socks4 header */ | 831 | /* try to decode a socks4 header */ |
833 | int | 832 | static int |
834 | channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset) | 833 | channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset) |
835 | { | 834 | { |
836 | u_char *p, *host; | 835 | u_char *p, *host; |
@@ -900,7 +899,7 @@ channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset) | |||
900 | } | 899 | } |
901 | 900 | ||
902 | /* dynamic port forwarding */ | 901 | /* dynamic port forwarding */ |
903 | void | 902 | static void |
904 | channel_pre_dynamic(Channel *c, fd_set * readset, fd_set * writeset) | 903 | channel_pre_dynamic(Channel *c, fd_set * readset, fd_set * writeset) |
905 | { | 904 | { |
906 | u_char *p; | 905 | u_char *p; |
@@ -940,7 +939,7 @@ channel_pre_dynamic(Channel *c, fd_set * readset, fd_set * writeset) | |||
940 | } | 939 | } |
941 | 940 | ||
942 | /* This is our fake X11 server socket. */ | 941 | /* This is our fake X11 server socket. */ |
943 | void | 942 | static void |
944 | channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) | 943 | channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) |
945 | { | 944 | { |
946 | Channel *nc; | 945 | Channel *nc; |
@@ -998,7 +997,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
998 | } | 997 | } |
999 | } | 998 | } |
1000 | 999 | ||
1001 | void | 1000 | static void |
1002 | port_open_helper(Channel *c, char *rtype) | 1001 | port_open_helper(Channel *c, char *rtype) |
1003 | { | 1002 | { |
1004 | int direct; | 1003 | int direct; |
@@ -1052,7 +1051,7 @@ port_open_helper(Channel *c, char *rtype) | |||
1052 | /* | 1051 | /* |
1053 | * This socket is listening for connections to a forwarded TCP/IP port. | 1052 | * This socket is listening for connections to a forwarded TCP/IP port. |
1054 | */ | 1053 | */ |
1055 | void | 1054 | static void |
1056 | channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | 1055 | channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) |
1057 | { | 1056 | { |
1058 | Channel *nc; | 1057 | Channel *nc; |
@@ -1100,7 +1099,7 @@ channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1100 | * This is the authentication agent socket listening for connections from | 1099 | * This is the authentication agent socket listening for connections from |
1101 | * clients. | 1100 | * clients. |
1102 | */ | 1101 | */ |
1103 | void | 1102 | static void |
1104 | channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | 1103 | channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) |
1105 | { | 1104 | { |
1106 | Channel *nc; | 1105 | Channel *nc; |
@@ -1140,7 +1139,7 @@ channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset) | |||
1140 | } | 1139 | } |
1141 | } | 1140 | } |
1142 | 1141 | ||
1143 | void | 1142 | static void |
1144 | channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset) | 1143 | channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset) |
1145 | { | 1144 | { |
1146 | int err = 0; | 1145 | int err = 0; |
@@ -1187,7 +1186,7 @@ channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset) | |||
1187 | } | 1186 | } |
1188 | } | 1187 | } |
1189 | 1188 | ||
1190 | int | 1189 | static int |
1191 | channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) | 1190 | channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) |
1192 | { | 1191 | { |
1193 | char buf[16*1024]; | 1192 | char buf[16*1024]; |
@@ -1225,7 +1224,7 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1225 | } | 1224 | } |
1226 | return 1; | 1225 | return 1; |
1227 | } | 1226 | } |
1228 | int | 1227 | static int |
1229 | channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | 1228 | channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) |
1230 | { | 1229 | { |
1231 | struct termios tio; | 1230 | struct termios tio; |
@@ -1273,7 +1272,7 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1273 | } | 1272 | } |
1274 | return 1; | 1273 | return 1; |
1275 | } | 1274 | } |
1276 | int | 1275 | static int |
1277 | channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) | 1276 | channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) |
1278 | { | 1277 | { |
1279 | char buf[16*1024]; | 1278 | char buf[16*1024]; |
@@ -1318,7 +1317,7 @@ channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) | |||
1318 | } | 1317 | } |
1319 | return 1; | 1318 | return 1; |
1320 | } | 1319 | } |
1321 | int | 1320 | static int |
1322 | channel_check_window(Channel *c) | 1321 | channel_check_window(Channel *c) |
1323 | { | 1322 | { |
1324 | if (c->type == SSH_CHANNEL_OPEN && | 1323 | if (c->type == SSH_CHANNEL_OPEN && |
@@ -1338,14 +1337,14 @@ channel_check_window(Channel *c) | |||
1338 | return 1; | 1337 | return 1; |
1339 | } | 1338 | } |
1340 | 1339 | ||
1341 | void | 1340 | static void |
1342 | channel_post_open_1(Channel *c, fd_set * readset, fd_set * writeset) | 1341 | channel_post_open_1(Channel *c, fd_set * readset, fd_set * writeset) |
1343 | { | 1342 | { |
1344 | channel_handle_rfd(c, readset, writeset); | 1343 | channel_handle_rfd(c, readset, writeset); |
1345 | channel_handle_wfd(c, readset, writeset); | 1344 | channel_handle_wfd(c, readset, writeset); |
1346 | } | 1345 | } |
1347 | 1346 | ||
1348 | void | 1347 | static void |
1349 | channel_post_open_2(Channel *c, fd_set * readset, fd_set * writeset) | 1348 | channel_post_open_2(Channel *c, fd_set * readset, fd_set * writeset) |
1350 | { | 1349 | { |
1351 | channel_handle_rfd(c, readset, writeset); | 1350 | channel_handle_rfd(c, readset, writeset); |
@@ -1355,7 +1354,7 @@ channel_post_open_2(Channel *c, fd_set * readset, fd_set * writeset) | |||
1355 | channel_check_window(c); | 1354 | channel_check_window(c); |
1356 | } | 1355 | } |
1357 | 1356 | ||
1358 | void | 1357 | static void |
1359 | channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset) | 1358 | channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset) |
1360 | { | 1359 | { |
1361 | int len; | 1360 | int len; |
@@ -1370,7 +1369,7 @@ channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset) | |||
1370 | } | 1369 | } |
1371 | } | 1370 | } |
1372 | 1371 | ||
1373 | void | 1372 | static void |
1374 | channel_handler_init_20(void) | 1373 | channel_handler_init_20(void) |
1375 | { | 1374 | { |
1376 | channel_pre[SSH_CHANNEL_OPEN] = &channel_pre_open_20; | 1375 | channel_pre[SSH_CHANNEL_OPEN] = &channel_pre_open_20; |
@@ -1391,7 +1390,7 @@ channel_handler_init_20(void) | |||
1391 | channel_post[SSH_CHANNEL_DYNAMIC] = &channel_post_open_2; | 1390 | channel_post[SSH_CHANNEL_DYNAMIC] = &channel_post_open_2; |
1392 | } | 1391 | } |
1393 | 1392 | ||
1394 | void | 1393 | static void |
1395 | channel_handler_init_13(void) | 1394 | channel_handler_init_13(void) |
1396 | { | 1395 | { |
1397 | channel_pre[SSH_CHANNEL_OPEN] = &channel_pre_open_13; | 1396 | channel_pre[SSH_CHANNEL_OPEN] = &channel_pre_open_13; |
@@ -1413,7 +1412,7 @@ channel_handler_init_13(void) | |||
1413 | channel_post[SSH_CHANNEL_DYNAMIC] = &channel_post_open_1; | 1412 | channel_post[SSH_CHANNEL_DYNAMIC] = &channel_post_open_1; |
1414 | } | 1413 | } |
1415 | 1414 | ||
1416 | void | 1415 | static void |
1417 | channel_handler_init_15(void) | 1416 | channel_handler_init_15(void) |
1418 | { | 1417 | { |
1419 | channel_pre[SSH_CHANNEL_OPEN] = &channel_pre_open_15; | 1418 | channel_pre[SSH_CHANNEL_OPEN] = &channel_pre_open_15; |
@@ -1432,7 +1431,7 @@ channel_handler_init_15(void) | |||
1432 | channel_post[SSH_CHANNEL_DYNAMIC] = &channel_post_open_1; | 1431 | channel_post[SSH_CHANNEL_DYNAMIC] = &channel_post_open_1; |
1433 | } | 1432 | } |
1434 | 1433 | ||
1435 | void | 1434 | static void |
1436 | channel_handler_init(void) | 1435 | channel_handler_init(void) |
1437 | { | 1436 | { |
1438 | int i; | 1437 | int i; |
@@ -1448,7 +1447,7 @@ channel_handler_init(void) | |||
1448 | channel_handler_init_15(); | 1447 | channel_handler_init_15(); |
1449 | } | 1448 | } |
1450 | 1449 | ||
1451 | void | 1450 | static void |
1452 | channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) | 1451 | channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset) |
1453 | { | 1452 | { |
1454 | static int did_init = 0; | 1453 | static int did_init = 0; |
@@ -1828,7 +1827,7 @@ channel_input_open_confirmation(int type, int plen, void *ctxt) | |||
1828 | } | 1827 | } |
1829 | } | 1828 | } |
1830 | 1829 | ||
1831 | char * | 1830 | static char * |
1832 | reason2txt(int reason) | 1831 | reason2txt(int reason) |
1833 | { | 1832 | { |
1834 | switch(reason) { | 1833 | switch(reason) { |
@@ -2220,7 +2219,7 @@ channel_clear_permitted_opens(void) | |||
2220 | 2219 | ||
2221 | 2220 | ||
2222 | /* return socket to remote host, port */ | 2221 | /* return socket to remote host, port */ |
2223 | int | 2222 | static int |
2224 | connect_to(const char *host, u_short port) | 2223 | connect_to(const char *host, u_short port) |
2225 | { | 2224 | { |
2226 | struct addrinfo hints, *ai, *aitop; | 2225 | struct addrinfo hints, *ai, *aitop; |
@@ -2455,8 +2454,7 @@ x11_create_display_inet(int screen_number, int x11_display_offset) | |||
2455 | #define X_UNIX_PATH "/tmp/.X11-unix/X" | 2454 | #define X_UNIX_PATH "/tmp/.X11-unix/X" |
2456 | #endif | 2455 | #endif |
2457 | 2456 | ||
2458 | static | 2457 | static int |
2459 | int | ||
2460 | connect_local_xsocket(u_int dnr) | 2458 | connect_local_xsocket(u_int dnr) |
2461 | { | 2459 | { |
2462 | static const char *const x_sockets[] = { | 2460 | static const char *const x_sockets[] = { |
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: cipher.c,v 1.44 2001/05/28 22:51:10 markus Exp $"); | 38 | RCSID("$OpenBSD: cipher.c,v 1.45 2001/06/23 15:12:18 itojun Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "log.h" | 41 | #include "log.h" |
@@ -43,24 +43,23 @@ RCSID("$OpenBSD: cipher.c,v 1.44 2001/05/28 22:51:10 markus Exp $"); | |||
43 | 43 | ||
44 | #include <openssl/md5.h> | 44 | #include <openssl/md5.h> |
45 | 45 | ||
46 | |||
47 | /* no encryption */ | 46 | /* no encryption */ |
48 | void | 47 | static void |
49 | none_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 48 | none_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
50 | { | 49 | { |
51 | } | 50 | } |
52 | void | 51 | static void |
53 | none_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | 52 | none_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) |
54 | { | 53 | { |
55 | } | 54 | } |
56 | void | 55 | static void |
57 | none_crypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 56 | none_crypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
58 | { | 57 | { |
59 | memcpy(dest, src, len); | 58 | memcpy(dest, src, len); |
60 | } | 59 | } |
61 | 60 | ||
62 | /* DES */ | 61 | /* DES */ |
63 | void | 62 | static void |
64 | des_ssh1_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 63 | des_ssh1_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
65 | { | 64 | { |
66 | static int dowarn = 1; | 65 | static int dowarn = 1; |
@@ -71,18 +70,18 @@ des_ssh1_setkey(CipherContext *cc, const u_char *key, u_int keylen) | |||
71 | } | 70 | } |
72 | des_set_key((void *)key, cc->u.des.key); | 71 | des_set_key((void *)key, cc->u.des.key); |
73 | } | 72 | } |
74 | void | 73 | static void |
75 | des_ssh1_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | 74 | des_ssh1_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) |
76 | { | 75 | { |
77 | memset(cc->u.des.iv, 0, sizeof(cc->u.des.iv)); | 76 | memset(cc->u.des.iv, 0, sizeof(cc->u.des.iv)); |
78 | } | 77 | } |
79 | void | 78 | static void |
80 | des_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 79 | des_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
81 | { | 80 | { |
82 | des_ncbc_encrypt(src, dest, len, cc->u.des.key, &cc->u.des.iv, | 81 | des_ncbc_encrypt(src, dest, len, cc->u.des.key, &cc->u.des.iv, |
83 | DES_ENCRYPT); | 82 | DES_ENCRYPT); |
84 | } | 83 | } |
85 | void | 84 | static void |
86 | des_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 85 | des_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
87 | { | 86 | { |
88 | des_ncbc_encrypt(src, dest, len, cc->u.des.key, &cc->u.des.iv, | 87 | des_ncbc_encrypt(src, dest, len, cc->u.des.key, &cc->u.des.iv, |
@@ -90,14 +89,14 @@ des_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | |||
90 | } | 89 | } |
91 | 90 | ||
92 | /* 3DES */ | 91 | /* 3DES */ |
93 | void | 92 | static void |
94 | des3_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 93 | des3_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
95 | { | 94 | { |
96 | des_set_key((void *) key, cc->u.des3.key1); | 95 | des_set_key((void *) key, cc->u.des3.key1); |
97 | des_set_key((void *) (key+8), cc->u.des3.key2); | 96 | des_set_key((void *) (key+8), cc->u.des3.key2); |
98 | des_set_key((void *) (key+16), cc->u.des3.key3); | 97 | des_set_key((void *) (key+16), cc->u.des3.key3); |
99 | } | 98 | } |
100 | void | 99 | static void |
101 | des3_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | 100 | des3_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) |
102 | { | 101 | { |
103 | memset(cc->u.des3.iv1, 0, sizeof(cc->u.des3.iv1)); | 102 | memset(cc->u.des3.iv1, 0, sizeof(cc->u.des3.iv1)); |
@@ -107,14 +106,14 @@ des3_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | |||
107 | return; | 106 | return; |
108 | memcpy(cc->u.des3.iv3, (char *)iv, 8); | 107 | memcpy(cc->u.des3.iv3, (char *)iv, 8); |
109 | } | 108 | } |
110 | void | 109 | static void |
111 | des3_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 110 | des3_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
112 | { | 111 | { |
113 | des_ede3_cbc_encrypt(src, dest, len, | 112 | des_ede3_cbc_encrypt(src, dest, len, |
114 | cc->u.des3.key1, cc->u.des3.key2, cc->u.des3.key3, | 113 | cc->u.des3.key1, cc->u.des3.key2, cc->u.des3.key3, |
115 | &cc->u.des3.iv3, DES_ENCRYPT); | 114 | &cc->u.des3.iv3, DES_ENCRYPT); |
116 | } | 115 | } |
117 | void | 116 | static void |
118 | des3_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 117 | des3_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
119 | { | 118 | { |
120 | des_ede3_cbc_encrypt(src, dest, len, | 119 | des_ede3_cbc_encrypt(src, dest, len, |
@@ -136,7 +135,7 @@ des3_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | |||
136 | * result of that there is no longer any known iv1 to use when | 135 | * result of that there is no longer any known iv1 to use when |
137 | * choosing the X block. | 136 | * choosing the X block. |
138 | */ | 137 | */ |
139 | void | 138 | static void |
140 | des3_ssh1_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 139 | des3_ssh1_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
141 | { | 140 | { |
142 | des_set_key((void *) key, cc->u.des3.key1); | 141 | des_set_key((void *) key, cc->u.des3.key1); |
@@ -146,7 +145,7 @@ des3_ssh1_setkey(CipherContext *cc, const u_char *key, u_int keylen) | |||
146 | else | 145 | else |
147 | des_set_key((void *) (key+16), cc->u.des3.key3); | 146 | des_set_key((void *) (key+16), cc->u.des3.key3); |
148 | } | 147 | } |
149 | void | 148 | static void |
150 | des3_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, | 149 | des3_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, |
151 | u_int len) | 150 | u_int len) |
152 | { | 151 | { |
@@ -157,7 +156,7 @@ des3_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, | |||
157 | des_ncbc_encrypt(dest, dest, len, cc->u.des3.key3, &cc->u.des3.iv3, | 156 | des_ncbc_encrypt(dest, dest, len, cc->u.des3.key3, &cc->u.des3.iv3, |
158 | DES_ENCRYPT); | 157 | DES_ENCRYPT); |
159 | } | 158 | } |
160 | void | 159 | static void |
161 | des3_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, | 160 | des3_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, |
162 | u_int len) | 161 | u_int len) |
163 | { | 162 | { |
@@ -170,12 +169,12 @@ des3_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, | |||
170 | } | 169 | } |
171 | 170 | ||
172 | /* Blowfish */ | 171 | /* Blowfish */ |
173 | void | 172 | static void |
174 | blowfish_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 173 | blowfish_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
175 | { | 174 | { |
176 | BF_set_key(&cc->u.bf.key, keylen, (u_char *)key); | 175 | BF_set_key(&cc->u.bf.key, keylen, (u_char *)key); |
177 | } | 176 | } |
178 | void | 177 | static void |
179 | blowfish_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | 178 | blowfish_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) |
180 | { | 179 | { |
181 | if (iv == NULL) | 180 | if (iv == NULL) |
@@ -183,14 +182,14 @@ blowfish_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | |||
183 | else | 182 | else |
184 | memcpy(cc->u.bf.iv, (char *)iv, 8); | 183 | memcpy(cc->u.bf.iv, (char *)iv, 8); |
185 | } | 184 | } |
186 | void | 185 | static void |
187 | blowfish_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, | 186 | blowfish_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, |
188 | u_int len) | 187 | u_int len) |
189 | { | 188 | { |
190 | BF_cbc_encrypt((void *)src, dest, len, &cc->u.bf.key, cc->u.bf.iv, | 189 | BF_cbc_encrypt((void *)src, dest, len, &cc->u.bf.key, cc->u.bf.iv, |
191 | BF_ENCRYPT); | 190 | BF_ENCRYPT); |
192 | } | 191 | } |
193 | void | 192 | static void |
194 | blowfish_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, | 193 | blowfish_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, |
195 | u_int len) | 194 | u_int len) |
196 | { | 195 | { |
@@ -221,7 +220,7 @@ swap_bytes(const u_char *src, u_char *dst, int n) | |||
221 | } | 220 | } |
222 | } | 221 | } |
223 | 222 | ||
224 | void | 223 | static void |
225 | blowfish_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, | 224 | blowfish_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, |
226 | u_int len) | 225 | u_int len) |
227 | { | 226 | { |
@@ -230,7 +229,7 @@ blowfish_ssh1_encrypt(CipherContext *cc, u_char *dest, const u_char *src, | |||
230 | BF_ENCRYPT); | 229 | BF_ENCRYPT); |
231 | swap_bytes(dest, dest, len); | 230 | swap_bytes(dest, dest, len); |
232 | } | 231 | } |
233 | void | 232 | static void |
234 | blowfish_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, | 233 | blowfish_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, |
235 | u_int len) | 234 | u_int len) |
236 | { | 235 | { |
@@ -241,37 +240,37 @@ blowfish_ssh1_decrypt(CipherContext *cc, u_char *dest, const u_char *src, | |||
241 | } | 240 | } |
242 | 241 | ||
243 | /* alleged rc4 */ | 242 | /* alleged rc4 */ |
244 | void | 243 | static void |
245 | arcfour_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 244 | arcfour_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
246 | { | 245 | { |
247 | RC4_set_key(&cc->u.rc4, keylen, (u_char *)key); | 246 | RC4_set_key(&cc->u.rc4, keylen, (u_char *)key); |
248 | } | 247 | } |
249 | void | 248 | static void |
250 | arcfour_crypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 249 | arcfour_crypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
251 | { | 250 | { |
252 | RC4(&cc->u.rc4, len, (u_char *)src, dest); | 251 | RC4(&cc->u.rc4, len, (u_char *)src, dest); |
253 | } | 252 | } |
254 | 253 | ||
255 | /* CAST */ | 254 | /* CAST */ |
256 | void | 255 | static void |
257 | cast_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 256 | cast_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
258 | { | 257 | { |
259 | CAST_set_key(&cc->u.cast.key, keylen, (u_char *) key); | 258 | CAST_set_key(&cc->u.cast.key, keylen, (u_char *) key); |
260 | } | 259 | } |
261 | void | 260 | static void |
262 | cast_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | 261 | cast_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) |
263 | { | 262 | { |
264 | if (iv == NULL) | 263 | if (iv == NULL) |
265 | fatal("no IV for %s.", cc->cipher->name); | 264 | fatal("no IV for %s.", cc->cipher->name); |
266 | memcpy(cc->u.cast.iv, (char *)iv, 8); | 265 | memcpy(cc->u.cast.iv, (char *)iv, 8); |
267 | } | 266 | } |
268 | void | 267 | static void |
269 | cast_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 268 | cast_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
270 | { | 269 | { |
271 | CAST_cbc_encrypt(src, dest, len, &cc->u.cast.key, cc->u.cast.iv, | 270 | CAST_cbc_encrypt(src, dest, len, &cc->u.cast.key, cc->u.cast.iv, |
272 | CAST_ENCRYPT); | 271 | CAST_ENCRYPT); |
273 | } | 272 | } |
274 | void | 273 | static void |
275 | cast_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | 274 | cast_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) |
276 | { | 275 | { |
277 | CAST_cbc_encrypt(src, dest, len, &cc->u.cast.key, cc->u.cast.iv, | 276 | CAST_cbc_encrypt(src, dest, len, &cc->u.cast.key, cc->u.cast.iv, |
@@ -281,20 +280,20 @@ cast_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | |||
281 | /* RIJNDAEL */ | 280 | /* RIJNDAEL */ |
282 | 281 | ||
283 | #define RIJNDAEL_BLOCKSIZE 16 | 282 | #define RIJNDAEL_BLOCKSIZE 16 |
284 | void | 283 | static void |
285 | rijndael_setkey(CipherContext *cc, const u_char *key, u_int keylen) | 284 | rijndael_setkey(CipherContext *cc, const u_char *key, u_int keylen) |
286 | { | 285 | { |
287 | rijndael_set_key(&cc->u.rijndael.enc, (u4byte *)key, 8*keylen, 1); | 286 | rijndael_set_key(&cc->u.rijndael.enc, (u4byte *)key, 8*keylen, 1); |
288 | rijndael_set_key(&cc->u.rijndael.dec, (u4byte *)key, 8*keylen, 0); | 287 | rijndael_set_key(&cc->u.rijndael.dec, (u4byte *)key, 8*keylen, 0); |
289 | } | 288 | } |
290 | void | 289 | static void |
291 | rijndael_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) | 290 | rijndael_setiv(CipherContext *cc, const u_char *iv, u_int ivlen) |
292 | { | 291 | { |
293 | if (iv == NULL) | 292 | if (iv == NULL) |
294 | fatal("no IV for %s.", cc->cipher->name); | 293 | fatal("no IV for %s.", cc->cipher->name); |
295 | memcpy((u_char *)cc->u.rijndael.iv, iv, RIJNDAEL_BLOCKSIZE); | 294 | memcpy((u_char *)cc->u.rijndael.iv, iv, RIJNDAEL_BLOCKSIZE); |
296 | } | 295 | } |
297 | void | 296 | static void |
298 | rijndael_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, | 297 | rijndael_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, |
299 | u_int len) | 298 | u_int len) |
300 | { | 299 | { |
@@ -321,7 +320,7 @@ rijndael_cbc_encrypt(CipherContext *cc, u_char *dest, const u_char *src, | |||
321 | memcpy(iv, cprev, RIJNDAEL_BLOCKSIZE); | 320 | memcpy(iv, cprev, RIJNDAEL_BLOCKSIZE); |
322 | } | 321 | } |
323 | 322 | ||
324 | void | 323 | static void |
325 | rijndael_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, | 324 | rijndael_cbc_decrypt(CipherContext *cc, u_char *dest, const u_char *src, |
326 | u_int len) | 325 | u_int len) |
327 | { | 326 | { |
diff --git a/clientloop.c b/clientloop.c index a62a71131..c96aea56f 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -59,7 +59,7 @@ | |||
59 | */ | 59 | */ |
60 | 60 | ||
61 | #include "includes.h" | 61 | #include "includes.h" |
62 | RCSID("$OpenBSD: clientloop.c,v 1.76 2001/06/20 13:56:39 markus Exp $"); | 62 | RCSID("$OpenBSD: clientloop.c,v 1.77 2001/06/23 15:12:18 itojun Exp $"); |
63 | 63 | ||
64 | #include "ssh.h" | 64 | #include "ssh.h" |
65 | #include "ssh1.h" | 65 | #include "ssh1.h" |
@@ -124,7 +124,7 @@ static int connection_out; /* Connection to server (output). */ | |||
124 | static int need_rekeying; /* Set to non-zero if rekeying is requested. */ | 124 | static int need_rekeying; /* Set to non-zero if rekeying is requested. */ |
125 | static int session_closed = 0; /* In SSH2: login session closed. */ | 125 | static int session_closed = 0; /* In SSH2: login session closed. */ |
126 | 126 | ||
127 | void client_init_dispatch(void); | 127 | static void client_init_dispatch(void); |
128 | int session_ident = -1; | 128 | int session_ident = -1; |
129 | 129 | ||
130 | /*XXX*/ | 130 | /*XXX*/ |
@@ -132,7 +132,7 @@ extern Kex *xxx_kex; | |||
132 | 132 | ||
133 | /* Restores stdin to blocking mode. */ | 133 | /* Restores stdin to blocking mode. */ |
134 | 134 | ||
135 | void | 135 | static void |
136 | leave_non_blocking(void) | 136 | leave_non_blocking(void) |
137 | { | 137 | { |
138 | if (in_non_blocking_mode) { | 138 | if (in_non_blocking_mode) { |
@@ -144,7 +144,7 @@ leave_non_blocking(void) | |||
144 | 144 | ||
145 | /* Puts stdin terminal in non-blocking mode. */ | 145 | /* Puts stdin terminal in non-blocking mode. */ |
146 | 146 | ||
147 | void | 147 | static void |
148 | enter_non_blocking(void) | 148 | enter_non_blocking(void) |
149 | { | 149 | { |
150 | in_non_blocking_mode = 1; | 150 | in_non_blocking_mode = 1; |
@@ -157,7 +157,7 @@ enter_non_blocking(void) | |||
157 | * flag indicating that the window has changed. | 157 | * flag indicating that the window has changed. |
158 | */ | 158 | */ |
159 | 159 | ||
160 | void | 160 | static void |
161 | window_change_handler(int sig) | 161 | window_change_handler(int sig) |
162 | { | 162 | { |
163 | received_window_change_signal = 1; | 163 | received_window_change_signal = 1; |
@@ -169,7 +169,7 @@ window_change_handler(int sig) | |||
169 | * signals must be trapped to restore terminal modes. | 169 | * signals must be trapped to restore terminal modes. |
170 | */ | 170 | */ |
171 | 171 | ||
172 | void | 172 | static void |
173 | signal_handler(int sig) | 173 | signal_handler(int sig) |
174 | { | 174 | { |
175 | received_signal = sig; | 175 | received_signal = sig; |
@@ -181,7 +181,7 @@ signal_handler(int sig) | |||
181 | * available resolution. | 181 | * available resolution. |
182 | */ | 182 | */ |
183 | 183 | ||
184 | double | 184 | static double |
185 | get_current_time(void) | 185 | get_current_time(void) |
186 | { | 186 | { |
187 | struct timeval tv; | 187 | struct timeval tv; |
@@ -195,7 +195,7 @@ get_current_time(void) | |||
195 | * not appear to wake up when redirecting from /dev/null. | 195 | * not appear to wake up when redirecting from /dev/null. |
196 | */ | 196 | */ |
197 | 197 | ||
198 | void | 198 | static void |
199 | client_check_initial_eof_on_stdin(void) | 199 | client_check_initial_eof_on_stdin(void) |
200 | { | 200 | { |
201 | int len; | 201 | int len; |
@@ -247,7 +247,7 @@ client_check_initial_eof_on_stdin(void) | |||
247 | * connection. | 247 | * connection. |
248 | */ | 248 | */ |
249 | 249 | ||
250 | void | 250 | static void |
251 | client_make_packets_from_stdin_data(void) | 251 | client_make_packets_from_stdin_data(void) |
252 | { | 252 | { |
253 | u_int len; | 253 | u_int len; |
@@ -279,7 +279,7 @@ client_make_packets_from_stdin_data(void) | |||
279 | * appropriate. | 279 | * appropriate. |
280 | */ | 280 | */ |
281 | 281 | ||
282 | void | 282 | static void |
283 | client_check_window_change(void) | 283 | client_check_window_change(void) |
284 | { | 284 | { |
285 | struct winsize ws; | 285 | struct winsize ws; |
@@ -316,7 +316,7 @@ client_check_window_change(void) | |||
316 | * one of the file descriptors). | 316 | * one of the file descriptors). |
317 | */ | 317 | */ |
318 | 318 | ||
319 | void | 319 | static void |
320 | client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, | 320 | client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, |
321 | int *maxfdp, int rekeying) | 321 | int *maxfdp, int rekeying) |
322 | { | 322 | { |
@@ -384,7 +384,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, | |||
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | void | 387 | static void |
388 | client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) | 388 | client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) |
389 | { | 389 | { |
390 | struct winsize oldws, newws; | 390 | struct winsize oldws, newws; |
@@ -427,7 +427,7 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) | |||
427 | enter_raw_mode(); | 427 | enter_raw_mode(); |
428 | } | 428 | } |
429 | 429 | ||
430 | void | 430 | static void |
431 | client_process_net_input(fd_set * readset) | 431 | client_process_net_input(fd_set * readset) |
432 | { | 432 | { |
433 | int len; | 433 | int len; |
@@ -468,7 +468,7 @@ client_process_net_input(fd_set * readset) | |||
468 | } | 468 | } |
469 | 469 | ||
470 | /* process the characters one by one */ | 470 | /* process the characters one by one */ |
471 | int | 471 | static int |
472 | process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) | 472 | process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len) |
473 | { | 473 | { |
474 | char string[1024]; | 474 | char string[1024]; |
@@ -618,7 +618,7 @@ Supported escape sequences:\r\n\ | |||
618 | return bytes; | 618 | return bytes; |
619 | } | 619 | } |
620 | 620 | ||
621 | void | 621 | static void |
622 | client_process_input(fd_set * readset) | 622 | client_process_input(fd_set * readset) |
623 | { | 623 | { |
624 | int len; | 624 | int len; |
@@ -671,7 +671,7 @@ client_process_input(fd_set * readset) | |||
671 | } | 671 | } |
672 | } | 672 | } |
673 | 673 | ||
674 | void | 674 | static void |
675 | client_process_output(fd_set * writeset) | 675 | client_process_output(fd_set * writeset) |
676 | { | 676 | { |
677 | int len; | 677 | int len; |
@@ -732,7 +732,7 @@ client_process_output(fd_set * writeset) | |||
732 | * preparatory phase. | 732 | * preparatory phase. |
733 | */ | 733 | */ |
734 | 734 | ||
735 | void | 735 | static void |
736 | client_process_buffered_input_packets(void) | 736 | client_process_buffered_input_packets(void) |
737 | { | 737 | { |
738 | dispatch_run(DISPATCH_NONBLOCK, &quit_pending, compat20 ? xxx_kex : NULL); | 738 | dispatch_run(DISPATCH_NONBLOCK, &quit_pending, compat20 ? xxx_kex : NULL); |
@@ -740,14 +740,14 @@ client_process_buffered_input_packets(void) | |||
740 | 740 | ||
741 | /* scan buf[] for '~' before sending data to the peer */ | 741 | /* scan buf[] for '~' before sending data to the peer */ |
742 | 742 | ||
743 | int | 743 | static int |
744 | simple_escape_filter(Channel *c, char *buf, int len) | 744 | simple_escape_filter(Channel *c, char *buf, int len) |
745 | { | 745 | { |
746 | /* XXX we assume c->extended is writeable */ | 746 | /* XXX we assume c->extended is writeable */ |
747 | return process_escapes(&c->input, &c->output, &c->extended, buf, len); | 747 | return process_escapes(&c->input, &c->output, &c->extended, buf, len); |
748 | } | 748 | } |
749 | 749 | ||
750 | void | 750 | static void |
751 | client_channel_closed(int id, void *arg) | 751 | client_channel_closed(int id, void *arg) |
752 | { | 752 | { |
753 | if (id != session_ident) | 753 | if (id != session_ident) |
@@ -1000,7 +1000,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1000 | 1000 | ||
1001 | /*********/ | 1001 | /*********/ |
1002 | 1002 | ||
1003 | void | 1003 | static void |
1004 | client_input_stdout_data(int type, int plen, void *ctxt) | 1004 | client_input_stdout_data(int type, int plen, void *ctxt) |
1005 | { | 1005 | { |
1006 | u_int data_len; | 1006 | u_int data_len; |
@@ -1010,7 +1010,7 @@ client_input_stdout_data(int type, int plen, void *ctxt) | |||
1010 | memset(data, 0, data_len); | 1010 | memset(data, 0, data_len); |
1011 | xfree(data); | 1011 | xfree(data); |
1012 | } | 1012 | } |
1013 | void | 1013 | static void |
1014 | client_input_stderr_data(int type, int plen, void *ctxt) | 1014 | client_input_stderr_data(int type, int plen, void *ctxt) |
1015 | { | 1015 | { |
1016 | u_int data_len; | 1016 | u_int data_len; |
@@ -1020,7 +1020,7 @@ client_input_stderr_data(int type, int plen, void *ctxt) | |||
1020 | memset(data, 0, data_len); | 1020 | memset(data, 0, data_len); |
1021 | xfree(data); | 1021 | xfree(data); |
1022 | } | 1022 | } |
1023 | void | 1023 | static void |
1024 | client_input_exit_status(int type, int plen, void *ctxt) | 1024 | client_input_exit_status(int type, int plen, void *ctxt) |
1025 | { | 1025 | { |
1026 | packet_integrity_check(plen, 4, type); | 1026 | packet_integrity_check(plen, 4, type); |
@@ -1037,7 +1037,7 @@ client_input_exit_status(int type, int plen, void *ctxt) | |||
1037 | quit_pending = 1; | 1037 | quit_pending = 1; |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | Channel * | 1040 | static Channel * |
1041 | client_request_forwarded_tcpip(const char *request_type, int rchan) | 1041 | client_request_forwarded_tcpip(const char *request_type, int rchan) |
1042 | { | 1042 | { |
1043 | Channel* c = NULL; | 1043 | Channel* c = NULL; |
@@ -1074,7 +1074,7 @@ client_request_forwarded_tcpip(const char *request_type, int rchan) | |||
1074 | return c; | 1074 | return c; |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | Channel* | 1077 | static Channel* |
1078 | client_request_x11(const char *request_type, int rchan) | 1078 | client_request_x11(const char *request_type, int rchan) |
1079 | { | 1079 | { |
1080 | Channel *c = NULL; | 1080 | Channel *c = NULL; |
@@ -1113,7 +1113,7 @@ client_request_x11(const char *request_type, int rchan) | |||
1113 | return c; | 1113 | return c; |
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | Channel* | 1116 | static Channel* |
1117 | client_request_agent(const char *request_type, int rchan) | 1117 | client_request_agent(const char *request_type, int rchan) |
1118 | { | 1118 | { |
1119 | Channel *c = NULL; | 1119 | Channel *c = NULL; |
@@ -1139,7 +1139,7 @@ client_request_agent(const char *request_type, int rchan) | |||
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | /* XXXX move to generic input handler */ | 1141 | /* XXXX move to generic input handler */ |
1142 | void | 1142 | static void |
1143 | client_input_channel_open(int type, int plen, void *ctxt) | 1143 | client_input_channel_open(int type, int plen, void *ctxt) |
1144 | { | 1144 | { |
1145 | Channel *c = NULL; | 1145 | Channel *c = NULL; |
@@ -1191,7 +1191,7 @@ client_input_channel_open(int type, int plen, void *ctxt) | |||
1191 | } | 1191 | } |
1192 | xfree(ctype); | 1192 | xfree(ctype); |
1193 | } | 1193 | } |
1194 | void | 1194 | static void |
1195 | client_input_channel_req(int type, int plen, void *ctxt) | 1195 | client_input_channel_req(int type, int plen, void *ctxt) |
1196 | { | 1196 | { |
1197 | Channel *c = NULL; | 1197 | Channel *c = NULL; |
@@ -1228,7 +1228,7 @@ client_input_channel_req(int type, int plen, void *ctxt) | |||
1228 | xfree(rtype); | 1228 | xfree(rtype); |
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | void | 1231 | static void |
1232 | client_init_dispatch_20(void) | 1232 | client_init_dispatch_20(void) |
1233 | { | 1233 | { |
1234 | dispatch_init(&dispatch_protocol_error); | 1234 | dispatch_init(&dispatch_protocol_error); |
@@ -1245,7 +1245,7 @@ client_init_dispatch_20(void) | |||
1245 | /* rekeying */ | 1245 | /* rekeying */ |
1246 | dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); | 1246 | dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); |
1247 | } | 1247 | } |
1248 | void | 1248 | static void |
1249 | client_init_dispatch_13(void) | 1249 | client_init_dispatch_13(void) |
1250 | { | 1250 | { |
1251 | dispatch_init(NULL); | 1251 | dispatch_init(NULL); |
@@ -1264,7 +1264,7 @@ client_init_dispatch_13(void) | |||
1264 | dispatch_set(SSH_SMSG_X11_OPEN, options.forward_x11 ? | 1264 | dispatch_set(SSH_SMSG_X11_OPEN, options.forward_x11 ? |
1265 | &x11_input_open : &deny_input_open); | 1265 | &x11_input_open : &deny_input_open); |
1266 | } | 1266 | } |
1267 | void | 1267 | static void |
1268 | client_init_dispatch_15(void) | 1268 | client_init_dispatch_15(void) |
1269 | { | 1269 | { |
1270 | client_init_dispatch_13(); | 1270 | client_init_dispatch_13(); |
diff --git a/deattack.c b/deattack.c index 36023e0d3..1a89be4b8 100644 --- a/deattack.c +++ b/deattack.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: deattack.c,v 1.13 2001/03/01 02:45:10 deraadt Exp $ */ | 1 | /* $OpenBSD: deattack.c,v 1.14 2001/06/23 15:12:18 itojun Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Cryptographic attack detector for ssh - source code | 4 | * Cryptographic attack detector for ssh - source code |
@@ -46,8 +46,7 @@ | |||
46 | 46 | ||
47 | #define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE)) | 47 | #define CMP(a, b) (memcmp(a, b, SSH_BLOCKSIZE)) |
48 | 48 | ||
49 | 49 | static void | |
50 | void | ||
51 | crc_update(u_int32_t *a, u_int32_t b) | 50 | crc_update(u_int32_t *a, u_int32_t b) |
52 | { | 51 | { |
53 | b ^= *a; | 52 | b ^= *a; |
@@ -55,7 +54,7 @@ crc_update(u_int32_t *a, u_int32_t b) | |||
55 | } | 54 | } |
56 | 55 | ||
57 | /* detect if a block is used in a particular pattern */ | 56 | /* detect if a block is used in a particular pattern */ |
58 | int | 57 | static int |
59 | check_crc(u_char *S, u_char *buf, u_int32_t len, | 58 | check_crc(u_char *S, u_char *buf, u_int32_t len, |
60 | u_char *IV) | 59 | u_char *IV) |
61 | { | 60 | { |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: dh.c,v 1.16 2001/06/22 21:57:59 provos Exp $"); | 26 | RCSID("$OpenBSD: dh.c,v 1.17 2001/06/23 15:12:18 itojun Exp $"); |
27 | 27 | ||
28 | #include "xmalloc.h" | 28 | #include "xmalloc.h" |
29 | 29 | ||
@@ -39,7 +39,7 @@ RCSID("$OpenBSD: dh.c,v 1.16 2001/06/22 21:57:59 provos Exp $"); | |||
39 | #include "log.h" | 39 | #include "log.h" |
40 | #include "misc.h" | 40 | #include "misc.h" |
41 | 41 | ||
42 | int | 42 | static int |
43 | parse_prime(int linenum, char *line, struct dhgroup *dhg) | 43 | parse_prime(int linenum, char *line, struct dhgroup *dhg) |
44 | { | 44 | { |
45 | char *cp, *arg; | 45 | char *cp, *arg; |
diff --git a/hostfile.c b/hostfile.c index d532bd6ad..39a1a8313 100644 --- a/hostfile.c +++ b/hostfile.c | |||
@@ -36,7 +36,7 @@ | |||
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "includes.h" | 38 | #include "includes.h" |
39 | RCSID("$OpenBSD: hostfile.c,v 1.26 2001/04/12 19:15:24 markus Exp $"); | 39 | RCSID("$OpenBSD: hostfile.c,v 1.27 2001/06/23 15:12:18 itojun Exp $"); |
40 | 40 | ||
41 | #include "packet.h" | 41 | #include "packet.h" |
42 | #include "match.h" | 42 | #include "match.h" |
@@ -49,7 +49,7 @@ RCSID("$OpenBSD: hostfile.c,v 1.26 2001/04/12 19:15:24 markus Exp $"); | |||
49 | * pointer over the key. Skips any whitespace at the beginning and at end. | 49 | * pointer over the key. Skips any whitespace at the beginning and at end. |
50 | */ | 50 | */ |
51 | 51 | ||
52 | int | 52 | static int |
53 | hostfile_read_key(char **cpp, u_int *bitsp, Key *ret) | 53 | hostfile_read_key(char **cpp, u_int *bitsp, Key *ret) |
54 | { | 54 | { |
55 | char *cp; | 55 | char *cp; |
@@ -82,7 +82,7 @@ auth_rsa_read_key(char **cpp, u_int *bitsp, BIGNUM * e, BIGNUM * n) | |||
82 | return ret; | 82 | return ret; |
83 | } | 83 | } |
84 | 84 | ||
85 | int | 85 | static int |
86 | hostfile_check_key(int bits, Key *key, const char *host, const char *filename, int linenum) | 86 | hostfile_check_key(int bits, Key *key, const char *host, const char *filename, int linenum) |
87 | { | 87 | { |
88 | if (key == NULL || key->type != KEY_RSA1 || key->rsa == NULL) | 88 | if (key == NULL || key->type != KEY_RSA1 || key->rsa == NULL) |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: kex.c,v 1.34 2001/04/30 15:50:46 markus Exp $"); | 26 | RCSID("$OpenBSD: kex.c,v 1.35 2001/06/23 15:12:18 itojun Exp $"); |
27 | 27 | ||
28 | #include <openssl/crypto.h> | 28 | #include <openssl/crypto.h> |
29 | 29 | ||
@@ -43,11 +43,12 @@ RCSID("$OpenBSD: kex.c,v 1.34 2001/04/30 15:50:46 markus Exp $"); | |||
43 | 43 | ||
44 | #define KEX_COOKIE_LEN 16 | 44 | #define KEX_COOKIE_LEN 16 |
45 | 45 | ||
46 | void kex_kexinit_finish(Kex *kex); | 46 | /* prototype */ |
47 | void kex_choose_conf(Kex *k); | 47 | static void kex_kexinit_finish(Kex *); |
48 | static void kex_choose_conf(Kex *); | ||
48 | 49 | ||
49 | /* put algorithm proposal into buffer */ | 50 | /* put algorithm proposal into buffer */ |
50 | void | 51 | static void |
51 | kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) | 52 | kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) |
52 | { | 53 | { |
53 | u_int32_t rand = 0; | 54 | u_int32_t rand = 0; |
@@ -67,7 +68,7 @@ kex_prop2buf(Buffer *b, char *proposal[PROPOSAL_MAX]) | |||
67 | } | 68 | } |
68 | 69 | ||
69 | /* parse buffer and return algorithm proposal */ | 70 | /* parse buffer and return algorithm proposal */ |
70 | char ** | 71 | static char ** |
71 | kex_buf2prop(Buffer *raw) | 72 | kex_buf2prop(Buffer *raw) |
72 | { | 73 | { |
73 | Buffer b; | 74 | Buffer b; |
@@ -95,7 +96,7 @@ kex_buf2prop(Buffer *raw) | |||
95 | return proposal; | 96 | return proposal; |
96 | } | 97 | } |
97 | 98 | ||
98 | void | 99 | static void |
99 | kex_prop_free(char **proposal) | 100 | kex_prop_free(char **proposal) |
100 | { | 101 | { |
101 | int i; | 102 | int i; |
@@ -105,13 +106,13 @@ kex_prop_free(char **proposal) | |||
105 | xfree(proposal); | 106 | xfree(proposal); |
106 | } | 107 | } |
107 | 108 | ||
108 | void | 109 | static void |
109 | kex_protocol_error(int type, int plen, void *ctxt) | 110 | kex_protocol_error(int type, int plen, void *ctxt) |
110 | { | 111 | { |
111 | error("Hm, kex protocol error: type %d plen %d", type, plen); | 112 | error("Hm, kex protocol error: type %d plen %d", type, plen); |
112 | } | 113 | } |
113 | 114 | ||
114 | void | 115 | static void |
115 | kex_clear_dispatch(void) | 116 | kex_clear_dispatch(void) |
116 | { | 117 | { |
117 | int i; | 118 | int i; |
@@ -210,7 +211,7 @@ kex_setup(char *proposal[PROPOSAL_MAX]) | |||
210 | return kex; | 211 | return kex; |
211 | } | 212 | } |
212 | 213 | ||
213 | void | 214 | static void |
214 | kex_kexinit_finish(Kex *kex) | 215 | kex_kexinit_finish(Kex *kex) |
215 | { | 216 | { |
216 | if (!(kex->flags & KEX_INIT_SENT)) | 217 | if (!(kex->flags & KEX_INIT_SENT)) |
@@ -230,7 +231,7 @@ kex_kexinit_finish(Kex *kex) | |||
230 | } | 231 | } |
231 | } | 232 | } |
232 | 233 | ||
233 | void | 234 | static void |
234 | choose_enc(Enc *enc, char *client, char *server) | 235 | choose_enc(Enc *enc, char *client, char *server) |
235 | { | 236 | { |
236 | char *name = match_list(client, server, NULL); | 237 | char *name = match_list(client, server, NULL); |
@@ -244,7 +245,7 @@ choose_enc(Enc *enc, char *client, char *server) | |||
244 | enc->iv = NULL; | 245 | enc->iv = NULL; |
245 | enc->key = NULL; | 246 | enc->key = NULL; |
246 | } | 247 | } |
247 | void | 248 | static void |
248 | choose_mac(Mac *mac, char *client, char *server) | 249 | choose_mac(Mac *mac, char *client, char *server) |
249 | { | 250 | { |
250 | char *name = match_list(client, server, NULL); | 251 | char *name = match_list(client, server, NULL); |
@@ -259,7 +260,7 @@ choose_mac(Mac *mac, char *client, char *server) | |||
259 | mac->key = NULL; | 260 | mac->key = NULL; |
260 | mac->enabled = 0; | 261 | mac->enabled = 0; |
261 | } | 262 | } |
262 | void | 263 | static void |
263 | choose_comp(Comp *comp, char *client, char *server) | 264 | choose_comp(Comp *comp, char *client, char *server) |
264 | { | 265 | { |
265 | char *name = match_list(client, server, NULL); | 266 | char *name = match_list(client, server, NULL); |
@@ -274,7 +275,7 @@ choose_comp(Comp *comp, char *client, char *server) | |||
274 | } | 275 | } |
275 | comp->name = name; | 276 | comp->name = name; |
276 | } | 277 | } |
277 | void | 278 | static void |
278 | choose_kex(Kex *k, char *client, char *server) | 279 | choose_kex(Kex *k, char *client, char *server) |
279 | { | 280 | { |
280 | k->name = match_list(client, server, NULL); | 281 | k->name = match_list(client, server, NULL); |
@@ -287,7 +288,7 @@ choose_kex(Kex *k, char *client, char *server) | |||
287 | } else | 288 | } else |
288 | fatal("bad kex alg %s", k->name); | 289 | fatal("bad kex alg %s", k->name); |
289 | } | 290 | } |
290 | void | 291 | static void |
291 | choose_hostkeyalg(Kex *k, char *client, char *server) | 292 | choose_hostkeyalg(Kex *k, char *client, char *server) |
292 | { | 293 | { |
293 | char *hostkeyalg = match_list(client, server, NULL); | 294 | char *hostkeyalg = match_list(client, server, NULL); |
@@ -299,7 +300,7 @@ choose_hostkeyalg(Kex *k, char *client, char *server) | |||
299 | xfree(hostkeyalg); | 300 | xfree(hostkeyalg); |
300 | } | 301 | } |
301 | 302 | ||
302 | void | 303 | static void |
303 | kex_choose_conf(Kex *kex) | 304 | kex_choose_conf(Kex *kex) |
304 | { | 305 | { |
305 | Newkeys *newkeys; | 306 | Newkeys *newkeys; |
@@ -359,7 +360,7 @@ kex_choose_conf(Kex *kex) | |||
359 | kex_prop_free(peer); | 360 | kex_prop_free(peer); |
360 | } | 361 | } |
361 | 362 | ||
362 | u_char * | 363 | static u_char * |
363 | derive_key(Kex *kex, int id, int need, u_char *hash, BIGNUM *shared_secret) | 364 | derive_key(Kex *kex, int id, int need, u_char *hash, BIGNUM *shared_secret) |
364 | { | 365 | { |
365 | Buffer b; | 366 | Buffer b; |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: kexdh.c,v 1.5 2001/06/23 02:34:29 markus Exp $"); | 26 | RCSID("$OpenBSD: kexdh.c,v 1.6 2001/06/23 15:12:18 itojun Exp $"); |
27 | 27 | ||
28 | #include <openssl/crypto.h> | 28 | #include <openssl/crypto.h> |
29 | #include <openssl/bn.h> | 29 | #include <openssl/bn.h> |
@@ -38,7 +38,7 @@ RCSID("$OpenBSD: kexdh.c,v 1.5 2001/06/23 02:34:29 markus Exp $"); | |||
38 | #include "dh.h" | 38 | #include "dh.h" |
39 | #include "ssh2.h" | 39 | #include "ssh2.h" |
40 | 40 | ||
41 | u_char * | 41 | static u_char * |
42 | kex_dh_hash( | 42 | kex_dh_hash( |
43 | char *client_version_string, | 43 | char *client_version_string, |
44 | char *server_version_string, | 44 | char *server_version_string, |
@@ -88,7 +88,7 @@ kex_dh_hash( | |||
88 | 88 | ||
89 | /* client */ | 89 | /* client */ |
90 | 90 | ||
91 | void | 91 | static void |
92 | kexdh_client(Kex *kex) | 92 | kexdh_client(Kex *kex) |
93 | { | 93 | { |
94 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; | 94 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; |
@@ -193,7 +193,7 @@ kexdh_client(Kex *kex) | |||
193 | 193 | ||
194 | /* server */ | 194 | /* server */ |
195 | 195 | ||
196 | void | 196 | static void |
197 | kexdh_server(Kex *kex) | 197 | kexdh_server(Kex *kex) |
198 | { | 198 | { |
199 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; | 199 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; |
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | RCSID("$OpenBSD: kexgex.c,v 1.7 2001/06/23 02:34:29 markus Exp $"); | 27 | RCSID("$OpenBSD: kexgex.c,v 1.8 2001/06/23 15:12:19 itojun Exp $"); |
28 | 28 | ||
29 | #include <openssl/bn.h> | 29 | #include <openssl/bn.h> |
30 | 30 | ||
@@ -39,7 +39,7 @@ RCSID("$OpenBSD: kexgex.c,v 1.7 2001/06/23 02:34:29 markus Exp $"); | |||
39 | #include "ssh2.h" | 39 | #include "ssh2.h" |
40 | #include "compat.h" | 40 | #include "compat.h" |
41 | 41 | ||
42 | u_char * | 42 | static u_char * |
43 | kexgex_hash( | 43 | kexgex_hash( |
44 | char *client_version_string, | 44 | char *client_version_string, |
45 | char *server_version_string, | 45 | char *server_version_string, |
@@ -99,7 +99,7 @@ kexgex_hash( | |||
99 | 99 | ||
100 | /* client */ | 100 | /* client */ |
101 | 101 | ||
102 | void | 102 | static void |
103 | kexgex_client(Kex *kex) | 103 | kexgex_client(Kex *kex) |
104 | { | 104 | { |
105 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; | 105 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; |
@@ -253,7 +253,7 @@ kexgex_client(Kex *kex) | |||
253 | 253 | ||
254 | /* server */ | 254 | /* server */ |
255 | 255 | ||
256 | void | 256 | static void |
257 | kexgex_server(Kex *kex) | 257 | kexgex_server(Kex *kex) |
258 | { | 258 | { |
259 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; | 259 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; |
@@ -32,7 +32,7 @@ | |||
32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | #include "includes.h" | 34 | #include "includes.h" |
35 | RCSID("$OpenBSD: key.c,v 1.26 2001/06/23 05:26:02 markus Exp $"); | 35 | RCSID("$OpenBSD: key.c,v 1.27 2001/06/23 15:12:19 itojun Exp $"); |
36 | 36 | ||
37 | #include <openssl/evp.h> | 37 | #include <openssl/evp.h> |
38 | 38 | ||
@@ -153,7 +153,7 @@ key_equal(Key *a, Key *b) | |||
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
156 | u_char* | 156 | static u_char* |
157 | key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length) | 157 | key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length) |
158 | { | 158 | { |
159 | EVP_MD *md = NULL; | 159 | EVP_MD *md = NULL; |
@@ -210,7 +210,7 @@ key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length) | |||
210 | return retval; | 210 | return retval; |
211 | } | 211 | } |
212 | 212 | ||
213 | char* | 213 | static char* |
214 | key_fingerprint_hex(u_char* dgst_raw, size_t dgst_raw_len) | 214 | key_fingerprint_hex(u_char* dgst_raw, size_t dgst_raw_len) |
215 | { | 215 | { |
216 | char *retval; | 216 | char *retval; |
@@ -227,7 +227,7 @@ key_fingerprint_hex(u_char* dgst_raw, size_t dgst_raw_len) | |||
227 | return retval; | 227 | return retval; |
228 | } | 228 | } |
229 | 229 | ||
230 | char* | 230 | static char* |
231 | key_fingerprint_bubblebabble(u_char* dgst_raw, size_t dgst_raw_len) | 231 | key_fingerprint_bubblebabble(u_char* dgst_raw, size_t dgst_raw_len) |
232 | { | 232 | { |
233 | char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' }; | 233 | char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' }; |
@@ -308,7 +308,7 @@ key_fingerprint(Key *k, enum fp_type dgst_type, enum fp_rep dgst_rep) | |||
308 | * last processed (and maybe modified) character. Note that this may modify | 308 | * last processed (and maybe modified) character. Note that this may modify |
309 | * the buffer containing the number. | 309 | * the buffer containing the number. |
310 | */ | 310 | */ |
311 | int | 311 | static int |
312 | read_bignum(char **cpp, BIGNUM * value) | 312 | read_bignum(char **cpp, BIGNUM * value) |
313 | { | 313 | { |
314 | char *cp = *cpp; | 314 | char *cp = *cpp; |
@@ -344,7 +344,7 @@ read_bignum(char **cpp, BIGNUM * value) | |||
344 | *cpp = cp; | 344 | *cpp = cp; |
345 | return 1; | 345 | return 1; |
346 | } | 346 | } |
347 | int | 347 | static int |
348 | write_bignum(FILE *f, BIGNUM *num) | 348 | write_bignum(FILE *f, BIGNUM *num) |
349 | { | 349 | { |
350 | char *buf = BN_bn2dec(num); | 350 | char *buf = BN_bn2dec(num); |
@@ -544,7 +544,7 @@ key_size(Key *k){ | |||
544 | return 0; | 544 | return 0; |
545 | } | 545 | } |
546 | 546 | ||
547 | RSA * | 547 | static RSA * |
548 | rsa_generate_private_key(u_int bits) | 548 | rsa_generate_private_key(u_int bits) |
549 | { | 549 | { |
550 | RSA *private; | 550 | RSA *private; |
@@ -554,7 +554,7 @@ rsa_generate_private_key(u_int bits) | |||
554 | return private; | 554 | return private; |
555 | } | 555 | } |
556 | 556 | ||
557 | DSA* | 557 | static DSA* |
558 | dsa_generate_private_key(u_int bits) | 558 | dsa_generate_private_key(u_int bits) |
559 | { | 559 | { |
560 | DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL); | 560 | DSA *private = DSA_generate_parameters(bits, NULL, 0, NULL, NULL, NULL, NULL); |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: nchan.c,v 1.28 2001/05/31 10:30:16 markus Exp $"); | 26 | RCSID("$OpenBSD: nchan.c,v 1.29 2001/06/23 15:12:19 itojun Exp $"); |
27 | 27 | ||
28 | #include "ssh1.h" | 28 | #include "ssh1.h" |
29 | #include "ssh2.h" | 29 | #include "ssh2.h" |
@@ -74,14 +74,14 @@ chan_event_fn *chan_obuf_empty = NULL; | |||
74 | /* | 74 | /* |
75 | * ACTIONS: should never update the channel states | 75 | * ACTIONS: should never update the channel states |
76 | */ | 76 | */ |
77 | static void chan_send_ieof1(Channel *c); | 77 | static void chan_send_ieof1(Channel *); |
78 | static void chan_send_oclose1(Channel *c); | 78 | static void chan_send_oclose1(Channel *); |
79 | static void chan_send_close2(Channel *c); | 79 | static void chan_send_close2(Channel *); |
80 | static void chan_send_eof2(Channel *c); | 80 | static void chan_send_eof2(Channel *); |
81 | 81 | ||
82 | /* helper */ | 82 | /* helper */ |
83 | static void chan_shutdown_write(Channel *c); | 83 | static void chan_shutdown_write(Channel *); |
84 | static void chan_shutdown_read(Channel *c); | 84 | static void chan_shutdown_read(Channel *); |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * SSH1 specific implementation of event functions | 87 | * SSH1 specific implementation of event functions |
@@ -37,7 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include "includes.h" | 39 | #include "includes.h" |
40 | RCSID("$OpenBSD: packet.c,v 1.67 2001/06/20 13:56:39 markus Exp $"); | 40 | RCSID("$OpenBSD: packet.c,v 1.68 2001/06/23 15:12:19 itojun Exp $"); |
41 | 41 | ||
42 | #include "xmalloc.h" | 42 | #include "xmalloc.h" |
43 | #include "buffer.h" | 43 | #include "buffer.h" |
@@ -260,8 +260,8 @@ packet_get_protocol_flags() | |||
260 | * Level is compression level 1 (fastest) - 9 (slow, best) as in gzip. | 260 | * Level is compression level 1 (fastest) - 9 (slow, best) as in gzip. |
261 | */ | 261 | */ |
262 | 262 | ||
263 | void | 263 | static void |
264 | packet_init_compression() | 264 | packet_init_compression(void) |
265 | { | 265 | { |
266 | if (compression_buffer_ready == 1) | 266 | if (compression_buffer_ready == 1) |
267 | return; | 267 | return; |
@@ -356,7 +356,7 @@ packet_put_bignum2(BIGNUM * value) | |||
356 | * encrypts the packet before sending. | 356 | * encrypts the packet before sending. |
357 | */ | 357 | */ |
358 | 358 | ||
359 | void | 359 | static void |
360 | packet_send1(void) | 360 | packet_send1(void) |
361 | { | 361 | { |
362 | char buf[8], *cp; | 362 | char buf[8], *cp; |
@@ -427,7 +427,7 @@ packet_send1(void) | |||
427 | */ | 427 | */ |
428 | } | 428 | } |
429 | 429 | ||
430 | void | 430 | static void |
431 | set_newkeys(int mode) | 431 | set_newkeys(int mode) |
432 | { | 432 | { |
433 | Enc *enc; | 433 | Enc *enc; |
@@ -480,7 +480,7 @@ set_newkeys(int mode) | |||
480 | /* | 480 | /* |
481 | * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue) | 481 | * Finalize packet in SSH2 format (compress, mac, encrypt, enqueue) |
482 | */ | 482 | */ |
483 | void | 483 | static void |
484 | packet_send2(void) | 484 | packet_send2(void) |
485 | { | 485 | { |
486 | static u_int32_t seqnr = 0; | 486 | static u_int32_t seqnr = 0; |
@@ -683,7 +683,7 @@ packet_read_expect(int *payload_len_ptr, int expected_type) | |||
683 | * Check bytes | 683 | * Check bytes |
684 | */ | 684 | */ |
685 | 685 | ||
686 | int | 686 | static int |
687 | packet_read_poll1(int *payload_len_ptr) | 687 | packet_read_poll1(int *payload_len_ptr) |
688 | { | 688 | { |
689 | u_int len, padded_len; | 689 | u_int len, padded_len; |
@@ -761,7 +761,7 @@ packet_read_poll1(int *payload_len_ptr) | |||
761 | return type; | 761 | return type; |
762 | } | 762 | } |
763 | 763 | ||
764 | int | 764 | static int |
765 | packet_read_poll2(int *payload_len_ptr) | 765 | packet_read_poll2(int *payload_len_ptr) |
766 | { | 766 | { |
767 | static u_int32_t seqnr = 0; | 767 | static u_int32_t seqnr = 0; |
@@ -25,11 +25,13 @@ | |||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | #include "uuencode.h" | 26 | #include "uuencode.h" |
27 | 27 | ||
28 | RCSID("$OpenBSD: radix.c,v 1.15 2001/01/16 23:58:09 deraadt Exp $"); | 28 | RCSID("$OpenBSD: radix.c,v 1.16 2001/06/23 15:12:19 itojun Exp $"); |
29 | 29 | ||
30 | #ifdef AFS | 30 | #ifdef AFS |
31 | #include <krb.h> | 31 | #include <krb.h> |
32 | 32 | ||
33 | #include <radix.h> | ||
34 | |||
33 | typedef u_char my_u_char; | 35 | typedef u_char my_u_char; |
34 | typedef u_int my_u_int32_t; | 36 | typedef u_int my_u_int32_t; |
35 | typedef u_short my_u_short; | 37 | typedef u_short my_u_short; |
diff --git a/readpass.c b/readpass.c index d059272e7..05883dfcd 100644 --- a/readpass.c +++ b/readpass.c | |||
@@ -32,7 +32,7 @@ | |||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "includes.h" | 34 | #include "includes.h" |
35 | RCSID("$OpenBSD: readpass.c,v 1.17 2001/05/06 17:52:07 mouring Exp $"); | 35 | RCSID("$OpenBSD: readpass.c,v 1.18 2001/06/23 15:12:19 itojun Exp $"); |
36 | 36 | ||
37 | #include "xmalloc.h" | 37 | #include "xmalloc.h" |
38 | #include "cli.h" | 38 | #include "cli.h" |
@@ -42,7 +42,7 @@ RCSID("$OpenBSD: readpass.c,v 1.17 2001/05/06 17:52:07 mouring Exp $"); | |||
42 | #include "atomicio.h" | 42 | #include "atomicio.h" |
43 | #include "ssh.h" | 43 | #include "ssh.h" |
44 | 44 | ||
45 | char * | 45 | static char * |
46 | ssh_askpass(char *askpass, const char *msg) | 46 | ssh_askpass(char *askpass, const char *msg) |
47 | { | 47 | { |
48 | pid_t pid; | 48 | pid_t pid; |
@@ -75,7 +75,7 @@ | |||
75 | */ | 75 | */ |
76 | 76 | ||
77 | #include "includes.h" | 77 | #include "includes.h" |
78 | RCSID("$OpenBSD: scp.c,v 1.75 2001/06/23 00:16:16 deraadt Exp $"); | 78 | RCSID("$OpenBSD: scp.c,v 1.76 2001/06/23 15:12:19 itojun Exp $"); |
79 | 79 | ||
80 | #include "xmalloc.h" | 80 | #include "xmalloc.h" |
81 | #include "atomicio.h" | 81 | #include "atomicio.h" |
@@ -210,6 +210,7 @@ int pflag, iamremote, iamrecursive, targetshouldbedirectory; | |||
210 | #define CMDNEEDS 64 | 210 | #define CMDNEEDS 64 |
211 | char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */ | 211 | char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */ |
212 | 212 | ||
213 | int main(int, char *[]); | ||
213 | int response(void); | 214 | int response(void); |
214 | void rsource(char *, struct stat *); | 215 | void rsource(char *, struct stat *); |
215 | void sink(int, char *[]); | 216 | void sink(int, char *[]); |
@@ -1060,7 +1061,7 @@ lostconn(signo) | |||
1060 | } | 1061 | } |
1061 | 1062 | ||
1062 | 1063 | ||
1063 | void | 1064 | static void |
1064 | alarmtimer(int wait) | 1065 | alarmtimer(int wait) |
1065 | { | 1066 | { |
1066 | struct itimerval itv; | 1067 | struct itimerval itv; |
@@ -1071,7 +1072,7 @@ alarmtimer(int wait) | |||
1071 | setitimer(ITIMER_REAL, &itv, NULL); | 1072 | setitimer(ITIMER_REAL, &itv, NULL); |
1072 | } | 1073 | } |
1073 | 1074 | ||
1074 | void | 1075 | static void |
1075 | updateprogressmeter(int ignore) | 1076 | updateprogressmeter(int ignore) |
1076 | { | 1077 | { |
1077 | int save_errno = errno; | 1078 | int save_errno = errno; |
@@ -1080,7 +1081,7 @@ updateprogressmeter(int ignore) | |||
1080 | errno = save_errno; | 1081 | errno = save_errno; |
1081 | } | 1082 | } |
1082 | 1083 | ||
1083 | int | 1084 | static int |
1084 | foregroundproc(void) | 1085 | foregroundproc(void) |
1085 | { | 1086 | { |
1086 | static pid_t pgrp = -1; | 1087 | static pid_t pgrp = -1; |
diff --git a/servconf.c b/servconf.c index d1205a81f..55b0b0039 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "includes.h" | 12 | #include "includes.h" |
13 | RCSID("$OpenBSD: servconf.c,v 1.83 2001/06/08 15:25:40 markus Exp $"); | 13 | RCSID("$OpenBSD: servconf.c,v 1.84 2001/06/23 15:12:19 itojun Exp $"); |
14 | 14 | ||
15 | #ifdef KRB4 | 15 | #ifdef KRB4 |
16 | #include <krb.h> | 16 | #include <krb.h> |
@@ -31,8 +31,8 @@ RCSID("$OpenBSD: servconf.c,v 1.83 2001/06/08 15:25:40 markus Exp $"); | |||
31 | #include "kex.h" | 31 | #include "kex.h" |
32 | #include "mac.h" | 32 | #include "mac.h" |
33 | 33 | ||
34 | void add_listen_addr(ServerOptions *options, char *addr, u_short port); | 34 | static void add_listen_addr(ServerOptions *, char *, u_short); |
35 | void add_one_listen_addr(ServerOptions *options, char *addr, u_short port); | 35 | static void add_one_listen_addr(ServerOptions *, char *, u_short); |
36 | 36 | ||
37 | /* AF_UNSPEC or AF_INET or AF_INET6 */ | 37 | /* AF_UNSPEC or AF_INET or AF_INET6 */ |
38 | extern int IPv4or6; | 38 | extern int IPv4or6; |
@@ -333,7 +333,7 @@ parse_token(const char *cp, const char *filename, | |||
333 | return sBadOption; | 333 | return sBadOption; |
334 | } | 334 | } |
335 | 335 | ||
336 | void | 336 | static void |
337 | add_listen_addr(ServerOptions *options, char *addr, u_short port) | 337 | add_listen_addr(ServerOptions *options, char *addr, u_short port) |
338 | { | 338 | { |
339 | int i; | 339 | int i; |
@@ -347,7 +347,7 @@ add_listen_addr(ServerOptions *options, char *addr, u_short port) | |||
347 | add_one_listen_addr(options, addr, port); | 347 | add_one_listen_addr(options, addr, port); |
348 | } | 348 | } |
349 | 349 | ||
350 | void | 350 | static void |
351 | add_one_listen_addr(ServerOptions *options, char *addr, u_short port) | 351 | add_one_listen_addr(ServerOptions *options, char *addr, u_short port) |
352 | { | 352 | { |
353 | struct addrinfo hints, *ai, *aitop; | 353 | struct addrinfo hints, *ai, *aitop; |
diff --git a/serverloop.c b/serverloop.c index 1ce6c9106..1ffa4dbfb 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: serverloop.c,v 1.69 2001/06/20 13:56:39 markus Exp $"); | 38 | RCSID("$OpenBSD: serverloop.c,v 1.70 2001/06/23 15:12:19 itojun Exp $"); |
39 | 39 | ||
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
41 | #include "packet.h" | 41 | #include "packet.h" |
@@ -84,13 +84,15 @@ static u_int buffer_high; /* "Soft" max buffer size. */ | |||
84 | * This SIGCHLD kludge is used to detect when the child exits. The server | 84 | * This SIGCHLD kludge is used to detect when the child exits. The server |
85 | * will exit after that, as soon as forwarded connections have terminated. | 85 | * will exit after that, as soon as forwarded connections have terminated. |
86 | */ | 86 | */ |
87 | |||
87 | static volatile int child_terminated; /* The child has terminated. */ | 88 | static volatile int child_terminated; /* The child has terminated. */ |
88 | 89 | ||
89 | void server_init_dispatch(void); | 90 | /* prototypes */ |
91 | static void server_init_dispatch(void); | ||
90 | 92 | ||
91 | int client_alive_timeouts = 0; | 93 | int client_alive_timeouts = 0; |
92 | 94 | ||
93 | void | 95 | static void |
94 | sigchld_handler(int sig) | 96 | sigchld_handler(int sig) |
95 | { | 97 | { |
96 | int save_errno = errno; | 98 | int save_errno = errno; |
@@ -104,7 +106,7 @@ sigchld_handler(int sig) | |||
104 | * Make packets from buffered stderr data, and buffer it for sending | 106 | * Make packets from buffered stderr data, and buffer it for sending |
105 | * to the client. | 107 | * to the client. |
106 | */ | 108 | */ |
107 | void | 109 | static void |
108 | make_packets_from_stderr_data(void) | 110 | make_packets_from_stderr_data(void) |
109 | { | 111 | { |
110 | int len; | 112 | int len; |
@@ -133,7 +135,7 @@ make_packets_from_stderr_data(void) | |||
133 | * Make packets from buffered stdout data, and buffer it for sending to the | 135 | * Make packets from buffered stdout data, and buffer it for sending to the |
134 | * client. | 136 | * client. |
135 | */ | 137 | */ |
136 | void | 138 | static void |
137 | make_packets_from_stdout_data(void) | 139 | make_packets_from_stdout_data(void) |
138 | { | 140 | { |
139 | int len; | 141 | int len; |
@@ -164,7 +166,7 @@ make_packets_from_stdout_data(void) | |||
164 | * have data or can accept data. Optionally, a maximum time can be specified | 166 | * have data or can accept data. Optionally, a maximum time can be specified |
165 | * for the duration of the wait (0 = infinite). | 167 | * for the duration of the wait (0 = infinite). |
166 | */ | 168 | */ |
167 | void | 169 | static void |
168 | wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, | 170 | wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp, int *maxfdp, |
169 | u_int max_time_milliseconds) | 171 | u_int max_time_milliseconds) |
170 | { | 172 | { |
@@ -286,7 +288,7 @@ retry_select: | |||
286 | * Processes input from the client and the program. Input data is stored | 288 | * Processes input from the client and the program. Input data is stored |
287 | * in buffers and processed later. | 289 | * in buffers and processed later. |
288 | */ | 290 | */ |
289 | void | 291 | static void |
290 | process_input(fd_set * readset) | 292 | process_input(fd_set * readset) |
291 | { | 293 | { |
292 | int len; | 294 | int len; |
@@ -342,7 +344,7 @@ process_input(fd_set * readset) | |||
342 | /* | 344 | /* |
343 | * Sends data from internal buffers to client program stdin. | 345 | * Sends data from internal buffers to client program stdin. |
344 | */ | 346 | */ |
345 | void | 347 | static void |
346 | process_output(fd_set * writeset) | 348 | process_output(fd_set * writeset) |
347 | { | 349 | { |
348 | struct termios tio; | 350 | struct termios tio; |
@@ -390,7 +392,7 @@ process_output(fd_set * writeset) | |||
390 | * Wait until all buffered output has been sent to the client. | 392 | * Wait until all buffered output has been sent to the client. |
391 | * This is used when the program terminates. | 393 | * This is used when the program terminates. |
392 | */ | 394 | */ |
393 | void | 395 | static void |
394 | drain_output(void) | 396 | drain_output(void) |
395 | { | 397 | { |
396 | /* Send any buffered stdout data to the client. */ | 398 | /* Send any buffered stdout data to the client. */ |
@@ -415,7 +417,7 @@ drain_output(void) | |||
415 | packet_write_wait(); | 417 | packet_write_wait(); |
416 | } | 418 | } |
417 | 419 | ||
418 | void | 420 | static void |
419 | process_buffered_input_packets(void) | 421 | process_buffered_input_packets(void) |
420 | { | 422 | { |
421 | dispatch_run(DISPATCH_NONBLOCK, NULL, compat20 ? xxx_kex : NULL); | 423 | dispatch_run(DISPATCH_NONBLOCK, NULL, compat20 ? xxx_kex : NULL); |
@@ -706,7 +708,7 @@ server_loop2(void) | |||
706 | session_close_by_pid(pid, status); | 708 | session_close_by_pid(pid, status); |
707 | } | 709 | } |
708 | 710 | ||
709 | void | 711 | static void |
710 | server_input_channel_failure(int type, int plen, void *ctxt) | 712 | server_input_channel_failure(int type, int plen, void *ctxt) |
711 | { | 713 | { |
712 | debug("Got CHANNEL_FAILURE for keepalive"); | 714 | debug("Got CHANNEL_FAILURE for keepalive"); |
@@ -719,7 +721,7 @@ server_input_channel_failure(int type, int plen, void *ctxt) | |||
719 | } | 721 | } |
720 | 722 | ||
721 | 723 | ||
722 | void | 724 | static void |
723 | server_input_stdin_data(int type, int plen, void *ctxt) | 725 | server_input_stdin_data(int type, int plen, void *ctxt) |
724 | { | 726 | { |
725 | char *data; | 727 | char *data; |
@@ -736,7 +738,7 @@ server_input_stdin_data(int type, int plen, void *ctxt) | |||
736 | xfree(data); | 738 | xfree(data); |
737 | } | 739 | } |
738 | 740 | ||
739 | void | 741 | static void |
740 | server_input_eof(int type, int plen, void *ctxt) | 742 | server_input_eof(int type, int plen, void *ctxt) |
741 | { | 743 | { |
742 | /* | 744 | /* |
@@ -749,7 +751,7 @@ server_input_eof(int type, int plen, void *ctxt) | |||
749 | stdin_eof = 1; | 751 | stdin_eof = 1; |
750 | } | 752 | } |
751 | 753 | ||
752 | void | 754 | static void |
753 | server_input_window_size(int type, int plen, void *ctxt) | 755 | server_input_window_size(int type, int plen, void *ctxt) |
754 | { | 756 | { |
755 | int row = packet_get_int(); | 757 | int row = packet_get_int(); |
@@ -763,7 +765,7 @@ server_input_window_size(int type, int plen, void *ctxt) | |||
763 | pty_change_window_size(fdin, row, col, xpixel, ypixel); | 765 | pty_change_window_size(fdin, row, col, xpixel, ypixel); |
764 | } | 766 | } |
765 | 767 | ||
766 | Channel * | 768 | static Channel * |
767 | server_request_direct_tcpip(char *ctype) | 769 | server_request_direct_tcpip(char *ctype) |
768 | { | 770 | { |
769 | Channel *c; | 771 | Channel *c; |
@@ -796,7 +798,7 @@ server_request_direct_tcpip(char *ctype) | |||
796 | return c; | 798 | return c; |
797 | } | 799 | } |
798 | 800 | ||
799 | Channel * | 801 | static Channel * |
800 | server_request_session(char *ctype) | 802 | server_request_session(char *ctype) |
801 | { | 803 | { |
802 | Channel *c; | 804 | Channel *c; |
@@ -827,7 +829,7 @@ server_request_session(char *ctype) | |||
827 | return c; | 829 | return c; |
828 | } | 830 | } |
829 | 831 | ||
830 | void | 832 | static void |
831 | server_input_channel_open(int type, int plen, void *ctxt) | 833 | server_input_channel_open(int type, int plen, void *ctxt) |
832 | { | 834 | { |
833 | Channel *c = NULL; | 835 | Channel *c = NULL; |
@@ -877,7 +879,7 @@ server_input_channel_open(int type, int plen, void *ctxt) | |||
877 | xfree(ctype); | 879 | xfree(ctype); |
878 | } | 880 | } |
879 | 881 | ||
880 | void | 882 | static void |
881 | server_input_global_request(int type, int plen, void *ctxt) | 883 | server_input_global_request(int type, int plen, void *ctxt) |
882 | { | 884 | { |
883 | char *rtype; | 885 | char *rtype; |
@@ -927,7 +929,7 @@ server_input_global_request(int type, int plen, void *ctxt) | |||
927 | xfree(rtype); | 929 | xfree(rtype); |
928 | } | 930 | } |
929 | 931 | ||
930 | void | 932 | static void |
931 | server_init_dispatch_20(void) | 933 | server_init_dispatch_20(void) |
932 | { | 934 | { |
933 | debug("server_init_dispatch_20"); | 935 | debug("server_init_dispatch_20"); |
@@ -947,7 +949,7 @@ server_init_dispatch_20(void) | |||
947 | /* rekeying */ | 949 | /* rekeying */ |
948 | dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); | 950 | dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); |
949 | } | 951 | } |
950 | void | 952 | static void |
951 | server_init_dispatch_13(void) | 953 | server_init_dispatch_13(void) |
952 | { | 954 | { |
953 | debug("server_init_dispatch_13"); | 955 | debug("server_init_dispatch_13"); |
@@ -962,7 +964,7 @@ server_init_dispatch_13(void) | |||
962 | dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); | 964 | dispatch_set(SSH_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); |
963 | dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open); | 965 | dispatch_set(SSH_MSG_PORT_OPEN, &channel_input_port_open); |
964 | } | 966 | } |
965 | void | 967 | static void |
966 | server_init_dispatch_15(void) | 968 | server_init_dispatch_15(void) |
967 | { | 969 | { |
968 | server_init_dispatch_13(); | 970 | server_init_dispatch_13(); |
@@ -970,7 +972,7 @@ server_init_dispatch_15(void) | |||
970 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof); | 972 | dispatch_set(SSH_MSG_CHANNEL_CLOSE, &channel_input_ieof); |
971 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_oclose); | 973 | dispatch_set(SSH_MSG_CHANNEL_CLOSE_CONFIRMATION, &channel_input_oclose); |
972 | } | 974 | } |
973 | void | 975 | static void |
974 | server_init_dispatch(void) | 976 | server_init_dispatch(void) |
975 | { | 977 | { |
976 | if (compat20) | 978 | if (compat20) |
@@ -33,7 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "includes.h" | 35 | #include "includes.h" |
36 | RCSID("$OpenBSD: session.c,v 1.93 2001/06/21 21:08:25 markus Exp $"); | 36 | RCSID("$OpenBSD: session.c,v 1.94 2001/06/23 15:12:20 itojun Exp $"); |
37 | 37 | ||
38 | #include "ssh.h" | 38 | #include "ssh.h" |
39 | #include "ssh1.h" | 39 | #include "ssh1.h" |
@@ -120,25 +120,22 @@ struct Session { | |||
120 | /* func */ | 120 | /* func */ |
121 | 121 | ||
122 | Session *session_new(void); | 122 | Session *session_new(void); |
123 | void session_set_fds(Session *s, int fdin, int fdout, int fderr); | 123 | void session_set_fds(Session *, int, int, int); |
124 | void session_pty_cleanup(void *session); | 124 | static void session_pty_cleanup(void *); |
125 | int session_pty_req(Session *s); | 125 | void session_proctitle(Session *); |
126 | void session_proctitle(Session *s); | 126 | int session_setup_x11fwd(Session *); |
127 | int session_setup_x11fwd(Session *s); | 127 | void do_exec_pty(Session *, const char *); |
128 | void session_close(Session *s); | 128 | void do_exec_no_pty(Session *, const char *); |
129 | void do_exec_pty(Session *s, const char *command); | 129 | void do_exec(Session *, const char *); |
130 | void do_exec_no_pty(Session *s, const char *command); | 130 | void do_login(Session *, const char *); |
131 | void do_exec(Session *s, const char *command); | 131 | void do_child(Session *, const char *); |
132 | void do_login(Session *s, const char *command); | ||
133 | #ifdef LOGIN_NEEDS_UTMPX | ||
134 | void do_pre_login(Session *s); | ||
135 | #endif | ||
136 | void do_child(Session *s, const char *command); | ||
137 | void do_motd(void); | 132 | void do_motd(void); |
138 | int check_quietlogin(Session *s, const char *command); | ||
139 | 133 | ||
140 | void do_authenticated1(Authctxt *authctxt); | 134 | static void do_authenticated1(Authctxt *); |
141 | void do_authenticated2(Authctxt *authctxt); | 135 | static void do_authenticated2(Authctxt *); |
136 | |||
137 | static void session_close(Session *); | ||
138 | static int session_pty_req(Session *); | ||
142 | 139 | ||
143 | /* import */ | 140 | /* import */ |
144 | extern ServerOptions options; | 141 | extern ServerOptions options; |
@@ -209,7 +206,7 @@ do_authenticated(Authctxt *authctxt) | |||
209 | * terminals are allocated, X11, TCP/IP, and authentication agent forwardings | 206 | * terminals are allocated, X11, TCP/IP, and authentication agent forwardings |
210 | * are requested, etc. | 207 | * are requested, etc. |
211 | */ | 208 | */ |
212 | void | 209 | static void |
213 | do_authenticated1(Authctxt *authctxt) | 210 | do_authenticated1(Authctxt *authctxt) |
214 | { | 211 | { |
215 | Session *s; | 212 | Session *s; |
@@ -738,7 +735,7 @@ check_quietlogin(Session *s, const char *command) | |||
738 | * Sets the value of the given variable in the environment. If the variable | 735 | * Sets the value of the given variable in the environment. If the variable |
739 | * already exists, its value is overriden. | 736 | * already exists, its value is overriden. |
740 | */ | 737 | */ |
741 | void | 738 | static void |
742 | child_set_env(char ***envp, u_int *envsizep, const char *name, | 739 | child_set_env(char ***envp, u_int *envsizep, const char *name, |
743 | const char *value) | 740 | const char *value) |
744 | { | 741 | { |
@@ -779,7 +776,7 @@ child_set_env(char ***envp, u_int *envsizep, const char *name, | |||
779 | * Otherwise, it must consist of empty lines, comments (line starts with '#') | 776 | * Otherwise, it must consist of empty lines, comments (line starts with '#') |
780 | * and assignments of the form name=value. No other forms are allowed. | 777 | * and assignments of the form name=value. No other forms are allowed. |
781 | */ | 778 | */ |
782 | void | 779 | static void |
783 | read_environment_file(char ***env, u_int *envsize, | 780 | read_environment_file(char ***env, u_int *envsize, |
784 | const char *filename) | 781 | const char *filename) |
785 | { | 782 | { |
@@ -1488,7 +1485,7 @@ session_new(void) | |||
1488 | return NULL; | 1485 | return NULL; |
1489 | } | 1486 | } |
1490 | 1487 | ||
1491 | void | 1488 | static void |
1492 | session_dump(void) | 1489 | session_dump(void) |
1493 | { | 1490 | { |
1494 | int i; | 1491 | int i; |
@@ -1520,7 +1517,7 @@ session_open(int chanid) | |||
1520 | return 1; | 1517 | return 1; |
1521 | } | 1518 | } |
1522 | 1519 | ||
1523 | Session * | 1520 | static Session * |
1524 | session_by_channel(int id) | 1521 | session_by_channel(int id) |
1525 | { | 1522 | { |
1526 | int i; | 1523 | int i; |
@@ -1536,7 +1533,7 @@ session_by_channel(int id) | |||
1536 | return NULL; | 1533 | return NULL; |
1537 | } | 1534 | } |
1538 | 1535 | ||
1539 | Session * | 1536 | static Session * |
1540 | session_by_pid(pid_t pid) | 1537 | session_by_pid(pid_t pid) |
1541 | { | 1538 | { |
1542 | int i; | 1539 | int i; |
@@ -1551,7 +1548,7 @@ session_by_pid(pid_t pid) | |||
1551 | return NULL; | 1548 | return NULL; |
1552 | } | 1549 | } |
1553 | 1550 | ||
1554 | int | 1551 | static int |
1555 | session_window_change_req(Session *s) | 1552 | session_window_change_req(Session *s) |
1556 | { | 1553 | { |
1557 | s->col = packet_get_int(); | 1554 | s->col = packet_get_int(); |
@@ -1563,7 +1560,7 @@ session_window_change_req(Session *s) | |||
1563 | return 1; | 1560 | return 1; |
1564 | } | 1561 | } |
1565 | 1562 | ||
1566 | int | 1563 | static int |
1567 | session_pty_req(Session *s) | 1564 | session_pty_req(Session *s) |
1568 | { | 1565 | { |
1569 | u_int len; | 1566 | u_int len; |
@@ -1628,7 +1625,7 @@ session_pty_req(Session *s) | |||
1628 | return 1; | 1625 | return 1; |
1629 | } | 1626 | } |
1630 | 1627 | ||
1631 | int | 1628 | static int |
1632 | session_subsystem_req(Session *s) | 1629 | session_subsystem_req(Session *s) |
1633 | { | 1630 | { |
1634 | u_int len; | 1631 | u_int len; |
@@ -1655,7 +1652,7 @@ session_subsystem_req(Session *s) | |||
1655 | return success; | 1652 | return success; |
1656 | } | 1653 | } |
1657 | 1654 | ||
1658 | int | 1655 | static int |
1659 | session_x11_req(Session *s) | 1656 | session_x11_req(Session *s) |
1660 | { | 1657 | { |
1661 | int success; | 1658 | int success; |
@@ -1676,7 +1673,7 @@ session_x11_req(Session *s) | |||
1676 | return success; | 1673 | return success; |
1677 | } | 1674 | } |
1678 | 1675 | ||
1679 | int | 1676 | static int |
1680 | session_shell_req(Session *s) | 1677 | session_shell_req(Session *s) |
1681 | { | 1678 | { |
1682 | packet_done(); | 1679 | packet_done(); |
@@ -1684,7 +1681,7 @@ session_shell_req(Session *s) | |||
1684 | return 1; | 1681 | return 1; |
1685 | } | 1682 | } |
1686 | 1683 | ||
1687 | int | 1684 | static int |
1688 | session_exec_req(Session *s) | 1685 | session_exec_req(Session *s) |
1689 | { | 1686 | { |
1690 | u_int len; | 1687 | u_int len; |
@@ -1695,7 +1692,7 @@ session_exec_req(Session *s) | |||
1695 | return 1; | 1692 | return 1; |
1696 | } | 1693 | } |
1697 | 1694 | ||
1698 | int | 1695 | static int |
1699 | session_auth_agent_req(Session *s) | 1696 | session_auth_agent_req(Session *s) |
1700 | { | 1697 | { |
1701 | static int called = 0; | 1698 | static int called = 0; |
@@ -1788,7 +1785,7 @@ session_set_fds(Session *s, int fdin, int fdout, int fderr) | |||
1788 | * Function to perform pty cleanup. Also called if we get aborted abnormally | 1785 | * Function to perform pty cleanup. Also called if we get aborted abnormally |
1789 | * (e.g., due to a dropped connection). | 1786 | * (e.g., due to a dropped connection). |
1790 | */ | 1787 | */ |
1791 | void | 1788 | static void |
1792 | session_pty_cleanup(void *session) | 1789 | session_pty_cleanup(void *session) |
1793 | { | 1790 | { |
1794 | Session *s = session; | 1791 | Session *s = session; |
@@ -1818,7 +1815,7 @@ session_pty_cleanup(void *session) | |||
1818 | error("close(s->ptymaster): %s", strerror(errno)); | 1815 | error("close(s->ptymaster): %s", strerror(errno)); |
1819 | } | 1816 | } |
1820 | 1817 | ||
1821 | void | 1818 | static void |
1822 | session_exit_message(Session *s, int status) | 1819 | session_exit_message(Session *s, int status) |
1823 | { | 1820 | { |
1824 | Channel *c; | 1821 | Channel *c; |
@@ -1867,7 +1864,7 @@ session_exit_message(Session *s, int status) | |||
1867 | s->chanid = -1; | 1864 | s->chanid = -1; |
1868 | } | 1865 | } |
1869 | 1866 | ||
1870 | void | 1867 | static void |
1871 | session_close(Session *s) | 1868 | session_close(Session *s) |
1872 | { | 1869 | { |
1873 | debug("session_close: session %d pid %d", s->self, s->pid); | 1870 | debug("session_close: session %d pid %d", s->self, s->pid); |
@@ -1928,7 +1925,7 @@ session_close_by_channel(int id, void *arg) | |||
1928 | } | 1925 | } |
1929 | } | 1926 | } |
1930 | 1927 | ||
1931 | char * | 1928 | static char * |
1932 | session_tty_list(void) | 1929 | session_tty_list(void) |
1933 | { | 1930 | { |
1934 | static char buf[1024]; | 1931 | static char buf[1024]; |
@@ -1991,7 +1988,7 @@ session_setup_x11fwd(Session *s) | |||
1991 | return 1; | 1988 | return 1; |
1992 | } | 1989 | } |
1993 | 1990 | ||
1994 | void | 1991 | static void |
1995 | do_authenticated2(Authctxt *authctxt) | 1992 | do_authenticated2(Authctxt *authctxt) |
1996 | { | 1993 | { |
1997 | server_loop2(); | 1994 | server_loop2(); |
diff --git a/sftp-client.c b/sftp-client.c index cf672e70d..9670a7660 100644 --- a/sftp-client.c +++ b/sftp-client.c | |||
@@ -29,7 +29,7 @@ | |||
29 | /* XXX: copy between two remote sites */ | 29 | /* XXX: copy between two remote sites */ |
30 | 30 | ||
31 | #include "includes.h" | 31 | #include "includes.h" |
32 | RCSID("$OpenBSD: sftp-client.c,v 1.16 2001/04/05 10:42:52 markus Exp $"); | 32 | RCSID("$OpenBSD: sftp-client.c,v 1.17 2001/06/23 15:12:20 itojun Exp $"); |
33 | 33 | ||
34 | #include "ssh.h" | 34 | #include "ssh.h" |
35 | #include "buffer.h" | 35 | #include "buffer.h" |
@@ -51,7 +51,7 @@ RCSID("$OpenBSD: sftp-client.c,v 1.16 2001/04/05 10:42:52 markus Exp $"); | |||
51 | /* Message ID */ | 51 | /* Message ID */ |
52 | static u_int msg_id = 1; | 52 | static u_int msg_id = 1; |
53 | 53 | ||
54 | void | 54 | static void |
55 | send_msg(int fd, Buffer *m) | 55 | send_msg(int fd, Buffer *m) |
56 | { | 56 | { |
57 | int mlen = buffer_len(m); | 57 | int mlen = buffer_len(m); |
@@ -70,7 +70,7 @@ send_msg(int fd, Buffer *m) | |||
70 | buffer_free(&oqueue); | 70 | buffer_free(&oqueue); |
71 | } | 71 | } |
72 | 72 | ||
73 | void | 73 | static void |
74 | get_msg(int fd, Buffer *m) | 74 | get_msg(int fd, Buffer *m) |
75 | { | 75 | { |
76 | u_int len, msg_len; | 76 | u_int len, msg_len; |
@@ -98,7 +98,7 @@ get_msg(int fd, Buffer *m) | |||
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | void | 101 | static void |
102 | send_string_request(int fd, u_int id, u_int code, char *s, | 102 | send_string_request(int fd, u_int id, u_int code, char *s, |
103 | u_int len) | 103 | u_int len) |
104 | { | 104 | { |
@@ -113,7 +113,7 @@ send_string_request(int fd, u_int id, u_int code, char *s, | |||
113 | buffer_free(&msg); | 113 | buffer_free(&msg); |
114 | } | 114 | } |
115 | 115 | ||
116 | void | 116 | static void |
117 | send_string_attrs_request(int fd, u_int id, u_int code, char *s, | 117 | send_string_attrs_request(int fd, u_int id, u_int code, char *s, |
118 | u_int len, Attrib *a) | 118 | u_int len, Attrib *a) |
119 | { | 119 | { |
@@ -129,7 +129,7 @@ send_string_attrs_request(int fd, u_int id, u_int code, char *s, | |||
129 | buffer_free(&msg); | 129 | buffer_free(&msg); |
130 | } | 130 | } |
131 | 131 | ||
132 | u_int | 132 | static u_int |
133 | get_status(int fd, int expected_id) | 133 | get_status(int fd, int expected_id) |
134 | { | 134 | { |
135 | Buffer msg; | 135 | Buffer msg; |
@@ -154,7 +154,7 @@ get_status(int fd, int expected_id) | |||
154 | return(status); | 154 | return(status); |
155 | } | 155 | } |
156 | 156 | ||
157 | char * | 157 | static char * |
158 | get_handle(int fd, u_int expected_id, u_int *len) | 158 | get_handle(int fd, u_int expected_id, u_int *len) |
159 | { | 159 | { |
160 | Buffer msg; | 160 | Buffer msg; |
@@ -183,7 +183,7 @@ get_handle(int fd, u_int expected_id, u_int *len) | |||
183 | return(handle); | 183 | return(handle); |
184 | } | 184 | } |
185 | 185 | ||
186 | Attrib * | 186 | static Attrib * |
187 | get_decode_stat(int fd, u_int expected_id, int quiet) | 187 | get_decode_stat(int fd, u_int expected_id, int quiet) |
188 | { | 188 | { |
189 | Buffer msg; | 189 | Buffer msg; |
@@ -283,7 +283,7 @@ do_close(int fd_in, int fd_out, char *handle, u_int handle_len) | |||
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | int | 286 | static int |
287 | do_lsreaddir(int fd_in, int fd_out, char *path, int printflag, | 287 | do_lsreaddir(int fd_in, int fd_out, char *path, int printflag, |
288 | SFTP_DIRENT ***dir) | 288 | SFTP_DIRENT ***dir) |
289 | { | 289 | { |
diff --git a/sftp-glob.c b/sftp-glob.c index aee5e91ac..18b44f82e 100644 --- a/sftp-glob.c +++ b/sftp-glob.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: sftp-glob.c,v 1.5 2001/04/15 08:43:46 markus Exp $"); | 26 | RCSID("$OpenBSD: sftp-glob.c,v 1.6 2001/06/23 15:12:20 itojun Exp $"); |
27 | 27 | ||
28 | #include "ssh.h" | 28 | #include "ssh.h" |
29 | #include "buffer.h" | 29 | #include "buffer.h" |
@@ -49,7 +49,8 @@ static struct { | |||
49 | int fd_out; | 49 | int fd_out; |
50 | } cur; | 50 | } cur; |
51 | 51 | ||
52 | void *fudge_opendir(const char *path) | 52 | static void * |
53 | fudge_opendir(const char *path) | ||
53 | { | 54 | { |
54 | struct SFTP_OPENDIR *r; | 55 | struct SFTP_OPENDIR *r; |
55 | 56 | ||
@@ -63,7 +64,8 @@ void *fudge_opendir(const char *path) | |||
63 | return((void*)r); | 64 | return((void*)r); |
64 | } | 65 | } |
65 | 66 | ||
66 | struct dirent *fudge_readdir(struct SFTP_OPENDIR *od) | 67 | static struct dirent * |
68 | fudge_readdir(struct SFTP_OPENDIR *od) | ||
67 | { | 69 | { |
68 | /* Solaris needs sizeof(dirent) + path length (see below) */ | 70 | /* Solaris needs sizeof(dirent) + path length (see below) */ |
69 | static char buf[sizeof(struct dirent) + MAXPATHLEN]; | 71 | static char buf[sizeof(struct dirent) + MAXPATHLEN]; |
@@ -101,13 +103,15 @@ struct dirent *fudge_readdir(struct SFTP_OPENDIR *od) | |||
101 | return(ret); | 103 | return(ret); |
102 | } | 104 | } |
103 | 105 | ||
104 | void fudge_closedir(struct SFTP_OPENDIR *od) | 106 | static void |
107 | fudge_closedir(struct SFTP_OPENDIR *od) | ||
105 | { | 108 | { |
106 | free_sftp_dirents(od->dir); | 109 | free_sftp_dirents(od->dir); |
107 | xfree(od); | 110 | xfree(od); |
108 | } | 111 | } |
109 | 112 | ||
110 | void attrib_to_stat(Attrib *a, struct stat *st) | 113 | static void |
114 | attrib_to_stat(Attrib *a, struct stat *st) | ||
111 | { | 115 | { |
112 | memset(st, 0, sizeof(*st)); | 116 | memset(st, 0, sizeof(*st)); |
113 | 117 | ||
@@ -125,7 +129,8 @@ void attrib_to_stat(Attrib *a, struct stat *st) | |||
125 | } | 129 | } |
126 | } | 130 | } |
127 | 131 | ||
128 | int fudge_lstat(const char *path, struct stat *st) | 132 | static int |
133 | fudge_lstat(const char *path, struct stat *st) | ||
129 | { | 134 | { |
130 | Attrib *a; | 135 | Attrib *a; |
131 | 136 | ||
@@ -137,7 +142,8 @@ int fudge_lstat(const char *path, struct stat *st) | |||
137 | return(0); | 142 | return(0); |
138 | } | 143 | } |
139 | 144 | ||
140 | int fudge_stat(const char *path, struct stat *st) | 145 | static int |
146 | fudge_stat(const char *path, struct stat *st) | ||
141 | { | 147 | { |
142 | Attrib *a; | 148 | Attrib *a; |
143 | 149 | ||
diff --git a/sftp-int.c b/sftp-int.c index 03b229999..aa3a8a02f 100644 --- a/sftp-int.c +++ b/sftp-int.c | |||
@@ -26,7 +26,7 @@ | |||
26 | /* XXX: recursive operations */ | 26 | /* XXX: recursive operations */ |
27 | 27 | ||
28 | #include "includes.h" | 28 | #include "includes.h" |
29 | RCSID("$OpenBSD: sftp-int.c,v 1.36 2001/04/15 08:43:46 markus Exp $"); | 29 | RCSID("$OpenBSD: sftp-int.c,v 1.37 2001/06/23 15:12:20 itojun Exp $"); |
30 | 30 | ||
31 | #include "buffer.h" | 31 | #include "buffer.h" |
32 | #include "xmalloc.h" | 32 | #include "xmalloc.h" |
@@ -111,7 +111,7 @@ const struct CMD cmds[] = { | |||
111 | { NULL, -1} | 111 | { NULL, -1} |
112 | }; | 112 | }; |
113 | 113 | ||
114 | void | 114 | static void |
115 | help(void) | 115 | help(void) |
116 | { | 116 | { |
117 | printf("Available commands:\n"); | 117 | printf("Available commands:\n"); |
@@ -143,7 +143,7 @@ help(void) | |||
143 | printf("? Synonym for help\n"); | 143 | printf("? Synonym for help\n"); |
144 | } | 144 | } |
145 | 145 | ||
146 | void | 146 | static void |
147 | local_do_shell(const char *args) | 147 | local_do_shell(const char *args) |
148 | { | 148 | { |
149 | int status; | 149 | int status; |
@@ -180,7 +180,7 @@ local_do_shell(const char *args) | |||
180 | error("Shell exited with status %d", WEXITSTATUS(status)); | 180 | error("Shell exited with status %d", WEXITSTATUS(status)); |
181 | } | 181 | } |
182 | 182 | ||
183 | void | 183 | static void |
184 | local_do_ls(const char *args) | 184 | local_do_ls(const char *args) |
185 | { | 185 | { |
186 | if (!args || !*args) | 186 | if (!args || !*args) |
@@ -196,7 +196,7 @@ local_do_ls(const char *args) | |||
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | char * | 199 | static char * |
200 | path_append(char *p1, char *p2) | 200 | path_append(char *p1, char *p2) |
201 | { | 201 | { |
202 | char *ret; | 202 | char *ret; |
@@ -210,7 +210,7 @@ path_append(char *p1, char *p2) | |||
210 | return(ret); | 210 | return(ret); |
211 | } | 211 | } |
212 | 212 | ||
213 | char * | 213 | static char * |
214 | make_absolute(char *p, char *pwd) | 214 | make_absolute(char *p, char *pwd) |
215 | { | 215 | { |
216 | char *abs; | 216 | char *abs; |
@@ -224,7 +224,7 @@ make_absolute(char *p, char *pwd) | |||
224 | return(p); | 224 | return(p); |
225 | } | 225 | } |
226 | 226 | ||
227 | int | 227 | static int |
228 | infer_path(const char *p, char **ifp) | 228 | infer_path(const char *p, char **ifp) |
229 | { | 229 | { |
230 | char *cp; | 230 | char *cp; |
@@ -244,7 +244,7 @@ infer_path(const char *p, char **ifp) | |||
244 | return(0); | 244 | return(0); |
245 | } | 245 | } |
246 | 246 | ||
247 | int | 247 | static int |
248 | parse_getput_flags(const char **cpp, int *pflag) | 248 | parse_getput_flags(const char **cpp, int *pflag) |
249 | { | 249 | { |
250 | const char *cp = *cpp; | 250 | const char *cp = *cpp; |
@@ -267,7 +267,7 @@ parse_getput_flags(const char **cpp, int *pflag) | |||
267 | return(0); | 267 | return(0); |
268 | } | 268 | } |
269 | 269 | ||
270 | int | 270 | static int |
271 | get_pathname(const char **cpp, char **path) | 271 | get_pathname(const char **cpp, char **path) |
272 | { | 272 | { |
273 | const char *cp = *cpp, *end; | 273 | const char *cp = *cpp, *end; |
@@ -315,7 +315,7 @@ get_pathname(const char **cpp, char **path) | |||
315 | return (-1); | 315 | return (-1); |
316 | } | 316 | } |
317 | 317 | ||
318 | int | 318 | static int |
319 | is_dir(char *path) | 319 | is_dir(char *path) |
320 | { | 320 | { |
321 | struct stat sb; | 321 | struct stat sb; |
@@ -327,7 +327,7 @@ is_dir(char *path) | |||
327 | return(sb.st_mode & S_IFDIR); | 327 | return(sb.st_mode & S_IFDIR); |
328 | } | 328 | } |
329 | 329 | ||
330 | int | 330 | static int |
331 | remote_is_dir(int in, int out, char *path) | 331 | remote_is_dir(int in, int out, char *path) |
332 | { | 332 | { |
333 | Attrib *a; | 333 | Attrib *a; |
@@ -340,7 +340,7 @@ remote_is_dir(int in, int out, char *path) | |||
340 | return(a->perm & S_IFDIR); | 340 | return(a->perm & S_IFDIR); |
341 | } | 341 | } |
342 | 342 | ||
343 | int | 343 | static int |
344 | process_get(int in, int out, char *src, char *dst, char *pwd, int pflag) | 344 | process_get(int in, int out, char *src, char *dst, char *pwd, int pflag) |
345 | { | 345 | { |
346 | char *abs_src = NULL; | 346 | char *abs_src = NULL; |
@@ -417,7 +417,7 @@ out: | |||
417 | return(err); | 417 | return(err); |
418 | } | 418 | } |
419 | 419 | ||
420 | int | 420 | static int |
421 | process_put(int in, int out, char *src, char *dst, char *pwd, int pflag) | 421 | process_put(int in, int out, char *src, char *dst, char *pwd, int pflag) |
422 | { | 422 | { |
423 | char *tmp_dst = NULL; | 423 | char *tmp_dst = NULL; |
@@ -497,7 +497,7 @@ out: | |||
497 | return(err); | 497 | return(err); |
498 | } | 498 | } |
499 | 499 | ||
500 | int | 500 | static int |
501 | parse_args(const char **cpp, int *pflag, unsigned long *n_arg, | 501 | parse_args(const char **cpp, int *pflag, unsigned long *n_arg, |
502 | char **path1, char **path2) | 502 | char **path1, char **path2) |
503 | { | 503 | { |
@@ -642,7 +642,7 @@ parse_args(const char **cpp, int *pflag, unsigned long *n_arg, | |||
642 | return(cmdnum); | 642 | return(cmdnum); |
643 | } | 643 | } |
644 | 644 | ||
645 | int | 645 | static int |
646 | parse_dispatch_command(int in, int out, const char *cmd, char **pwd) | 646 | parse_dispatch_command(int in, int out, const char *cmd, char **pwd) |
647 | { | 647 | { |
648 | char *path1, *path2, *tmp; | 648 | char *path1, *path2, *tmp; |
diff --git a/sftp-server.c b/sftp-server.c index ab6291e61..e6353bceb 100644 --- a/sftp-server.c +++ b/sftp-server.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 | */ | 23 | */ |
24 | #include "includes.h" | 24 | #include "includes.h" |
25 | RCSID("$OpenBSD: sftp-server.c,v 1.27 2001/06/22 22:21:20 markus Exp $"); | 25 | RCSID("$OpenBSD: sftp-server.c,v 1.28 2001/06/23 15:12:20 itojun Exp $"); |
26 | 26 | ||
27 | #include "buffer.h" | 27 | #include "buffer.h" |
28 | #include "bufaux.h" | 28 | #include "bufaux.h" |
@@ -62,7 +62,7 @@ struct Stat { | |||
62 | Attrib attrib; | 62 | Attrib attrib; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | int | 65 | static int |
66 | errno_to_portable(int unixerrno) | 66 | errno_to_portable(int unixerrno) |
67 | { | 67 | { |
68 | int ret = 0; | 68 | int ret = 0; |
@@ -93,7 +93,7 @@ errno_to_portable(int unixerrno) | |||
93 | return ret; | 93 | return ret; |
94 | } | 94 | } |
95 | 95 | ||
96 | int | 96 | static int |
97 | flags_from_portable(int pflags) | 97 | flags_from_portable(int pflags) |
98 | { | 98 | { |
99 | int flags = 0; | 99 | int flags = 0; |
@@ -115,7 +115,7 @@ flags_from_portable(int pflags) | |||
115 | return flags; | 115 | return flags; |
116 | } | 116 | } |
117 | 117 | ||
118 | Attrib * | 118 | static Attrib * |
119 | get_attrib(void) | 119 | get_attrib(void) |
120 | { | 120 | { |
121 | return decode_attrib(&iqueue); | 121 | return decode_attrib(&iqueue); |
@@ -139,7 +139,7 @@ enum { | |||
139 | 139 | ||
140 | Handle handles[100]; | 140 | Handle handles[100]; |
141 | 141 | ||
142 | void | 142 | static void |
143 | handle_init(void) | 143 | handle_init(void) |
144 | { | 144 | { |
145 | int i; | 145 | int i; |
@@ -148,7 +148,7 @@ handle_init(void) | |||
148 | handles[i].use = HANDLE_UNUSED; | 148 | handles[i].use = HANDLE_UNUSED; |
149 | } | 149 | } |
150 | 150 | ||
151 | int | 151 | static int |
152 | handle_new(int use, char *name, int fd, DIR *dirp) | 152 | handle_new(int use, char *name, int fd, DIR *dirp) |
153 | { | 153 | { |
154 | int i; | 154 | int i; |
@@ -165,14 +165,14 @@ handle_new(int use, char *name, int fd, DIR *dirp) | |||
165 | return -1; | 165 | return -1; |
166 | } | 166 | } |
167 | 167 | ||
168 | int | 168 | static int |
169 | handle_is_ok(int i, int type) | 169 | handle_is_ok(int i, int type) |
170 | { | 170 | { |
171 | return i >= 0 && i < sizeof(handles)/sizeof(Handle) && | 171 | return i >= 0 && i < sizeof(handles)/sizeof(Handle) && |
172 | handles[i].use == type; | 172 | handles[i].use == type; |
173 | } | 173 | } |
174 | 174 | ||
175 | int | 175 | static int |
176 | handle_to_string(int handle, char **stringp, int *hlenp) | 176 | handle_to_string(int handle, char **stringp, int *hlenp) |
177 | { | 177 | { |
178 | if (stringp == NULL || hlenp == NULL) | 178 | if (stringp == NULL || hlenp == NULL) |
@@ -183,7 +183,7 @@ handle_to_string(int handle, char **stringp, int *hlenp) | |||
183 | return 0; | 183 | return 0; |
184 | } | 184 | } |
185 | 185 | ||
186 | int | 186 | static int |
187 | handle_from_string(char *handle, u_int hlen) | 187 | handle_from_string(char *handle, u_int hlen) |
188 | { | 188 | { |
189 | int val; | 189 | int val; |
@@ -197,7 +197,7 @@ handle_from_string(char *handle, u_int hlen) | |||
197 | return -1; | 197 | return -1; |
198 | } | 198 | } |
199 | 199 | ||
200 | char * | 200 | static char * |
201 | handle_to_name(int handle) | 201 | handle_to_name(int handle) |
202 | { | 202 | { |
203 | if (handle_is_ok(handle, HANDLE_DIR)|| | 203 | if (handle_is_ok(handle, HANDLE_DIR)|| |
@@ -206,7 +206,7 @@ handle_to_name(int handle) | |||
206 | return NULL; | 206 | return NULL; |
207 | } | 207 | } |
208 | 208 | ||
209 | DIR * | 209 | static DIR * |
210 | handle_to_dir(int handle) | 210 | handle_to_dir(int handle) |
211 | { | 211 | { |
212 | if (handle_is_ok(handle, HANDLE_DIR)) | 212 | if (handle_is_ok(handle, HANDLE_DIR)) |
@@ -214,7 +214,7 @@ handle_to_dir(int handle) | |||
214 | return NULL; | 214 | return NULL; |
215 | } | 215 | } |
216 | 216 | ||
217 | int | 217 | static int |
218 | handle_to_fd(int handle) | 218 | handle_to_fd(int handle) |
219 | { | 219 | { |
220 | if (handle_is_ok(handle, HANDLE_FILE)) | 220 | if (handle_is_ok(handle, HANDLE_FILE)) |
@@ -222,7 +222,7 @@ handle_to_fd(int handle) | |||
222 | return -1; | 222 | return -1; |
223 | } | 223 | } |
224 | 224 | ||
225 | int | 225 | static int |
226 | handle_close(int handle) | 226 | handle_close(int handle) |
227 | { | 227 | { |
228 | int ret = -1; | 228 | int ret = -1; |
@@ -239,7 +239,7 @@ handle_close(int handle) | |||
239 | return ret; | 239 | return ret; |
240 | } | 240 | } |
241 | 241 | ||
242 | int | 242 | static int |
243 | get_handle(void) | 243 | get_handle(void) |
244 | { | 244 | { |
245 | char *handle; | 245 | char *handle; |
@@ -255,7 +255,7 @@ get_handle(void) | |||
255 | 255 | ||
256 | /* send replies */ | 256 | /* send replies */ |
257 | 257 | ||
258 | void | 258 | static void |
259 | send_msg(Buffer *m) | 259 | send_msg(Buffer *m) |
260 | { | 260 | { |
261 | int mlen = buffer_len(m); | 261 | int mlen = buffer_len(m); |
@@ -265,7 +265,7 @@ send_msg(Buffer *m) | |||
265 | buffer_consume(m, mlen); | 265 | buffer_consume(m, mlen); |
266 | } | 266 | } |
267 | 267 | ||
268 | void | 268 | static void |
269 | send_status(u_int32_t id, u_int32_t error) | 269 | send_status(u_int32_t id, u_int32_t error) |
270 | { | 270 | { |
271 | Buffer msg; | 271 | Buffer msg; |
@@ -295,7 +295,7 @@ send_status(u_int32_t id, u_int32_t error) | |||
295 | send_msg(&msg); | 295 | send_msg(&msg); |
296 | buffer_free(&msg); | 296 | buffer_free(&msg); |
297 | } | 297 | } |
298 | void | 298 | static void |
299 | send_data_or_handle(char type, u_int32_t id, char *data, int dlen) | 299 | send_data_or_handle(char type, u_int32_t id, char *data, int dlen) |
300 | { | 300 | { |
301 | Buffer msg; | 301 | Buffer msg; |
@@ -308,14 +308,14 @@ send_data_or_handle(char type, u_int32_t id, char *data, int dlen) | |||
308 | buffer_free(&msg); | 308 | buffer_free(&msg); |
309 | } | 309 | } |
310 | 310 | ||
311 | void | 311 | static void |
312 | send_data(u_int32_t id, char *data, int dlen) | 312 | send_data(u_int32_t id, char *data, int dlen) |
313 | { | 313 | { |
314 | TRACE("sent data id %d len %d", id, dlen); | 314 | TRACE("sent data id %d len %d", id, dlen); |
315 | send_data_or_handle(SSH2_FXP_DATA, id, data, dlen); | 315 | send_data_or_handle(SSH2_FXP_DATA, id, data, dlen); |
316 | } | 316 | } |
317 | 317 | ||
318 | void | 318 | static void |
319 | send_handle(u_int32_t id, int handle) | 319 | send_handle(u_int32_t id, int handle) |
320 | { | 320 | { |
321 | char *string; | 321 | char *string; |
@@ -327,7 +327,7 @@ send_handle(u_int32_t id, int handle) | |||
327 | xfree(string); | 327 | xfree(string); |
328 | } | 328 | } |
329 | 329 | ||
330 | void | 330 | static void |
331 | send_names(u_int32_t id, int count, Stat *stats) | 331 | send_names(u_int32_t id, int count, Stat *stats) |
332 | { | 332 | { |
333 | Buffer msg; | 333 | Buffer msg; |
@@ -347,7 +347,7 @@ send_names(u_int32_t id, int count, Stat *stats) | |||
347 | buffer_free(&msg); | 347 | buffer_free(&msg); |
348 | } | 348 | } |
349 | 349 | ||
350 | void | 350 | static void |
351 | send_attrib(u_int32_t id, Attrib *a) | 351 | send_attrib(u_int32_t id, Attrib *a) |
352 | { | 352 | { |
353 | Buffer msg; | 353 | Buffer msg; |
@@ -363,7 +363,7 @@ send_attrib(u_int32_t id, Attrib *a) | |||
363 | 363 | ||
364 | /* parse incoming */ | 364 | /* parse incoming */ |
365 | 365 | ||
366 | void | 366 | static void |
367 | process_init(void) | 367 | process_init(void) |
368 | { | 368 | { |
369 | Buffer msg; | 369 | Buffer msg; |
@@ -377,7 +377,7 @@ process_init(void) | |||
377 | buffer_free(&msg); | 377 | buffer_free(&msg); |
378 | } | 378 | } |
379 | 379 | ||
380 | void | 380 | static void |
381 | process_open(void) | 381 | process_open(void) |
382 | { | 382 | { |
383 | u_int32_t id, pflags; | 383 | u_int32_t id, pflags; |
@@ -409,7 +409,7 @@ process_open(void) | |||
409 | xfree(name); | 409 | xfree(name); |
410 | } | 410 | } |
411 | 411 | ||
412 | void | 412 | static void |
413 | process_close(void) | 413 | process_close(void) |
414 | { | 414 | { |
415 | u_int32_t id; | 415 | u_int32_t id; |
@@ -423,7 +423,7 @@ process_close(void) | |||
423 | send_status(id, status); | 423 | send_status(id, status); |
424 | } | 424 | } |
425 | 425 | ||
426 | void | 426 | static void |
427 | process_read(void) | 427 | process_read(void) |
428 | { | 428 | { |
429 | char buf[64*1024]; | 429 | char buf[64*1024]; |
@@ -463,7 +463,7 @@ process_read(void) | |||
463 | send_status(id, status); | 463 | send_status(id, status); |
464 | } | 464 | } |
465 | 465 | ||
466 | void | 466 | static void |
467 | process_write(void) | 467 | process_write(void) |
468 | { | 468 | { |
469 | u_int32_t id; | 469 | u_int32_t id; |
@@ -501,7 +501,7 @@ process_write(void) | |||
501 | xfree(data); | 501 | xfree(data); |
502 | } | 502 | } |
503 | 503 | ||
504 | void | 504 | static void |
505 | process_do_stat(int do_lstat) | 505 | process_do_stat(int do_lstat) |
506 | { | 506 | { |
507 | Attrib a; | 507 | Attrib a; |
@@ -526,19 +526,19 @@ process_do_stat(int do_lstat) | |||
526 | xfree(name); | 526 | xfree(name); |
527 | } | 527 | } |
528 | 528 | ||
529 | void | 529 | static void |
530 | process_stat(void) | 530 | process_stat(void) |
531 | { | 531 | { |
532 | process_do_stat(0); | 532 | process_do_stat(0); |
533 | } | 533 | } |
534 | 534 | ||
535 | void | 535 | static void |
536 | process_lstat(void) | 536 | process_lstat(void) |
537 | { | 537 | { |
538 | process_do_stat(1); | 538 | process_do_stat(1); |
539 | } | 539 | } |
540 | 540 | ||
541 | void | 541 | static void |
542 | process_fstat(void) | 542 | process_fstat(void) |
543 | { | 543 | { |
544 | Attrib a; | 544 | Attrib a; |
@@ -564,7 +564,7 @@ process_fstat(void) | |||
564 | send_status(id, status); | 564 | send_status(id, status); |
565 | } | 565 | } |
566 | 566 | ||
567 | struct timeval * | 567 | static struct timeval * |
568 | attrib_to_tv(Attrib *a) | 568 | attrib_to_tv(Attrib *a) |
569 | { | 569 | { |
570 | static struct timeval tv[2]; | 570 | static struct timeval tv[2]; |
@@ -576,7 +576,7 @@ attrib_to_tv(Attrib *a) | |||
576 | return tv; | 576 | return tv; |
577 | } | 577 | } |
578 | 578 | ||
579 | void | 579 | static void |
580 | process_setstat(void) | 580 | process_setstat(void) |
581 | { | 581 | { |
582 | Attrib *a; | 582 | Attrib *a; |
@@ -608,7 +608,7 @@ process_setstat(void) | |||
608 | xfree(name); | 608 | xfree(name); |
609 | } | 609 | } |
610 | 610 | ||
611 | void | 611 | static void |
612 | process_fsetstat(void) | 612 | process_fsetstat(void) |
613 | { | 613 | { |
614 | Attrib *a; | 614 | Attrib *a; |
@@ -657,7 +657,7 @@ process_fsetstat(void) | |||
657 | send_status(id, status); | 657 | send_status(id, status); |
658 | } | 658 | } |
659 | 659 | ||
660 | void | 660 | static void |
661 | process_opendir(void) | 661 | process_opendir(void) |
662 | { | 662 | { |
663 | DIR *dirp = NULL; | 663 | DIR *dirp = NULL; |
@@ -689,7 +689,7 @@ process_opendir(void) | |||
689 | /* | 689 | /* |
690 | * drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh | 690 | * drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh |
691 | */ | 691 | */ |
692 | char * | 692 | static char * |
693 | ls_file(char *name, struct stat *st) | 693 | ls_file(char *name, struct stat *st) |
694 | { | 694 | { |
695 | int ulen, glen, sz = 0; | 695 | int ulen, glen, sz = 0; |
@@ -728,7 +728,7 @@ ls_file(char *name, struct stat *st) | |||
728 | return xstrdup(buf); | 728 | return xstrdup(buf); |
729 | } | 729 | } |
730 | 730 | ||
731 | void | 731 | static void |
732 | process_readdir(void) | 732 | process_readdir(void) |
733 | { | 733 | { |
734 | DIR *dirp; | 734 | DIR *dirp; |
@@ -782,7 +782,7 @@ process_readdir(void) | |||
782 | } | 782 | } |
783 | } | 783 | } |
784 | 784 | ||
785 | void | 785 | static void |
786 | process_remove(void) | 786 | process_remove(void) |
787 | { | 787 | { |
788 | char *name; | 788 | char *name; |
@@ -799,7 +799,7 @@ process_remove(void) | |||
799 | xfree(name); | 799 | xfree(name); |
800 | } | 800 | } |
801 | 801 | ||
802 | void | 802 | static void |
803 | process_mkdir(void) | 803 | process_mkdir(void) |
804 | { | 804 | { |
805 | Attrib *a; | 805 | Attrib *a; |
@@ -819,7 +819,7 @@ process_mkdir(void) | |||
819 | xfree(name); | 819 | xfree(name); |
820 | } | 820 | } |
821 | 821 | ||
822 | void | 822 | static void |
823 | process_rmdir(void) | 823 | process_rmdir(void) |
824 | { | 824 | { |
825 | u_int32_t id; | 825 | u_int32_t id; |
@@ -835,7 +835,7 @@ process_rmdir(void) | |||
835 | xfree(name); | 835 | xfree(name); |
836 | } | 836 | } |
837 | 837 | ||
838 | void | 838 | static void |
839 | process_realpath(void) | 839 | process_realpath(void) |
840 | { | 840 | { |
841 | char resolvedname[MAXPATHLEN]; | 841 | char resolvedname[MAXPATHLEN]; |
@@ -860,7 +860,7 @@ process_realpath(void) | |||
860 | xfree(path); | 860 | xfree(path); |
861 | } | 861 | } |
862 | 862 | ||
863 | void | 863 | static void |
864 | process_rename(void) | 864 | process_rename(void) |
865 | { | 865 | { |
866 | u_int32_t id; | 866 | u_int32_t id; |
@@ -882,7 +882,7 @@ process_rename(void) | |||
882 | xfree(newpath); | 882 | xfree(newpath); |
883 | } | 883 | } |
884 | 884 | ||
885 | void | 885 | static void |
886 | process_readlink(void) | 886 | process_readlink(void) |
887 | { | 887 | { |
888 | u_int32_t id; | 888 | u_int32_t id; |
@@ -906,7 +906,7 @@ process_readlink(void) | |||
906 | xfree(path); | 906 | xfree(path); |
907 | } | 907 | } |
908 | 908 | ||
909 | void | 909 | static void |
910 | process_symlink(void) | 910 | process_symlink(void) |
911 | { | 911 | { |
912 | u_int32_t id; | 912 | u_int32_t id; |
@@ -928,7 +928,7 @@ process_symlink(void) | |||
928 | xfree(newpath); | 928 | xfree(newpath); |
929 | } | 929 | } |
930 | 930 | ||
931 | void | 931 | static void |
932 | process_extended(void) | 932 | process_extended(void) |
933 | { | 933 | { |
934 | u_int32_t id; | 934 | u_int32_t id; |
@@ -942,7 +942,7 @@ process_extended(void) | |||
942 | 942 | ||
943 | /* stolen from ssh-agent */ | 943 | /* stolen from ssh-agent */ |
944 | 944 | ||
945 | void | 945 | static void |
946 | process(void) | 946 | process(void) |
947 | { | 947 | { |
948 | u_int msg_len; | 948 | u_int msg_len; |
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | RCSID("$OpenBSD: sftp.c,v 1.17 2001/05/08 19:45:25 mouring Exp $"); | 27 | RCSID("$OpenBSD: sftp.c,v 1.18 2001/06/23 15:12:20 itojun Exp $"); |
28 | 28 | ||
29 | /* XXX: commandline mode */ | 29 | /* XXX: commandline mode */ |
30 | /* XXX: short-form remote directory listings (like 'ls -C') */ | 30 | /* XXX: short-form remote directory listings (like 'ls -C') */ |
@@ -49,7 +49,7 @@ char *__progname; | |||
49 | char *ssh_program = _PATH_SSH_PROGRAM; | 49 | char *ssh_program = _PATH_SSH_PROGRAM; |
50 | FILE* infile; | 50 | FILE* infile; |
51 | 51 | ||
52 | void | 52 | static void |
53 | connect_to_server(char **args, int *in, int *out, pid_t *sshpid) | 53 | connect_to_server(char **args, int *in, int *out, pid_t *sshpid) |
54 | { | 54 | { |
55 | int c_in, c_out; | 55 | int c_in, c_out; |
@@ -90,7 +90,7 @@ connect_to_server(char **args, int *in, int *out, pid_t *sshpid) | |||
90 | close(c_out); | 90 | close(c_out); |
91 | } | 91 | } |
92 | 92 | ||
93 | void | 93 | static void |
94 | usage(void) | 94 | usage(void) |
95 | { | 95 | { |
96 | fprintf(stderr, "usage: sftp [-1vC] [-b batchfile] [-osshopt=value] [user@]host[:file [file]]\n"); | 96 | fprintf(stderr, "usage: sftp [-1vC] [-b batchfile] [-osshopt=value] [user@]host[:file [file]]\n"); |
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: ssh-add.c,v 1.38 2001/06/06 23:19:35 markus Exp $"); | 38 | RCSID("$OpenBSD: ssh-add.c,v 1.39 2001/06/23 15:12:20 itojun Exp $"); |
39 | 39 | ||
40 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
41 | 41 | ||
@@ -57,7 +57,7 @@ char *__progname; | |||
57 | 57 | ||
58 | /* we keep a cache of one passphrases */ | 58 | /* we keep a cache of one passphrases */ |
59 | static char *pass = NULL; | 59 | static char *pass = NULL; |
60 | void | 60 | static void |
61 | clear_pass(void) | 61 | clear_pass(void) |
62 | { | 62 | { |
63 | if (pass) { | 63 | if (pass) { |
@@ -67,7 +67,7 @@ clear_pass(void) | |||
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | void | 70 | static void |
71 | delete_file(AuthenticationConnection *ac, const char *filename) | 71 | delete_file(AuthenticationConnection *ac, const char *filename) |
72 | { | 72 | { |
73 | Key *public; | 73 | Key *public; |
@@ -87,7 +87,7 @@ delete_file(AuthenticationConnection *ac, const char *filename) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | /* Send a request to remove all identities. */ | 89 | /* Send a request to remove all identities. */ |
90 | void | 90 | static void |
91 | delete_all(AuthenticationConnection *ac) | 91 | delete_all(AuthenticationConnection *ac) |
92 | { | 92 | { |
93 | int success = 1; | 93 | int success = 1; |
@@ -103,7 +103,7 @@ delete_all(AuthenticationConnection *ac) | |||
103 | fprintf(stderr, "Failed to remove all identities.\n"); | 103 | fprintf(stderr, "Failed to remove all identities.\n"); |
104 | } | 104 | } |
105 | 105 | ||
106 | void | 106 | static void |
107 | add_file(AuthenticationConnection *ac, const char *filename) | 107 | add_file(AuthenticationConnection *ac, const char *filename) |
108 | { | 108 | { |
109 | struct stat st; | 109 | struct stat st; |
@@ -149,7 +149,7 @@ add_file(AuthenticationConnection *ac, const char *filename) | |||
149 | key_free(private); | 149 | key_free(private); |
150 | } | 150 | } |
151 | 151 | ||
152 | void | 152 | static void |
153 | list_identities(AuthenticationConnection *ac, int do_fp) | 153 | list_identities(AuthenticationConnection *ac, int do_fp) |
154 | { | 154 | { |
155 | Key *key; | 155 | Key *key; |
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); |
diff --git a/ssh-keygen.c b/ssh-keygen.c index bd7eea9af..22946587f 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: ssh-keygen.c,v 1.62 2001/06/23 06:41:10 markus Exp $"); | 15 | RCSID("$OpenBSD: ssh-keygen.c,v 1.63 2001/06/23 15:12:20 itojun Exp $"); |
16 | 16 | ||
17 | #include <openssl/evp.h> | 17 | #include <openssl/evp.h> |
18 | #include <openssl/pem.h> | 18 | #include <openssl/pem.h> |
@@ -79,7 +79,7 @@ char *__progname; | |||
79 | 79 | ||
80 | char hostname[MAXHOSTNAMELEN]; | 80 | char hostname[MAXHOSTNAMELEN]; |
81 | 81 | ||
82 | void | 82 | static void |
83 | ask_filename(struct passwd *pw, const char *prompt) | 83 | ask_filename(struct passwd *pw, const char *prompt) |
84 | { | 84 | { |
85 | char buf[1024]; | 85 | char buf[1024]; |
@@ -112,7 +112,7 @@ ask_filename(struct passwd *pw, const char *prompt) | |||
112 | have_identity = 1; | 112 | have_identity = 1; |
113 | } | 113 | } |
114 | 114 | ||
115 | Key * | 115 | static Key * |
116 | load_identity(char *filename) | 116 | load_identity(char *filename) |
117 | { | 117 | { |
118 | char *pass; | 118 | char *pass; |
@@ -136,7 +136,7 @@ load_identity(char *filename) | |||
136 | #define SSH_COM_PRIVATE_BEGIN "---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----" | 136 | #define SSH_COM_PRIVATE_BEGIN "---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----" |
137 | #define SSH_COM_PRIVATE_KEY_MAGIC 0x3f6ff9eb | 137 | #define SSH_COM_PRIVATE_KEY_MAGIC 0x3f6ff9eb |
138 | 138 | ||
139 | void | 139 | static void |
140 | do_convert_to_ssh2(struct passwd *pw) | 140 | do_convert_to_ssh2(struct passwd *pw) |
141 | { | 141 | { |
142 | Key *k; | 142 | Key *k; |
@@ -169,7 +169,7 @@ do_convert_to_ssh2(struct passwd *pw) | |||
169 | exit(0); | 169 | exit(0); |
170 | } | 170 | } |
171 | 171 | ||
172 | void | 172 | static void |
173 | buffer_get_bignum_bits(Buffer *b, BIGNUM *value) | 173 | buffer_get_bignum_bits(Buffer *b, BIGNUM *value) |
174 | { | 174 | { |
175 | int bits = buffer_get_int(b); | 175 | int bits = buffer_get_int(b); |
@@ -182,7 +182,7 @@ buffer_get_bignum_bits(Buffer *b, BIGNUM *value) | |||
182 | buffer_consume(b, bytes); | 182 | buffer_consume(b, bytes); |
183 | } | 183 | } |
184 | 184 | ||
185 | Key * | 185 | static Key * |
186 | do_convert_private_ssh2_from_blob(char *blob, int blen) | 186 | do_convert_private_ssh2_from_blob(char *blob, int blen) |
187 | { | 187 | { |
188 | Buffer b; | 188 | Buffer b; |
@@ -277,7 +277,7 @@ do_convert_private_ssh2_from_blob(char *blob, int blen) | |||
277 | return key; | 277 | return key; |
278 | } | 278 | } |
279 | 279 | ||
280 | void | 280 | static void |
281 | do_convert_from_ssh2(struct passwd *pw) | 281 | do_convert_from_ssh2(struct passwd *pw) |
282 | { | 282 | { |
283 | Key *k; | 283 | Key *k; |
@@ -350,7 +350,7 @@ do_convert_from_ssh2(struct passwd *pw) | |||
350 | exit(0); | 350 | exit(0); |
351 | } | 351 | } |
352 | 352 | ||
353 | void | 353 | static void |
354 | do_print_public(struct passwd *pw) | 354 | do_print_public(struct passwd *pw) |
355 | { | 355 | { |
356 | Key *prv; | 356 | Key *prv; |
@@ -374,7 +374,7 @@ do_print_public(struct passwd *pw) | |||
374 | exit(0); | 374 | exit(0); |
375 | } | 375 | } |
376 | 376 | ||
377 | void | 377 | static void |
378 | do_fingerprint(struct passwd *pw) | 378 | do_fingerprint(struct passwd *pw) |
379 | { | 379 | { |
380 | FILE *f; | 380 | FILE *f; |
@@ -471,7 +471,7 @@ do_fingerprint(struct passwd *pw) | |||
471 | * Perform changing a passphrase. The argument is the passwd structure | 471 | * Perform changing a passphrase. The argument is the passwd structure |
472 | * for the current user. | 472 | * for the current user. |
473 | */ | 473 | */ |
474 | void | 474 | static void |
475 | do_change_passphrase(struct passwd *pw) | 475 | do_change_passphrase(struct passwd *pw) |
476 | { | 476 | { |
477 | char *comment; | 477 | char *comment; |
@@ -547,7 +547,7 @@ do_change_passphrase(struct passwd *pw) | |||
547 | /* | 547 | /* |
548 | * Change the comment of a private key file. | 548 | * Change the comment of a private key file. |
549 | */ | 549 | */ |
550 | void | 550 | static void |
551 | do_change_comment(struct passwd *pw) | 551 | do_change_comment(struct passwd *pw) |
552 | { | 552 | { |
553 | char new_comment[1024], *comment, *passphrase; | 553 | char new_comment[1024], *comment, *passphrase; |
@@ -640,7 +640,7 @@ do_change_comment(struct passwd *pw) | |||
640 | exit(0); | 640 | exit(0); |
641 | } | 641 | } |
642 | 642 | ||
643 | void | 643 | static void |
644 | usage(void) | 644 | usage(void) |
645 | { | 645 | { |
646 | printf("Usage: %s [-ceilpqyB] [-t type] [-b bits] [-f file] [-C comment] " | 646 | printf("Usage: %s [-ceilpqyB] [-t type] [-b bits] [-f file] [-C comment] " |
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index da34f7c63..9f7aa94aa 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "includes.h" | 9 | #include "includes.h" |
10 | RCSID("$OpenBSD: ssh-keyscan.c,v 1.23 2001/06/05 05:05:39 pvalchev Exp $"); | 10 | RCSID("$OpenBSD: ssh-keyscan.c,v 1.24 2001/06/23 15:12:20 itojun Exp $"); |
11 | 11 | ||
12 | #if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) | 12 | #if defined(HAVE_SYS_QUEUE_H) && !defined(HAVE_BOGUS_SYS_QUEUE_H) |
13 | #include <sys/queue.h> | 13 | #include <sys/queue.h> |
@@ -90,7 +90,7 @@ typedef struct { | |||
90 | void (*errfun) (const char *,...); | 90 | void (*errfun) (const char *,...); |
91 | } Linebuf; | 91 | } Linebuf; |
92 | 92 | ||
93 | Linebuf * | 93 | static Linebuf * |
94 | Linebuf_alloc(const char *filename, void (*errfun) (const char *,...)) | 94 | Linebuf_alloc(const char *filename, void (*errfun) (const char *,...)) |
95 | { | 95 | { |
96 | Linebuf *lb; | 96 | Linebuf *lb; |
@@ -124,7 +124,7 @@ Linebuf_alloc(const char *filename, void (*errfun) (const char *,...)) | |||
124 | return (lb); | 124 | return (lb); |
125 | } | 125 | } |
126 | 126 | ||
127 | void | 127 | static void |
128 | Linebuf_free(Linebuf * lb) | 128 | Linebuf_free(Linebuf * lb) |
129 | { | 129 | { |
130 | fclose(lb->stream); | 130 | fclose(lb->stream); |
@@ -132,7 +132,8 @@ Linebuf_free(Linebuf * lb) | |||
132 | xfree(lb); | 132 | xfree(lb); |
133 | } | 133 | } |
134 | 134 | ||
135 | void | 135 | #if 0 |
136 | static void | ||
136 | Linebuf_restart(Linebuf * lb) | 137 | Linebuf_restart(Linebuf * lb) |
137 | { | 138 | { |
138 | clearerr(lb->stream); | 139 | clearerr(lb->stream); |
@@ -140,13 +141,14 @@ Linebuf_restart(Linebuf * lb) | |||
140 | lb->lineno = 0; | 141 | lb->lineno = 0; |
141 | } | 142 | } |
142 | 143 | ||
143 | int | 144 | static int |
144 | Linebuf_lineno(Linebuf * lb) | 145 | Linebuf_lineno(Linebuf * lb) |
145 | { | 146 | { |
146 | return (lb->lineno); | 147 | return (lb->lineno); |
147 | } | 148 | } |
149 | #endif | ||
148 | 150 | ||
149 | char * | 151 | static char * |
150 | Linebuf_getline(Linebuf * lb) | 152 | Linebuf_getline(Linebuf * lb) |
151 | { | 153 | { |
152 | int n = 0; | 154 | int n = 0; |
@@ -183,7 +185,7 @@ Linebuf_getline(Linebuf * lb) | |||
183 | } | 185 | } |
184 | } | 186 | } |
185 | 187 | ||
186 | int | 188 | static int |
187 | fdlim_get(int hard) | 189 | fdlim_get(int hard) |
188 | { | 190 | { |
189 | #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) | 191 | #if defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE) |
@@ -202,7 +204,7 @@ fdlim_get(int hard) | |||
202 | #endif | 204 | #endif |
203 | } | 205 | } |
204 | 206 | ||
205 | int | 207 | static int |
206 | fdlim_set(int lim) | 208 | fdlim_set(int lim) |
207 | { | 209 | { |
208 | #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE) | 210 | #if defined(HAVE_SETRLIMIT) && defined(RLIMIT_NOFILE) |
@@ -227,7 +229,7 @@ fdlim_set(int lim) | |||
227 | * separators. This is the same as the 4.4BSD strsep, but different from the | 229 | * separators. This is the same as the 4.4BSD strsep, but different from the |
228 | * one in the GNU libc. | 230 | * one in the GNU libc. |
229 | */ | 231 | */ |
230 | char * | 232 | static char * |
231 | xstrsep(char **str, const char *delim) | 233 | xstrsep(char **str, const char *delim) |
232 | { | 234 | { |
233 | char *s, *e; | 235 | char *s, *e; |
@@ -249,7 +251,7 @@ xstrsep(char **str, const char *delim) | |||
249 | * Get the next non-null token (like GNU strsep). Strsep() will return a | 251 | * Get the next non-null token (like GNU strsep). Strsep() will return a |
250 | * null token for two adjacent separators, so we may have to loop. | 252 | * null token for two adjacent separators, so we may have to loop. |
251 | */ | 253 | */ |
252 | char * | 254 | static char * |
253 | strnnsep(char **stringp, char *delim) | 255 | strnnsep(char **stringp, char *delim) |
254 | { | 256 | { |
255 | char *tok; | 257 | char *tok; |
@@ -260,7 +262,7 @@ strnnsep(char **stringp, char *delim) | |||
260 | return (tok); | 262 | return (tok); |
261 | } | 263 | } |
262 | 264 | ||
263 | void | 265 | static void |
264 | keyprint(char *host, char *output_name, char *kd, int len) | 266 | keyprint(char *host, char *output_name, char *kd, int len) |
265 | { | 267 | { |
266 | static Key *rsa; | 268 | static Key *rsa; |
@@ -295,7 +297,7 @@ keyprint(char *host, char *output_name, char *kd, int len) | |||
295 | fputs("\n", stdout); | 297 | fputs("\n", stdout); |
296 | } | 298 | } |
297 | 299 | ||
298 | int | 300 | static int |
299 | tcpconnect(char *host) | 301 | tcpconnect(char *host) |
300 | { | 302 | { |
301 | struct addrinfo hints, *ai, *aitop; | 303 | struct addrinfo hints, *ai, *aitop; |
@@ -328,7 +330,7 @@ tcpconnect(char *host) | |||
328 | return s; | 330 | return s; |
329 | } | 331 | } |
330 | 332 | ||
331 | int | 333 | static int |
332 | conalloc(char *iname, char *oname) | 334 | conalloc(char *iname, char *oname) |
333 | { | 335 | { |
334 | int s; | 336 | int s; |
@@ -366,7 +368,7 @@ conalloc(char *iname, char *oname) | |||
366 | return (s); | 368 | return (s); |
367 | } | 369 | } |
368 | 370 | ||
369 | void | 371 | static void |
370 | confree(int s) | 372 | confree(int s) |
371 | { | 373 | { |
372 | if (s >= maxfd || fdcon[s].c_status == CS_UNUSED) | 374 | if (s >= maxfd || fdcon[s].c_status == CS_UNUSED) |
@@ -382,7 +384,7 @@ confree(int s) | |||
382 | ncon--; | 384 | ncon--; |
383 | } | 385 | } |
384 | 386 | ||
385 | void | 387 | static void |
386 | contouch(int s) | 388 | contouch(int s) |
387 | { | 389 | { |
388 | TAILQ_REMOVE(&tq, &fdcon[s], c_link); | 390 | TAILQ_REMOVE(&tq, &fdcon[s], c_link); |
@@ -391,7 +393,7 @@ contouch(int s) | |||
391 | TAILQ_INSERT_TAIL(&tq, &fdcon[s], c_link); | 393 | TAILQ_INSERT_TAIL(&tq, &fdcon[s], c_link); |
392 | } | 394 | } |
393 | 395 | ||
394 | int | 396 | static int |
395 | conrecycle(int s) | 397 | conrecycle(int s) |
396 | { | 398 | { |
397 | int ret; | 399 | int ret; |
@@ -407,7 +409,7 @@ conrecycle(int s) | |||
407 | return (ret); | 409 | return (ret); |
408 | } | 410 | } |
409 | 411 | ||
410 | void | 412 | static void |
411 | congreet(int s) | 413 | congreet(int s) |
412 | { | 414 | { |
413 | char buf[80], *cp; | 415 | char buf[80], *cp; |
@@ -442,7 +444,7 @@ congreet(int s) | |||
442 | contouch(s); | 444 | contouch(s); |
443 | } | 445 | } |
444 | 446 | ||
445 | void | 447 | static void |
446 | conread(int s) | 448 | conread(int s) |
447 | { | 449 | { |
448 | int n; | 450 | int n; |
@@ -482,7 +484,7 @@ conread(int s) | |||
482 | contouch(s); | 484 | contouch(s); |
483 | } | 485 | } |
484 | 486 | ||
485 | void | 487 | static void |
486 | conloop(void) | 488 | conloop(void) |
487 | { | 489 | { |
488 | fd_set *r, *e; | 490 | fd_set *r, *e; |
@@ -534,7 +536,7 @@ conloop(void) | |||
534 | } | 536 | } |
535 | } | 537 | } |
536 | 538 | ||
537 | char * | 539 | static char * |
538 | nexthost(int argc, char **argv) | 540 | nexthost(int argc, char **argv) |
539 | { | 541 | { |
540 | static Linebuf *lb; | 542 | static Linebuf *lb; |
@@ -577,7 +579,7 @@ nexthost(int argc, char **argv) | |||
577 | } | 579 | } |
578 | } | 580 | } |
579 | 581 | ||
580 | void | 582 | static void |
581 | usage(void) | 583 | usage(void) |
582 | { | 584 | { |
583 | fatal("usage: %s [-t timeout] { [--] host | -f file } ...", __progname); | 585 | fatal("usage: %s [-t timeout] { [--] host | -f file } ...", __progname); |
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: ssh.c,v 1.125 2001/06/22 23:35:21 markus Exp $"); | 42 | RCSID("$OpenBSD: ssh.c,v 1.126 2001/06/23 15:12:21 itojun Exp $"); |
43 | 43 | ||
44 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
45 | #include <openssl/err.h> | 45 | #include <openssl/err.h> |
@@ -148,7 +148,7 @@ int subsystem_flag = 0; | |||
148 | 148 | ||
149 | /* Prints a help message to the user. This function never returns. */ | 149 | /* Prints a help message to the user. This function never returns. */ |
150 | 150 | ||
151 | void | 151 | static void |
152 | usage(void) | 152 | usage(void) |
153 | { | 153 | { |
154 | fprintf(stderr, "Usage: %s [options] host [command]\n", __progname); | 154 | fprintf(stderr, "Usage: %s [options] host [command]\n", __progname); |
@@ -198,7 +198,7 @@ usage(void) | |||
198 | * Connects to the given host using rsh (or prints an error message and exits | 198 | * Connects to the given host using rsh (or prints an error message and exits |
199 | * if rsh is not available). This function never returns. | 199 | * if rsh is not available). This function never returns. |
200 | */ | 200 | */ |
201 | void | 201 | static void |
202 | rsh_connect(char *host, char *user, Buffer * command) | 202 | rsh_connect(char *host, char *user, Buffer * command) |
203 | { | 203 | { |
204 | char *args[10]; | 204 | char *args[10]; |
@@ -232,9 +232,9 @@ rsh_connect(char *host, char *user, Buffer * command) | |||
232 | exit(1); | 232 | exit(1); |
233 | } | 233 | } |
234 | 234 | ||
235 | int ssh_session(void); | 235 | static int ssh_session(void); |
236 | int ssh_session2(void); | 236 | static int ssh_session2(void); |
237 | void load_public_identity_files(void); | 237 | static void load_public_identity_files(void); |
238 | 238 | ||
239 | /* | 239 | /* |
240 | * Main program for the ssh client. | 240 | * Main program for the ssh client. |
@@ -742,7 +742,7 @@ main(int ac, char **av) | |||
742 | return exit_status; | 742 | return exit_status; |
743 | } | 743 | } |
744 | 744 | ||
745 | void | 745 | static void |
746 | x11_get_proto(char *proto, int proto_len, char *data, int data_len) | 746 | x11_get_proto(char *proto, int proto_len, char *data, int data_len) |
747 | { | 747 | { |
748 | char line[512]; | 748 | char line[512]; |
@@ -781,7 +781,7 @@ x11_get_proto(char *proto, int proto_len, char *data, int data_len) | |||
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | void | 784 | static void |
785 | ssh_init_forwarding(void) | 785 | ssh_init_forwarding(void) |
786 | { | 786 | { |
787 | int success = 0; | 787 | int success = 0; |
@@ -815,7 +815,7 @@ ssh_init_forwarding(void) | |||
815 | } | 815 | } |
816 | } | 816 | } |
817 | 817 | ||
818 | void | 818 | static void |
819 | check_agent_present(void) | 819 | check_agent_present(void) |
820 | { | 820 | { |
821 | if (options.forward_agent) { | 821 | if (options.forward_agent) { |
@@ -828,7 +828,7 @@ check_agent_present(void) | |||
828 | } | 828 | } |
829 | } | 829 | } |
830 | 830 | ||
831 | int | 831 | static int |
832 | ssh_session(void) | 832 | ssh_session(void) |
833 | { | 833 | { |
834 | int type; | 834 | int type; |
@@ -966,7 +966,7 @@ ssh_session(void) | |||
966 | options.escape_char : SSH_ESCAPECHAR_NONE, 0); | 966 | options.escape_char : SSH_ESCAPECHAR_NONE, 0); |
967 | } | 967 | } |
968 | 968 | ||
969 | void | 969 | static void |
970 | client_subsystem_reply(int type, int plen, void *ctxt) | 970 | client_subsystem_reply(int type, int plen, void *ctxt) |
971 | { | 971 | { |
972 | int id, len; | 972 | int id, len; |
@@ -981,7 +981,7 @@ client_subsystem_reply(int type, int plen, void *ctxt) | |||
981 | len, buffer_ptr(&command), id); | 981 | len, buffer_ptr(&command), id); |
982 | } | 982 | } |
983 | 983 | ||
984 | void | 984 | static void |
985 | ssh_session2_callback(int id, void *arg) | 985 | ssh_session2_callback(int id, void *arg) |
986 | { | 986 | { |
987 | int len; | 987 | int len; |
@@ -1057,7 +1057,7 @@ ssh_session2_callback(int id, void *arg) | |||
1057 | packet_set_interactive(interactive); | 1057 | packet_set_interactive(interactive); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | int | 1060 | static int |
1061 | ssh_session2_command(void) | 1061 | ssh_session2_command(void) |
1062 | { | 1062 | { |
1063 | Channel *c; | 1063 | Channel *c; |
@@ -1104,7 +1104,7 @@ ssh_session2_command(void) | |||
1104 | return c->self; | 1104 | return c->self; |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | int | 1107 | static int |
1108 | ssh_session2(void) | 1108 | ssh_session2(void) |
1109 | { | 1109 | { |
1110 | int id; | 1110 | int id; |
@@ -1123,7 +1123,7 @@ ssh_session2(void) | |||
1123 | options.escape_char : SSH_ESCAPECHAR_NONE, id); | 1123 | options.escape_char : SSH_ESCAPECHAR_NONE, id); |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | void | 1126 | static void |
1127 | load_public_identity_files(void) | 1127 | load_public_identity_files(void) |
1128 | { | 1128 | { |
1129 | char *filename; | 1129 | char *filename; |
diff --git a/sshconnect.c b/sshconnect.c index 1766de0c3..745eeb5c3 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -13,7 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "includes.h" | 15 | #include "includes.h" |
16 | RCSID("$OpenBSD: sshconnect.c,v 1.108 2001/06/23 02:34:31 markus Exp $"); | 16 | RCSID("$OpenBSD: sshconnect.c,v 1.109 2001/06/23 15:12:21 itojun Exp $"); |
17 | 17 | ||
18 | #include <openssl/bn.h> | 18 | #include <openssl/bn.h> |
19 | 19 | ||
@@ -44,7 +44,7 @@ extern int IPv4or6; | |||
44 | /* | 44 | /* |
45 | * Connect to the given ssh server using a proxy command. | 45 | * Connect to the given ssh server using a proxy command. |
46 | */ | 46 | */ |
47 | int | 47 | static int |
48 | ssh_proxy_connect(const char *host, u_short port, struct passwd *pw, | 48 | ssh_proxy_connect(const char *host, u_short port, struct passwd *pw, |
49 | const char *proxy_command) | 49 | const char *proxy_command) |
50 | { | 50 | { |
@@ -144,7 +144,7 @@ ssh_proxy_connect(const char *host, u_short port, struct passwd *pw, | |||
144 | /* | 144 | /* |
145 | * Creates a (possibly privileged) socket for use as the ssh connection. | 145 | * Creates a (possibly privileged) socket for use as the ssh connection. |
146 | */ | 146 | */ |
147 | int | 147 | static int |
148 | ssh_create_socket(struct passwd *pw, int privileged, int family) | 148 | ssh_create_socket(struct passwd *pw, int privileged, int family) |
149 | { | 149 | { |
150 | int sock, gaierr; | 150 | int sock, gaierr; |
@@ -345,7 +345,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
345 | * Waits for the server identification string, and sends our own | 345 | * Waits for the server identification string, and sends our own |
346 | * identification string. | 346 | * identification string. |
347 | */ | 347 | */ |
348 | void | 348 | static void |
349 | ssh_exchange_identification(void) | 349 | ssh_exchange_identification(void) |
350 | { | 350 | { |
351 | char buf[256], remote_version[256]; /* must be same size! */ | 351 | char buf[256], remote_version[256]; /* must be same size! */ |
@@ -444,7 +444,7 @@ ssh_exchange_identification(void) | |||
444 | } | 444 | } |
445 | 445 | ||
446 | /* defaults to 'no' */ | 446 | /* defaults to 'no' */ |
447 | int | 447 | static int |
448 | read_yes_or_no(const char *prompt, int defval) | 448 | read_yes_or_no(const char *prompt, int defval) |
449 | { | 449 | { |
450 | char buf[1024]; | 450 | char buf[1024]; |
@@ -500,7 +500,7 @@ read_yes_or_no(const char *prompt, int defval) | |||
500 | * is not valid. the user_hostfile will not be updated if 'readonly' is true. | 500 | * is not valid. the user_hostfile will not be updated if 'readonly' is true. |
501 | */ | 501 | */ |
502 | 502 | ||
503 | int | 503 | static int |
504 | check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, | 504 | check_host_key(char *host, struct sockaddr *hostaddr, Key *host_key, |
505 | int readonly, const char *user_hostfile, const char *system_hostfile) | 505 | int readonly, const char *user_hostfile, const char *system_hostfile) |
506 | { | 506 | { |
diff --git a/sshconnect1.c b/sshconnect1.c index 4c469c20d..a03233f28 100644 --- a/sshconnect1.c +++ b/sshconnect1.c | |||
@@ -13,7 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "includes.h" | 15 | #include "includes.h" |
16 | RCSID("$OpenBSD: sshconnect1.c,v 1.34 2001/06/23 02:34:32 markus Exp $"); | 16 | RCSID("$OpenBSD: sshconnect1.c,v 1.35 2001/06/23 15:12:21 itojun Exp $"); |
17 | 17 | ||
18 | #include <openssl/bn.h> | 18 | #include <openssl/bn.h> |
19 | #include <openssl/evp.h> | 19 | #include <openssl/evp.h> |
@@ -55,7 +55,7 @@ extern char *__progname; | |||
55 | * Checks if the user has an authentication agent, and if so, tries to | 55 | * Checks if the user has an authentication agent, and if so, tries to |
56 | * authenticate using the agent. | 56 | * authenticate using the agent. |
57 | */ | 57 | */ |
58 | int | 58 | static int |
59 | try_agent_authentication(void) | 59 | try_agent_authentication(void) |
60 | { | 60 | { |
61 | int type; | 61 | int type; |
@@ -155,7 +155,7 @@ try_agent_authentication(void) | |||
155 | * Computes the proper response to a RSA challenge, and sends the response to | 155 | * Computes the proper response to a RSA challenge, and sends the response to |
156 | * the server. | 156 | * the server. |
157 | */ | 157 | */ |
158 | void | 158 | static void |
159 | respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv) | 159 | respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv) |
160 | { | 160 | { |
161 | u_char buf[32], response[16]; | 161 | u_char buf[32], response[16]; |
@@ -200,7 +200,7 @@ respond_to_rsa_challenge(BIGNUM * challenge, RSA * prv) | |||
200 | * Checks if the user has authentication file, and if so, tries to authenticate | 200 | * Checks if the user has authentication file, and if so, tries to authenticate |
201 | * the user using it. | 201 | * the user using it. |
202 | */ | 202 | */ |
203 | int | 203 | static int |
204 | try_rsa_authentication(const char *authfile) | 204 | try_rsa_authentication(const char *authfile) |
205 | { | 205 | { |
206 | BIGNUM *challenge; | 206 | BIGNUM *challenge; |
@@ -321,7 +321,7 @@ try_rsa_authentication(const char *authfile) | |||
321 | * Tries to authenticate the user using combined rhosts or /etc/hosts.equiv | 321 | * Tries to authenticate the user using combined rhosts or /etc/hosts.equiv |
322 | * authentication and RSA host authentication. | 322 | * authentication and RSA host authentication. |
323 | */ | 323 | */ |
324 | int | 324 | static int |
325 | try_rhosts_rsa_authentication(const char *local_user, Key * host_key) | 325 | try_rhosts_rsa_authentication(const char *local_user, Key * host_key) |
326 | { | 326 | { |
327 | int type; | 327 | int type; |
@@ -379,7 +379,7 @@ try_rhosts_rsa_authentication(const char *local_user, Key * host_key) | |||
379 | } | 379 | } |
380 | 380 | ||
381 | #ifdef KRB4 | 381 | #ifdef KRB4 |
382 | int | 382 | static int |
383 | try_kerberos_authentication(void) | 383 | try_kerberos_authentication(void) |
384 | { | 384 | { |
385 | KTEXT_ST auth; /* Kerberos data */ | 385 | KTEXT_ST auth; /* Kerberos data */ |
@@ -496,7 +496,7 @@ try_kerberos_authentication(void) | |||
496 | #endif /* KRB4 */ | 496 | #endif /* KRB4 */ |
497 | 497 | ||
498 | #ifdef AFS | 498 | #ifdef AFS |
499 | int | 499 | static int |
500 | send_kerberos_tgt(void) | 500 | send_kerberos_tgt(void) |
501 | { | 501 | { |
502 | CREDENTIALS *creds; | 502 | CREDENTIALS *creds; |
@@ -541,7 +541,7 @@ send_kerberos_tgt(void) | |||
541 | return 1; | 541 | return 1; |
542 | } | 542 | } |
543 | 543 | ||
544 | void | 544 | static void |
545 | send_afs_tokens(void) | 545 | send_afs_tokens(void) |
546 | { | 546 | { |
547 | CREDENTIALS creds; | 547 | CREDENTIALS creds; |
@@ -615,7 +615,7 @@ send_afs_tokens(void) | |||
615 | * Tries to authenticate with any string-based challenge/response system. | 615 | * Tries to authenticate with any string-based challenge/response system. |
616 | * Note that the client code is not tied to s/key or TIS. | 616 | * Note that the client code is not tied to s/key or TIS. |
617 | */ | 617 | */ |
618 | int | 618 | static int |
619 | try_challenge_response_authentication(void) | 619 | try_challenge_response_authentication(void) |
620 | { | 620 | { |
621 | int type, i; | 621 | int type, i; |
@@ -677,7 +677,7 @@ try_challenge_response_authentication(void) | |||
677 | /* | 677 | /* |
678 | * Tries to authenticate with plain passwd authentication. | 678 | * Tries to authenticate with plain passwd authentication. |
679 | */ | 679 | */ |
680 | int | 680 | static int |
681 | try_password_authentication(char *prompt) | 681 | try_password_authentication(char *prompt) |
682 | { | 682 | { |
683 | int type, i, payload_len; | 683 | int type, i, payload_len; |
diff --git a/sshconnect2.c b/sshconnect2.c index e2d64d7b1..1f57c3a9f 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.75 2001/06/23 02:34:33 markus Exp $"); | 26 | RCSID("$OpenBSD: sshconnect2.c,v 1.76 2001/06/23 15:12:21 itojun Exp $"); |
27 | 27 | ||
28 | #include <openssl/bn.h> | 28 | #include <openssl/bn.h> |
29 | #include <openssl/md5.h> | 29 | #include <openssl/md5.h> |
@@ -72,7 +72,7 @@ struct sockaddr *xxx_hostaddr; | |||
72 | 72 | ||
73 | Kex *xxx_kex = NULL; | 73 | Kex *xxx_kex = NULL; |
74 | 74 | ||
75 | int | 75 | static int |
76 | verify_host_key_callback(Key *hostkey) | 76 | verify_host_key_callback(Key *hostkey) |
77 | { | 77 | { |
78 | if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1) | 78 | if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1) |
@@ -188,14 +188,12 @@ int userauth_hostbased(Authctxt *authctxt); | |||
188 | 188 | ||
189 | void userauth(Authctxt *authctxt, char *authlist); | 189 | void userauth(Authctxt *authctxt, char *authlist); |
190 | 190 | ||
191 | int | 191 | static int sign_and_send_pubkey(Authctxt *, Key *, sign_cb_fn *); |
192 | sign_and_send_pubkey(Authctxt *authctxt, Key *k, | 192 | static void clear_auth_state(Authctxt *); |
193 | sign_cb_fn *sign_callback); | ||
194 | void clear_auth_state(Authctxt *authctxt); | ||
195 | 193 | ||
196 | Authmethod *authmethod_get(char *authlist); | 194 | static Authmethod *authmethod_get(char *authlist); |
197 | Authmethod *authmethod_lookup(const char *name); | 195 | static Authmethod *authmethod_lookup(const char *name); |
198 | char *authmethods_get(void); | 196 | static char *authmethods_get(void); |
199 | 197 | ||
200 | Authmethod authmethods[] = { | 198 | Authmethod authmethods[] = { |
201 | {"publickey", | 199 | {"publickey", |
@@ -477,7 +475,7 @@ clear_auth_state(Authctxt *authctxt) | |||
477 | authctxt->last_key_sign = NULL; | 475 | authctxt->last_key_sign = NULL; |
478 | } | 476 | } |
479 | 477 | ||
480 | int | 478 | static int |
481 | sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback) | 479 | sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback) |
482 | { | 480 | { |
483 | Buffer b; | 481 | Buffer b; |
@@ -562,7 +560,7 @@ sign_and_send_pubkey(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback) | |||
562 | return 1; | 560 | return 1; |
563 | } | 561 | } |
564 | 562 | ||
565 | int | 563 | static int |
566 | send_pubkey_test(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback, | 564 | send_pubkey_test(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback, |
567 | int hint) | 565 | int hint) |
568 | { | 566 | { |
@@ -595,7 +593,7 @@ send_pubkey_test(Authctxt *authctxt, Key *k, sign_cb_fn *sign_callback, | |||
595 | return 1; | 593 | return 1; |
596 | } | 594 | } |
597 | 595 | ||
598 | Key * | 596 | static Key * |
599 | load_identity_file(char *filename) | 597 | load_identity_file(char *filename) |
600 | { | 598 | { |
601 | Key *private; | 599 | Key *private; |
@@ -633,7 +631,7 @@ load_identity_file(char *filename) | |||
633 | return private; | 631 | return private; |
634 | } | 632 | } |
635 | 633 | ||
636 | int | 634 | static int |
637 | identity_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, | 635 | identity_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, |
638 | u_char *data, int datalen) | 636 | u_char *data, int datalen) |
639 | { | 637 | { |
@@ -651,19 +649,21 @@ identity_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, | |||
651 | return ret; | 649 | return ret; |
652 | } | 650 | } |
653 | 651 | ||
654 | int agent_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, | 652 | static int |
653 | agent_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, | ||
655 | u_char *data, int datalen) | 654 | u_char *data, int datalen) |
656 | { | 655 | { |
657 | return ssh_agent_sign(authctxt->agent, key, sigp, lenp, data, datalen); | 656 | return ssh_agent_sign(authctxt->agent, key, sigp, lenp, data, datalen); |
658 | } | 657 | } |
659 | 658 | ||
660 | int key_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, | 659 | static int |
660 | key_sign_cb(Authctxt *authctxt, Key *key, u_char **sigp, int *lenp, | ||
661 | u_char *data, int datalen) | 661 | u_char *data, int datalen) |
662 | { | 662 | { |
663 | return key_sign(key, sigp, lenp, data, datalen); | 663 | return key_sign(key, sigp, lenp, data, datalen); |
664 | } | 664 | } |
665 | 665 | ||
666 | int | 666 | static int |
667 | userauth_pubkey_agent(Authctxt *authctxt) | 667 | userauth_pubkey_agent(Authctxt *authctxt) |
668 | { | 668 | { |
669 | static int called = 0; | 669 | static int called = 0; |
@@ -900,7 +900,7 @@ userauth_hostbased(Authctxt *authctxt) | |||
900 | * given auth method name, if configurable options permit this method fill | 900 | * given auth method name, if configurable options permit this method fill |
901 | * in auth_ident field and return true, otherwise return false. | 901 | * in auth_ident field and return true, otherwise return false. |
902 | */ | 902 | */ |
903 | int | 903 | static int |
904 | authmethod_is_enabled(Authmethod *method) | 904 | authmethod_is_enabled(Authmethod *method) |
905 | { | 905 | { |
906 | if (method == NULL) | 906 | if (method == NULL) |
@@ -914,7 +914,7 @@ authmethod_is_enabled(Authmethod *method) | |||
914 | return 1; | 914 | return 1; |
915 | } | 915 | } |
916 | 916 | ||
917 | Authmethod * | 917 | static Authmethod * |
918 | authmethod_lookup(const char *name) | 918 | authmethod_lookup(const char *name) |
919 | { | 919 | { |
920 | Authmethod *method = NULL; | 920 | Authmethod *method = NULL; |
@@ -935,7 +935,7 @@ static char *preferred = NULL; | |||
935 | * next method we should try. If the server initially sends a nil list, | 935 | * next method we should try. If the server initially sends a nil list, |
936 | * use a built-in default list. | 936 | * use a built-in default list. |
937 | */ | 937 | */ |
938 | Authmethod * | 938 | static Authmethod * |
939 | authmethod_get(char *authlist) | 939 | authmethod_get(char *authlist) |
940 | { | 940 | { |
941 | 941 | ||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: sshd.c,v 1.199 2001/06/04 23:07:21 markus Exp $"); | 43 | RCSID("$OpenBSD: sshd.c,v 1.200 2001/06/23 15:12:21 itojun Exp $"); |
44 | 44 | ||
45 | #include <openssl/dh.h> | 45 | #include <openssl/dh.h> |
46 | #include <openssl/bn.h> | 46 | #include <openssl/bn.h> |
@@ -182,16 +182,15 @@ int session_id2_len = 0; | |||
182 | u_int utmp_len = MAXHOSTNAMELEN; | 182 | u_int utmp_len = MAXHOSTNAMELEN; |
183 | 183 | ||
184 | /* Prototypes for various functions defined later in this file. */ | 184 | /* Prototypes for various functions defined later in this file. */ |
185 | void do_ssh1_kex(void); | 185 | void destroy_sensitive_data(void); |
186 | void do_ssh2_kex(void); | ||
187 | 186 | ||
188 | void ssh_dh1_server(Kex *, Buffer *_kexinit, Buffer *); | 187 | static void do_ssh1_kex(void); |
189 | void ssh_dhgex_server(Kex *, Buffer *_kexinit, Buffer *); | 188 | static void do_ssh2_kex(void); |
190 | 189 | ||
191 | /* | 190 | /* |
192 | * Close all listening sockets | 191 | * Close all listening sockets |
193 | */ | 192 | */ |
194 | void | 193 | static void |
195 | close_listen_socks(void) | 194 | close_listen_socks(void) |
196 | { | 195 | { |
197 | int i; | 196 | int i; |
@@ -205,7 +204,7 @@ close_listen_socks(void) | |||
205 | * the effect is to reread the configuration file (and to regenerate | 204 | * the effect is to reread the configuration file (and to regenerate |
206 | * the server key). | 205 | * the server key). |
207 | */ | 206 | */ |
208 | void | 207 | static void |
209 | sighup_handler(int sig) | 208 | sighup_handler(int sig) |
210 | { | 209 | { |
211 | received_sighup = 1; | 210 | received_sighup = 1; |
@@ -216,7 +215,7 @@ sighup_handler(int sig) | |||
216 | * Called from the main program after receiving SIGHUP. | 215 | * Called from the main program after receiving SIGHUP. |
217 | * Restarts the server. | 216 | * Restarts the server. |
218 | */ | 217 | */ |
219 | void | 218 | static void |
220 | sighup_restart(void) | 219 | sighup_restart(void) |
221 | { | 220 | { |
222 | log("Received SIGHUP; restarting."); | 221 | log("Received SIGHUP; restarting."); |
@@ -229,7 +228,7 @@ sighup_restart(void) | |||
229 | /* | 228 | /* |
230 | * Generic signal handler for terminating signals in the master daemon. | 229 | * Generic signal handler for terminating signals in the master daemon. |
231 | */ | 230 | */ |
232 | void | 231 | static void |
233 | sigterm_handler(int sig) | 232 | sigterm_handler(int sig) |
234 | { | 233 | { |
235 | received_sigterm = sig; | 234 | received_sigterm = sig; |
@@ -239,7 +238,7 @@ sigterm_handler(int sig) | |||
239 | * SIGCHLD handler. This is called whenever a child dies. This will then | 238 | * SIGCHLD handler. This is called whenever a child dies. This will then |
240 | * reap any zombies left by exited children. | 239 | * reap any zombies left by exited children. |
241 | */ | 240 | */ |
242 | void | 241 | static void |
243 | main_sigchld_handler(int sig) | 242 | main_sigchld_handler(int sig) |
244 | { | 243 | { |
245 | int save_errno = errno; | 244 | int save_errno = errno; |
@@ -255,7 +254,7 @@ main_sigchld_handler(int sig) | |||
255 | /* | 254 | /* |
256 | * Signal handler for the alarm after the login grace period has expired. | 255 | * Signal handler for the alarm after the login grace period has expired. |
257 | */ | 256 | */ |
258 | void | 257 | static void |
259 | grace_alarm_handler(int sig) | 258 | grace_alarm_handler(int sig) |
260 | { | 259 | { |
261 | /* XXX no idea how fix this signal handler */ | 260 | /* XXX no idea how fix this signal handler */ |
@@ -274,7 +273,7 @@ grace_alarm_handler(int sig) | |||
274 | * Thus there should be no concurrency control/asynchronous execution | 273 | * Thus there should be no concurrency control/asynchronous execution |
275 | * problems. | 274 | * problems. |
276 | */ | 275 | */ |
277 | void | 276 | static void |
278 | generate_ephemeral_server_key(void) | 277 | generate_ephemeral_server_key(void) |
279 | { | 278 | { |
280 | u_int32_t rand = 0; | 279 | u_int32_t rand = 0; |
@@ -297,7 +296,7 @@ generate_ephemeral_server_key(void) | |||
297 | arc4random_stir(); | 296 | arc4random_stir(); |
298 | } | 297 | } |
299 | 298 | ||
300 | void | 299 | static void |
301 | key_regeneration_alarm(int sig) | 300 | key_regeneration_alarm(int sig) |
302 | { | 301 | { |
303 | int save_errno = errno; | 302 | int save_errno = errno; |
@@ -306,7 +305,7 @@ key_regeneration_alarm(int sig) | |||
306 | key_do_regen = 1; | 305 | key_do_regen = 1; |
307 | } | 306 | } |
308 | 307 | ||
309 | void | 308 | static void |
310 | sshd_exchange_identification(int sock_in, int sock_out) | 309 | sshd_exchange_identification(int sock_in, int sock_out) |
311 | { | 310 | { |
312 | int i, mismatch; | 311 | int i, mismatch; |
@@ -456,7 +455,7 @@ destroy_sensitive_data(void) | |||
456 | memset(sensitive_data.ssh1_cookie, 0, SSH_SESSION_KEY_LENGTH); | 455 | memset(sensitive_data.ssh1_cookie, 0, SSH_SESSION_KEY_LENGTH); |
457 | } | 456 | } |
458 | 457 | ||
459 | char * | 458 | static char * |
460 | list_hostkey_types(void) | 459 | list_hostkey_types(void) |
461 | { | 460 | { |
462 | static char buf[1024]; | 461 | static char buf[1024]; |
@@ -481,7 +480,7 @@ list_hostkey_types(void) | |||
481 | return buf; | 480 | return buf; |
482 | } | 481 | } |
483 | 482 | ||
484 | Key * | 483 | static Key * |
485 | get_hostkey_by_type(int type) | 484 | get_hostkey_by_type(int type) |
486 | { | 485 | { |
487 | int i; | 486 | int i; |
@@ -499,7 +498,7 @@ get_hostkey_by_type(int type) | |||
499 | * of (max_startups_rate/100). the probability increases linearly until | 498 | * of (max_startups_rate/100). the probability increases linearly until |
500 | * all connections are dropped for startups > max_startups | 499 | * all connections are dropped for startups > max_startups |
501 | */ | 500 | */ |
502 | int | 501 | static int |
503 | drop_connection(int startups) | 502 | drop_connection(int startups) |
504 | { | 503 | { |
505 | double p, r; | 504 | double p, r; |
@@ -1203,7 +1202,7 @@ main(int ac, char **av) | |||
1203 | /* | 1202 | /* |
1204 | * SSH1 key exchange | 1203 | * SSH1 key exchange |
1205 | */ | 1204 | */ |
1206 | void | 1205 | static void |
1207 | do_ssh1_kex(void) | 1206 | do_ssh1_kex(void) |
1208 | { | 1207 | { |
1209 | int i, len; | 1208 | int i, len; |
@@ -1424,7 +1423,7 @@ do_ssh1_kex(void) | |||
1424 | /* | 1423 | /* |
1425 | * SSH2 key exchange: diffie-hellman-group1-sha1 | 1424 | * SSH2 key exchange: diffie-hellman-group1-sha1 |
1426 | */ | 1425 | */ |
1427 | void | 1426 | static void |
1428 | do_ssh2_kex(void) | 1427 | do_ssh2_kex(void) |
1429 | { | 1428 | { |
1430 | Kex *kex; | 1429 | Kex *kex; |