diff options
-rw-r--r-- | usr.sbin/smtpd/lka.c | 10 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 11 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/smtpd/util.c | 24 |
4 files changed, 12 insertions, 37 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 52d011309c5..59c05af088f 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.52 2009/06/01 13:20:56 jacekm Exp $ */ +/* $OpenBSD: lka.c,v 1.53 2009/06/01 18:24:01 deraadt Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -800,7 +800,7 @@ lka_resolve_mail(struct smtpd *env, struct rule *rule, struct path *path) else if (aliases_exist(env, username)) path->flags |= F_PATH_ALIAS; else { - pw = safe_getpwnam(username); + pw = getpwnam(username); if (pw == NULL) return 0; (void)strlcpy(path->pw_name, pw->pw_name, @@ -829,7 +829,7 @@ lka_expand(char *buf, size_t len, struct path *path) for (p = path->rule.r_value.path; *p != '\0'; ++p) { if (p == path->rule.r_value.path && *p == '~') { if (*(p + 1) == '/' || *(p + 1) == '\0') { - pw = safe_getpwnam(path->pw_name); + pw = getpwnam(path->pw_name); if (pw == NULL) continue; @@ -855,7 +855,7 @@ lka_expand(char *buf, size_t len, struct path *path) *delim = '\0'; } - pw = safe_getpwnam(username); + pw = getpwnam(username); if (pw == NULL) continue; @@ -1114,7 +1114,7 @@ lka_resolve_path(struct smtpd *env, struct path *path) path->flags |= F_PATH_ALIAS; else { path->flags |= F_PATH_ACCOUNT; - pw = safe_getpwnam(username); + pw = getpwnam(username); if (pw == NULL) return 0; (void)strlcpy(path->pw_name, pw->pw_name, 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; diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index b59fdfc812e..f81e7af22da 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.120 2009/05/30 23:53:41 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.121 2009/06/01 18:24:01 deraadt Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -1009,8 +1009,6 @@ void addargs(arglist *, char *, ...) int bsnprintf(char *, size_t, const char *, ...) __attribute__ ((format (printf, 3, 4))); int safe_fclose(FILE *); -struct passwd *safe_getpwnam(const char *); -struct passwd *safe_getpwuid(uid_t); int hostname_match(char *, char *); int recipient_to_path(struct path *, char *); int valid_localpart(char *); diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index d675df5f738..3d64e4d5e6e 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.21 2009/05/10 11:29:40 jacekm Exp $ */ +/* $OpenBSD: util.c,v 1.22 2009/06/01 18:24:01 deraadt Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -76,28 +76,6 @@ safe_fclose(FILE *fp) return 1; } -struct passwd * -safe_getpwnam(const char *name) -{ - struct passwd *ret; - - ret = getpwnam(name); - endpwent(); - - return ret; -} - -struct passwd * -safe_getpwuid(uid_t uid) -{ - struct passwd *ret; - - ret = getpwuid(uid); - endpwent(); - - return ret; -} - int hostname_match(char *hostname, char *pattern) { |