summaryrefslogtreecommitdiffstats
path: root/auth1.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-03-22 03:04:08 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-03-22 03:04:08 +0000
commit7ebb635d812d68772ce3fb0b64d798c54fbfab71 (patch)
tree6bf832ba30e5d9643ed75677ce9ff6155fe7e549 /auth1.c
parent6328ab39891ea64ccd5c91e9be2ec5c4f843bbd0 (diff)
- markus@cvs.openbsd.org 2002/03/19 14:27:39
[auth.c auth1.c auth2.c] make getpwnamallow() allways call pwcopy()
Diffstat (limited to 'auth1.c')
-rw-r--r--auth1.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/auth1.c b/auth1.c
index ca288958..8553bfa2 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth1.c,v 1.38 2002/03/18 17:50:31 provos Exp $");
+RCSID("$OpenBSD: auth1.c,v 1.39 2002/03/19 14:27:39 markus Exp $");
#include "xmalloc.h"
#include "rsa.h"
@@ -24,7 +24,6 @@ RCSID("$OpenBSD: auth1.c,v 1.38 2002/03/18 17:50:31 provos Exp $");
#include "auth.h"
#include "channels.h"
#include "session.h"
-#include "misc.h"
#include "uidswap.h"
#include "monitor_wrap.h"
@@ -359,7 +358,6 @@ Authctxt *
do_authentication(void)
{
Authctxt *authctxt;
- struct passwd *pw = NULL, *pwent;
u_int ulen;
char *p, *user, *style = NULL;
@@ -382,21 +380,12 @@ do_authentication(void)
authctxt->style = style;
/* Verify that the user is a valid user. */
- pwent = PRIVSEP(getpwnamallow(user));
- if (pwent) {
+ if ((authctxt->pw = PRIVSEP(getpwnamallow(user))) != NULL)
authctxt->valid = 1;
- pw = pwcopy(pwent);
- } else {
+ else
debug("do_authentication: illegal user %s", user);
- pw = NULL;
- }
- /* Free memory */
- if (use_privsep && pwent != NULL)
- pwfree(pwent);
-
- authctxt->pw = pw;
- setproctitle("%s%s", pw ? user : "unknown",
+ setproctitle("%s%s", authctxt->pw ? user : "unknown",
use_privsep ? " [net]" : "");
#ifdef USE_PAM
@@ -408,7 +397,8 @@ do_authentication(void)
* the server. (Unless you are running Windows)
*/
#ifndef HAVE_CYGWIN
- if (!use_privsep && getuid() != 0 && pw && pw->pw_uid != getuid())
+ if (!use_privsep && getuid() != 0 && authctxt->pw &&
+ authctxt->pw->pw_uid != getuid())
packet_disconnect("Cannot change user when server not running as root.");
#endif