diff options
Diffstat (limited to 'auth2.c')
-rw-r--r-- | auth2.c | 56 |
1 files changed, 27 insertions, 29 deletions
@@ -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 | { |