diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-01 18:24:02 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-01 18:24:02 +0000 |
commit | 60ec726641e4fd8cec6667ccff45042632ca551d (patch) | |
tree | a0560d14497cf54780cb1a013a4d713a2c760a52 /usr.sbin/smtpd/smtpd.c | |
parent | 2d1386bf8aee8631a47cac75965392ee2b922f08 (diff) |
No need for save_getpwuid and such functions which call endpwent.
endpwent is not needed unless setpwent (with stayopen = 1) or getpwent
was used. getpwuid/getpwnam do not use getpwent; i think people must
be assuming this. we are going to improve the man pages for this.
ok gilles
Diffstat (limited to 'usr.sbin/smtpd/smtpd.c')
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index f02973cdaa6..6d1ed99425b 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.70 2009/06/01 13:20:56 jacekm Exp $ */ +/* $OpenBSD: smtpd.c,v 1.71 2009/06/01 18:24:01 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -448,7 +448,7 @@ parent_dispatch_mda(int fd, short event, void *p) } errno = 0; - pw = safe_getpwnam(pw_name); + pw = getpwnam(pw_name); if (pw == NULL) { if (errno) batchp->message.status |= S_MESSAGE_TEMPFAILURE; @@ -496,7 +496,7 @@ parent_dispatch_mda(int fd, short event, void *p) path = &batchp->message.sender; } - pw = safe_getpwnam(path->pw_name); + pw = getpwnam(path->pw_name); if (pw == NULL) break; @@ -851,7 +851,6 @@ main(int argc, char *argv[]) if ((env.sc_pw = getpwnam(SMTPD_USER)) == NULL) errx(1, "unknown user %s", SMTPD_USER); - endpwent(); if (!setup_spool(env.sc_pw->pw_uid, 0)) errx(1, "invalid directory permissions"); @@ -1384,7 +1383,7 @@ parent_enqueue_offline(struct smtpd *env, char *runner_path) } errno = 0; - if ((pw = safe_getpwuid(sb.st_uid)) == NULL) { + if ((pw = getpwuid(sb.st_uid)) == NULL) { log_warn("parent_enqueue_offline: getpwuid for uid %d failed", sb.st_uid); unlink(path); @@ -1516,7 +1515,7 @@ parent_forward_open(char *username) char pathname[MAXPATHLEN]; int fd; - pw = safe_getpwnam(username); + pw = getpwnam(username); if (pw == NULL) return -1; |