summaryrefslogtreecommitdiff
path: root/auth2.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth2.c')
-rw-r--r--auth2.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/auth2.c b/auth2.c
index 272683bb2..ca0526649 100644
--- a/auth2.c
+++ b/auth2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth2.c,v 1.65 2001/06/23 03:04:43 markus Exp $"); 26RCSID("$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
77void input_service_request(int type, int plen, void *ctxt); 77static void input_service_request(int, int, void *);
78void input_userauth_request(int type, int plen, void *ctxt); 78static void input_userauth_request(int, int, void *);
79void protocol_error(int type, int plen, void *ctxt); 79static void protocol_error(int, int, void *);
80 80
81/* helper */ 81/* helper */
82Authmethod *authmethod_lookup(const char *name); 82static Authmethod *authmethod_lookup(const char *);
83char *authmethods_get(void); 83char *authmethods_get(void);
84int user_key_allowed(struct passwd *pw, Key *key); 84static int user_key_allowed(struct passwd *, Key *);
85int 85static int hostbased_key_allowed(struct passwd *, const char *, char *, Key *);
86hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost,
87 Key *key);
88 86
89/* auth */ 87/* auth */
90void userauth_banner(void); 88static void userauth_banner(void);
91int userauth_none(Authctxt *authctxt); 89static int userauth_none(Authctxt *);
92int userauth_passwd(Authctxt *authctxt); 90static int userauth_passwd(Authctxt *);
93int userauth_pubkey(Authctxt *authctxt); 91static int userauth_pubkey(Authctxt *);
94int userauth_hostbased(Authctxt *authctxt); 92static int userauth_hostbased(Authctxt *);
95int userauth_kbdint(Authctxt *authctxt); 93static int userauth_kbdint(Authctxt *);
96 94
97Authmethod authmethods[] = { 95Authmethod authmethods[] = {
98 {"none", 96 {"none",
@@ -136,7 +134,7 @@ do_authentication2()
136 do_authenticated(authctxt); 134 do_authenticated(authctxt);
137} 135}
138 136
139void 137static void
140protocol_error(int type, int plen, void *ctxt) 138protocol_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
149void 147static void
150input_service_request(int type, int plen, void *ctxt) 148input_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
182void 180static void
183input_userauth_request(int type, int plen, void *ctxt) 181input_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
300void 298static void
301userauth_banner(void) 299userauth_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
331int 329static int
332userauth_none(Authctxt *authctxt) 330userauth_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
357int 355static int
358userauth_passwd(Authctxt *authctxt) 356userauth_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
386int 384static int
387userauth_kbdint(Authctxt *authctxt) 385userauth_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
414int 412static int
415userauth_pubkey(Authctxt *authctxt) 413userauth_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
520int 518static int
521userauth_hostbased(Authctxt *authctxt) 519userauth_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
637Authmethod * 635static Authmethod *
638authmethod_lookup(const char *name) 636authmethod_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 */
652int 650static int
653user_key_allowed2(struct passwd *pw, Key *key, char *file) 651user_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* */
740int 738static int
741user_key_allowed(struct passwd *pw, Key *key) 739user_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 */
760int 758static int
761hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost, 759hostbased_key_allowed(struct passwd *pw, const char *cuser, char *chost,
762 Key *key) 760 Key *key)
763{ 761{