summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--auth.c14
-rw-r--r--auth.h3
-rw-r--r--auth1.c6
-rw-r--r--auth2.c6
5 files changed, 25 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index d516cd90e..8fc1f1381 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
3420020317 3720020317
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 $
diff --git a/auth.c b/auth.c
index de004515f..19ef605f4 100644
--- a/auth.c
+++ b/auth.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth.c,v 1.36 2002/03/15 11:00:38 itojun Exp $"); 26RCSID("$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
443struct passwd *
444getpwnamallow(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}
diff --git a/auth.h b/auth.h
index 83471a0a6..5f0ed7da4 100644
--- a/auth.h
+++ b/auth.h
@@ -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 *);
133void auth2_challenge_stop(Authctxt *); 133void auth2_challenge_stop(Authctxt *);
134 134
135int allowed_user(struct passwd *); 135int allowed_user(struct passwd *);
136struct passwd * getpwnamallow(const char *user);
136 137
137char *get_challenge(Authctxt *); 138char *get_challenge(Authctxt *);
138int verify_response(Authctxt *, const char *); 139int verify_response(Authctxt *, const char *);
diff --git a/auth1.c b/auth1.c
index c2d99895f..013c74188 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: auth1.c,v 1.35 2002/02/03 17:53:25 markus Exp $"); 13RCSID("$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 {
diff --git a/auth2.c b/auth2.c
index f2a801ecc..c5ab08067 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.85 2002/02/24 19:14:59 markus Exp $"); 26RCSID("$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);