summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-14 23:47:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-07-14 23:47:31 +0000
commit3125fbda45c032ef151749c174356de87a827688 (patch)
treedc8285d9b757e372be3fe1162c12b224ba1c2126 /lib/libc/gen
parent35a921b0ba182e054aff0945f6095179a5962110 (diff)
indent, and double free fix; millert ok
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/authenticate.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/libc/gen/authenticate.c b/lib/libc/gen/authenticate.c
index 55d84620929..f8b031bee5b 100644
--- a/lib/libc/gen/authenticate.c
+++ b/lib/libc/gen/authenticate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authenticate.c,v 1.11 2002/06/23 03:03:37 deraadt Exp $ */
+/* $OpenBSD: authenticate.c,v 1.12 2002/07/14 23:47:30 deraadt Exp $ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -129,8 +129,10 @@ _auth_checknologin(login_cap_t *lc, int print)
/* First try the nologin file specified in login.conf. */
if (*nologin != '\0' && stat(nologin, &sb) == 0)
goto print_nologin;
- if (mustfree)
+ if (mustfree) {
free(nologin);
+ mustfree = 0;
+ }
/* If that doesn't exist try _PATH_NOLOGIN. */
if (stat(_PATH_NOLOGIN, &sb) == 0) {
@@ -236,7 +238,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type)
login_close(lc);
syslog(LOG_ERR, "Invalid %s script: %s", s, approve);
_warnx("invalid path to approval script");
- free(approve);
+ free(approve);
return (0);
}
@@ -245,8 +247,8 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type)
login_close(lc);
syslog(LOG_ERR, "%m");
_warn(NULL);
- if (approve)
- free(approve);
+ if (approve)
+ free(approve);
return (0);
}
@@ -270,18 +272,18 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type)
if (stat(pwd->pw_dir, &sb) < 0 ||
(sb.st_mode & 0170000) != S_IFDIR ||
(pwd->pw_uid && sb.st_uid == pwd->pw_uid &&
- (sb.st_mode & S_IXUSR) == 0)) {
+ (sb.st_mode & S_IXUSR) == 0)) {
auth_setstate(as, (auth_getstate(as) & ~AUTH_ALLOW));
goto out;
}
}
if (approve)
- auth_call(as, approve, strrchr(approve, '/') + 1, name,
- lc->lc_class, type, 0);
+ auth_call(as, approve, strrchr(approve, '/') + 1, name,
+ lc->lc_class, type, 0);
out:
- if (approve)
- free(approve);
+ if (approve)
+ free(approve);
if (close_lc_on_exit)
login_close(lc);