- stevesk@cvs.openbsd.org 2002/03/16 17:41:25
[auth-krb5.c]
BSD license. from Daniel Kouril via Dug Song. ok markus@
+ - provos@cvs.openbsd.org 2002/03/17 20:25:56
+ [auth.c auth.h auth1.c auth2.c]
+ getpwnamallow returns struct passwd * only if user valid; okay markus@
20020317
- (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted,
*/
#include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.36 2002/03/15 11:00:38 itojun Exp $");
+RCSID("$OpenBSD: auth.c,v 1.37 2002/03/17 20:25:56 provos Exp $");
#ifdef HAVE_LOGIN_H
#include <login.h>
}
return 0;
}
+
+struct passwd *
+getpwnamallow(const char *user)
+{
+ struct passwd *pw;
+
+ pw = getpwnam(user);
+ if (pw != NULL && !allowed_user(pw))
+ pw = NULL;
+
+ return (pw);
+}
-/* $OpenBSD: auth.h,v 1.31 2002/03/16 17:22:09 markus Exp $ */
+/* $OpenBSD: auth.h,v 1.32 2002/03/17 20:25:56 provos Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
void auth2_challenge_stop(Authctxt *);
int allowed_user(struct passwd *);
+struct passwd * getpwnamallow(const char *user);
char *get_challenge(Authctxt *);
int verify_response(Authctxt *, const char *);
*/
#include "includes.h"
-RCSID("$OpenBSD: auth1.c,v 1.35 2002/02/03 17:53:25 markus Exp $");
+RCSID("$OpenBSD: auth1.c,v 1.36 2002/03/17 20:25:56 provos Exp $");
#include "xmalloc.h"
#include "rsa.h"
authctxt->style = style;
/* Verify that the user is a valid user. */
- pw = getpwnam(user);
- if (pw && allowed_user(pw)) {
+ pw = getpwnamallow(user);
+ if (pw) {
authctxt->valid = 1;
pw = pwcopy(pw);
} else {
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.85 2002/02/24 19:14:59 markus Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.86 2002/03/17 20:25:56 provos Exp $");
#include <openssl/evp.h>
if (authctxt->attempt++ == 0) {
/* setup auth context */
struct passwd *pw = NULL;
- pw = getpwnam(user);
- if (pw && allowed_user(pw) && strcmp(service, "ssh-connection")==0) {
+ pw = getpwnamallow(user);
+ if (pw && strcmp(service, "ssh-connection")==0) {
authctxt->pw = pwcopy(pw);
authctxt->valid = 1;
debug2("input_userauth_request: setting up authctxt for %s", user);