sftp-client.c sftp-glob.h sftp.c ssh-add.c ssh.c sshconnect2.c sshd.c
ttymodes.c]
KNF whitespace
+ - markus@cvs.openbsd.org 2002/03/19 14:27:39
+ [auth.c auth1.c auth2.c]
+ make getpwnamallow() allways call pwcopy()
20020317
- (tim) [configure.ac] Assume path given with --with-pid-dir=PATH is wanted,
*/
#include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.39 2002/03/19 10:49:35 markus Exp $");
+RCSID("$OpenBSD: auth.c,v 1.40 2002/03/19 14:27:39 markus Exp $");
#ifdef HAVE_LOGIN_H
#include <login.h>
#include "bufaux.h"
#include "uidswap.h"
#include "tildexpand.h"
+#include "misc.h"
/* import */
extern ServerOptions options;
auth_close(as);
#endif
#endif
- return (pw);
+ return (pwcopy(pw));
}
*/
#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"
#include "auth.h"
#include "channels.h"
#include "session.h"
-#include "misc.h"
#include "uidswap.h"
#include "monitor_wrap.h"
do_authentication(void)
{
Authctxt *authctxt;
- struct passwd *pw = NULL, *pwent;
u_int ulen;
char *p, *user, *style = NULL;
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
* 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
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.88 2002/03/18 17:50:31 provos Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.89 2002/03/19 14:27:39 markus Exp $");
#include <openssl/evp.h>
#include "pathnames.h"
#include "uidswap.h"
#include "auth-options.h"
-#include "misc.h"
#include "hostfile.h"
#include "canohost.h"
#include "match.h"
start_pam("NOUSER");
#endif
}
- /* Free memory */
- if (use_privsep && pw != NULL)
- pwfree(pw);
-
- setproctitle("%s%s", pw ? user : "unknown",
+ setproctitle("%s%s", authctxt->pw ? user : "unknown",
use_privsep ? " [net]" : "");
authctxt->user = xstrdup(user);
authctxt->service = xstrdup(service);
authctxt->style = style ? xstrdup(style) : NULL;
-
if (use_privsep)
mm_inform_authserv(service, style);
} else if (strcmp(user, authctxt->user) != 0 ||