diff options
author | Damien Miller <djm@mindrot.org> | 2002-03-13 02:47:54 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2002-03-13 02:47:54 +0100 |
commit | 646e7cf3d7e7d4231c2d97d27c09fe5fe1d749e2 (patch) | |
tree | a693368c47d2d044514878fbb1516f87b487f78b /auth1.c | |
parent | [contrib/solaris/buildpkg.sh, contrib/solaris/README] Updated to (diff) | |
download | openssh-646e7cf3d7e7d4231c2d97d27c09fe5fe1d749e2.tar.xz openssh-646e7cf3d7e7d4231c2d97d27c09fe5fe1d749e2.zip |
Import of Niels Provos' 20020312 ssh-complete.diff
PAM, Cygwin and OSF SIA will not work for sure
Diffstat (limited to 'auth1.c')
-rw-r--r-- | auth1.c | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -26,8 +26,13 @@ RCSID("$OpenBSD: auth1.c,v 1.35 2002/02/03 17:53:25 markus Exp $"); #include "session.h" #include "misc.h" #include "uidswap.h" +#include "monitor.h" +#include "monitor_wrap.h" /* import */ +extern int use_privsep; +extern int mm_recvfd; + extern ServerOptions options; /* @@ -355,12 +360,13 @@ do_authloop(Authctxt *authctxt) * Performs authentication of an incoming connection. Session key has already * been exchanged and encryption is enabled. */ -void +Authctxt * do_authentication(void) { Authctxt *authctxt; - struct passwd *pw; + struct passwd *pw = NULL, *pwent; u_int ulen; + int allowed; char *p, *user, *style = NULL; /* Get the name of the user that we wish to log in as. */ @@ -382,17 +388,26 @@ do_authentication(void) authctxt->style = style; /* Verify that the user is a valid user. */ - pw = getpwnam(user); - if (pw && allowed_user(pw)) { + if (!use_privsep) { + pwent = getpwnam(user); + allowed = pwent ? allowed_user(pwent) : 0; + } else + pwent = mm_getpwnamallow(mm_recvfd, user, &allowed); + if (pwent && allowed) { authctxt->valid = 1; - pw = pwcopy(pw); + pw = pwcopy(pwent); } else { debug("do_authentication: illegal user %s", user); pw = NULL; } + /* Free memory */ + if (use_privsep) + pwfree(pwent); + authctxt->pw = pw; - setproctitle("%s", pw ? user : "unknown"); + setproctitle("%s%s", use_privsep ? " [net]" : "", + pw ? user : "unknown"); #ifdef USE_PAM start_pam(pw == NULL ? "NOUSER" : user); @@ -418,6 +433,5 @@ do_authentication(void) packet_send(); packet_write_wait(); - /* Perform session preparation. */ - do_authenticated(authctxt); + return (authctxt); } |