summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-07-15 22:16:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-07-15 22:16:51 +0000
commit8edec6acbc23cb95aa5288410890e7e686596bd8 (patch)
tree6026253b31f99ad303643be54a452c80ec5fbc62 /usr.sbin
parente231d2daf19182e5a136dac27aa09f0f7e87f09b (diff)
Pass e->pwd to auth_setpwd() to avoid extra passwd lookup in BSD auth routines
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/cron/do_command.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c
index 17e3943df05..434cce81107 100644
--- a/usr.sbin/cron/do_command.c
+++ b/usr.sbin/cron/do_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: do_command.c,v 1.19 2002/07/15 19:13:29 millert Exp $ */
+/* $OpenBSD: do_command.c,v 1.20 2002/07/15 22:16:50 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
*/
@@ -21,7 +21,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char const rcsid[] = "$OpenBSD: do_command.c,v 1.19 2002/07/15 19:13:29 millert Exp $";
+static char const rcsid[] = "$OpenBSD: do_command.c,v 1.20 2002/07/15 22:16:50 millert Exp $";
#endif
#include "cron.h"
@@ -195,6 +195,9 @@ child_process(entry *e, user *u) {
*/
#ifdef LOGIN_CAP
{
+#ifdef BSD_AUTH
+ auth_session_t *as;
+#endif
login_cap_t *lc;
char **p;
extern char **environ;
@@ -211,12 +214,17 @@ child_process(entry *e, user *u) {
_exit(ERROR_EXIT);
}
#ifdef BSD_AUTH
- /* XXX - stash pwd with auth_setpwd to avoid lookup */
- if (auth_approval(0, lc, usernm, "cron") <= 0) {
+ as = auth_open();
+ if (as == NULL || auth_setpwd(as, e->pwd) != 0) {
+ fprintf(stderr, "can't malloc\n");
+ _exit(ERROR_EXIT);
+ }
+ if (auth_approval(as, lc, usernm, "cron") <= 0) {
fprintf(stderr, "approval failed for %s\n",
e->pwd->pw_name);
_exit(ERROR_EXIT);
}
+ auth_close(as);
#endif /* BSD_AUTH */
login_close(lc);