diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | auth.c | 14 | ||||
-rw-r--r-- | auth.h | 3 | ||||
-rw-r--r-- | auth1.c | 6 | ||||
-rw-r--r-- | auth2.c | 6 |
5 files changed, 25 insertions, 9 deletions
@@ -30,6 +30,9 @@ | |||
30 | - stevesk@cvs.openbsd.org 2002/03/16 17:41:25 | 30 | - stevesk@cvs.openbsd.org 2002/03/16 17:41:25 |
31 | [auth-krb5.c] | 31 | [auth-krb5.c] |
32 | BSD license. from Daniel Kouril via Dug Song. ok markus@ | 32 | BSD license. from Daniel Kouril via Dug Song. ok markus@ |
33 | - provos@cvs.openbsd.org 2002/03/17 20:25:56 | ||
34 | [auth.c auth.h auth1.c auth2.c] | ||
35 | getpwnamallow returns struct passwd * only if user valid; okay markus@ | ||
33 | 36 | ||
34 | 20020317 | 37 | 20020317 |
35 | - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted, | 38 | - (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted, |
@@ -7876,4 +7879,4 @@ | |||
7876 | - Wrote replacements for strlcpy and mkdtemp | 7879 | - Wrote replacements for strlcpy and mkdtemp |
7877 | - Released 1.0pre1 | 7880 | - Released 1.0pre1 |
7878 | 7881 | ||
7879 | $Id: ChangeLog,v 1.1933 2002/03/22 01:22:27 mouring Exp $ | 7882 | $Id: ChangeLog,v 1.1934 2002/03/22 01:24:38 mouring Exp $ |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth.c,v 1.36 2002/03/15 11:00:38 itojun Exp $"); | 26 | RCSID("$OpenBSD: auth.c,v 1.37 2002/03/17 20:25:56 provos Exp $"); |
27 | 27 | ||
28 | #ifdef HAVE_LOGIN_H | 28 | #ifdef HAVE_LOGIN_H |
29 | #include <login.h> | 29 | #include <login.h> |
@@ -439,3 +439,15 @@ secure_filename(FILE *f, const char *file, struct passwd *pw, | |||
439 | } | 439 | } |
440 | return 0; | 440 | return 0; |
441 | } | 441 | } |
442 | |||
443 | struct passwd * | ||
444 | getpwnamallow(const char *user) | ||
445 | { | ||
446 | struct passwd *pw; | ||
447 | |||
448 | pw = getpwnam(user); | ||
449 | if (pw != NULL && !allowed_user(pw)) | ||
450 | pw = NULL; | ||
451 | |||
452 | return (pw); | ||
453 | } | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth.h,v 1.31 2002/03/16 17:22:09 markus Exp $ */ | 1 | /* $OpenBSD: auth.h,v 1.32 2002/03/17 20:25:56 provos Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -133,6 +133,7 @@ int auth2_challenge(Authctxt *, char *); | |||
133 | void auth2_challenge_stop(Authctxt *); | 133 | void auth2_challenge_stop(Authctxt *); |
134 | 134 | ||
135 | int allowed_user(struct passwd *); | 135 | int allowed_user(struct passwd *); |
136 | struct passwd * getpwnamallow(const char *user); | ||
136 | 137 | ||
137 | char *get_challenge(Authctxt *); | 138 | char *get_challenge(Authctxt *); |
138 | int verify_response(Authctxt *, const char *); | 139 | int verify_response(Authctxt *, const char *); |
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "includes.h" | 12 | #include "includes.h" |
13 | RCSID("$OpenBSD: auth1.c,v 1.35 2002/02/03 17:53:25 markus Exp $"); | 13 | RCSID("$OpenBSD: auth1.c,v 1.36 2002/03/17 20:25:56 provos Exp $"); |
14 | 14 | ||
15 | #include "xmalloc.h" | 15 | #include "xmalloc.h" |
16 | #include "rsa.h" | 16 | #include "rsa.h" |
@@ -382,8 +382,8 @@ do_authentication(void) | |||
382 | authctxt->style = style; | 382 | authctxt->style = style; |
383 | 383 | ||
384 | /* Verify that the user is a valid user. */ | 384 | /* Verify that the user is a valid user. */ |
385 | pw = getpwnam(user); | 385 | pw = getpwnamallow(user); |
386 | if (pw && allowed_user(pw)) { | 386 | if (pw) { |
387 | authctxt->valid = 1; | 387 | authctxt->valid = 1; |
388 | pw = pwcopy(pw); | 388 | pw = pwcopy(pw); |
389 | } else { | 389 | } else { |
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: auth2.c,v 1.85 2002/02/24 19:14:59 markus Exp $"); | 26 | RCSID("$OpenBSD: auth2.c,v 1.86 2002/03/17 20:25:56 provos Exp $"); |
27 | 27 | ||
28 | #include <openssl/evp.h> | 28 | #include <openssl/evp.h> |
29 | 29 | ||
@@ -184,8 +184,8 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) | |||
184 | if (authctxt->attempt++ == 0) { | 184 | if (authctxt->attempt++ == 0) { |
185 | /* setup auth context */ | 185 | /* setup auth context */ |
186 | struct passwd *pw = NULL; | 186 | struct passwd *pw = NULL; |
187 | pw = getpwnam(user); | 187 | pw = getpwnamallow(user); |
188 | if (pw && allowed_user(pw) && strcmp(service, "ssh-connection")==0) { | 188 | if (pw && strcmp(service, "ssh-connection")==0) { |
189 | authctxt->pw = pwcopy(pw); | 189 | authctxt->pw = pwcopy(pw); |
190 | authctxt->valid = 1; | 190 | authctxt->valid = 1; |
191 | debug2("input_userauth_request: setting up authctxt for %s", user); | 191 | debug2("input_userauth_request: setting up authctxt for %s", user); |