From 5b7a2dfe69b64c6d4f6015a467b2cbd49d4cf0da Mon Sep 17 00:00:00 2001 From: Eric Allman Date: Fri, 31 Mar 1995 17:52:31 -0800 Subject: [PATCH] pull getpwXXX and gethostbyXXX calls out into conf.c so they can be tweaked SCCS-vsn: usr.sbin/sendmail/src/recipient.c 8.76 SCCS-vsn: usr.sbin/sendmail/src/main.c 8.94 SCCS-vsn: usr.sbin/sendmail/src/envelope.c 8.57 SCCS-vsn: usr.sbin/sendmail/src/conf.h 8.143 SCCS-vsn: usr.sbin/sendmail/src/domain.c 8.34 SCCS-vsn: usr.sbin/sendmail/src/err.c 8.32 SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 8.110 SCCS-vsn: usr.sbin/sendmail/src/savemail.c 8.62 SCCS-vsn: usr.sbin/sendmail/src/daemon.c 8.76 SCCS-vsn: usr.sbin/sendmail/src/util.c 8.59 SCCS-vsn: usr.sbin/sendmail/src/readcf.c 8.77 SCCS-vsn: usr.sbin/sendmail/src/deliver.c 8.140 SCCS-vsn: usr.sbin/sendmail/src/queue.c 8.75 SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.143 SCCS-vsn: usr.sbin/sendmail/src/alias.c 8.41 SCCS-vsn: usr.sbin/sendmail/src/udb.c 8.17 SCCS-vsn: usr.sbin/sendmail/src/map.c 8.51 --- usr/src/usr.sbin/sendmail/src/alias.c | 3 +- usr/src/usr.sbin/sendmail/src/conf.c | 61 ++++++++++++++++------- usr/src/usr.sbin/sendmail/src/conf.h | 4 +- usr/src/usr.sbin/sendmail/src/daemon.c | 29 +++++------ usr/src/usr.sbin/sendmail/src/deliver.c | 3 +- usr/src/usr.sbin/sendmail/src/domain.c | 9 ++-- usr/src/usr.sbin/sendmail/src/envelope.c | 6 +-- usr/src/usr.sbin/sendmail/src/err.c | 6 +-- usr/src/usr.sbin/sendmail/src/main.c | 6 +-- usr/src/usr.sbin/sendmail/src/map.c | 6 +-- usr/src/usr.sbin/sendmail/src/queue.c | 9 ++-- usr/src/usr.sbin/sendmail/src/readcf.c | 7 ++- usr/src/usr.sbin/sendmail/src/recipient.c | 9 ++-- usr/src/usr.sbin/sendmail/src/savemail.c | 6 +-- usr/src/usr.sbin/sendmail/src/sendmail.h | 8 ++- usr/src/usr.sbin/sendmail/src/udb.c | 7 ++- usr/src/usr.sbin/sendmail/src/util.c | 7 ++- 17 files changed, 98 insertions(+), 88 deletions(-) diff --git a/usr/src/usr.sbin/sendmail/src/alias.c b/usr/src/usr.sbin/sendmail/src/alias.c index 8f9df51e90..b5605506a3 100644 --- a/usr/src/usr.sbin/sendmail/src/alias.c +++ b/usr/src/usr.sbin/sendmail/src/alias.c @@ -7,10 +7,9 @@ */ # include "sendmail.h" -# include #ifndef lint -static char sccsid[] = "@(#)alias.c 8.40 (Berkeley) %G%"; +static char sccsid[] = "@(#)alias.c 8.41 (Berkeley) %G%"; #endif /* not lint */ diff --git a/usr/src/usr.sbin/sendmail/src/conf.c b/usr/src/usr.sbin/sendmail/src/conf.c index eb27d03d95..358e6d8d0e 100644 --- a/usr/src/usr.sbin/sendmail/src/conf.c +++ b/usr/src/usr.sbin/sendmail/src/conf.c @@ -7,15 +7,13 @@ */ #ifndef lint -static char sccsid[] = "@(#)conf.c 8.142 (Berkeley) %G%"; +static char sccsid[] = "@(#)conf.c 8.143 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" # include "pathnames.h" # include # include -# include -# include /* ** CONF.C -- Sendmail Configuration Tables. @@ -209,7 +207,7 @@ setdefuser() static char defuserbuf[40]; DefUser = defuserbuf; - if ((defpwent = getpwuid(DefUid)) != NULL) + if ((defpwent = sm_getpwuid(DefUid)) != NULL) strcpy(defuserbuf, defpwent->pw_name); else strcpy(defuserbuf, "nobody"); @@ -770,7 +768,7 @@ username() myname = getlogin(); if (myname == NULL || myname[0] == '\0') { - pw = getpwuid(RealUid); + pw = sm_getpwuid(RealUid); if (pw != NULL) myname = newstr(pw->pw_name); } @@ -779,10 +777,10 @@ username() uid_t uid = RealUid; myname = newstr(myname); - if ((pw = getpwnam(myname)) == NULL || + if ((pw = sm_getpwnam(myname)) == NULL || (uid != 0 && uid != pw->pw_uid)) { - pw = getpwuid(uid); + pw = sm_getpwuid(uid); if (pw != NULL) myname = newstr(pw->pw_name); } @@ -2735,22 +2733,23 @@ strtol(nptr, endptr, base) #endif /* -** SOLARIS_GETHOSTBY{NAME,ADDR} -- compatibility routines for gethostbyXXX +** SM_GETHOSTBY{NAME,ADDR} -- compatibility routines for gethostbyXXX ** -** Solaris versions at least through 2.3 don't properly deliver a -** canonical h_name field. This tries to work around it. +** Some operating systems have wierd problems with the gethostbyXXX +** routines. For example, Solaris versions at least through 2.3 +** don't properly deliver a canonical h_name field. This tries to +** work around these problems. */ -#if defined(SOLARIS) && SOLARIS < 204 - -extern int h_errno; - extern int h_errno; struct hostent * -solaris_gethostbyname(name) +sm_gethostbyname(name) const char *name; { +#if defined(SOLARIS) && SOLARIS < 204 + extern int h_errno; + # if SOLARIS == 203 static struct hostent hp; static char buf[1000]; @@ -2762,14 +2761,20 @@ solaris_gethostbyname(name) return __switch_gethostbyname(name); # endif +#else + return gethostbyname(name); +#endif } struct hostent * -solaris_gethostbyaddr(addr, len, type) +sm_gethostbyaddr(addr, len, type) const char *addr; int len; int type; { +#if defined(SOLARIS) && SOLARIS < 204 + extern int h_errno; + # if SOLARIS == 203 static struct hostent hp; static char buf[1000]; @@ -2781,9 +2786,31 @@ solaris_gethostbyaddr(addr, len, type) return __switch_gethostbyaddr(addr, len, type); # endif +#else + return gethostbyaddr(addr, len, type); +#endif } + /* +** SM_GETPW{NAM,UID} -- wrapper for getpwnam and getpwuid +*/ -#endif +struct passwd * +sm_getpwnam(user) + const char *user; +{ + extern struct passwd *getpwnam(); + + return getpwnam(user); +} + +struct passwd * +sm_getpwuid(uid) + uid_t uid; +{ + extern struct passwd *getpwuid(); + + return getpwuid(uid); +} /* ** NI_PROPVAL -- netinfo property value lookup routine ** diff --git a/usr/src/usr.sbin/sendmail/src/conf.h b/usr/src/usr.sbin/sendmail/src/conf.h index 30ee7780a3..8f780e477e 100644 --- a/usr/src/usr.sbin/sendmail/src/conf.h +++ b/usr/src/usr.sbin/sendmail/src/conf.h @@ -5,7 +5,7 @@ * * %sccs.include.redist.c% * - * @(#)conf.h 8.142 (Berkeley) %G% + * @(#)conf.h 8.143 (Berkeley) %G% */ /* @@ -19,6 +19,8 @@ # include # include # include +# include +# include /********************************************************************** ** Table sizes, etc.... diff --git a/usr/src/usr.sbin/sendmail/src/daemon.c b/usr/src/usr.sbin/sendmail/src/daemon.c index 361ff0660c..bd258a2c3d 100644 --- a/usr/src/usr.sbin/sendmail/src/daemon.c +++ b/usr/src/usr.sbin/sendmail/src/daemon.c @@ -12,15 +12,14 @@ #ifndef lint #ifdef DAEMON -static char sccsid[] = "@(#)daemon.c 8.48.1.5 (Berkeley) %G% (with daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.76 (Berkeley) %G% (with daemon mode)"; #else -static char sccsid[] = "@(#)daemon.c 8.48.1.5 (Berkeley) %G% (without daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.76 (Berkeley) %G% (without daemon mode)"; #endif #endif /* not lint */ #ifdef DAEMON -# include # include #if NAMED_BIND @@ -230,7 +229,7 @@ makeconnection(host, port, mci, usesecureport) #endif { /* try it as a host name (avoid MX lookup) */ - hp = gethostbyname(&host[1]); + hp = sm_gethostbyname(&host[1]); if (hp == NULL && p[-1] == '.') { #if NAMED_BIND @@ -239,7 +238,7 @@ makeconnection(host, port, mci, usesecureport) _res.options &= ~(RES_DEFNAMES|RES_DNSRCH); #endif p[-1] = '\0'; - hp = gethostbyname(&host[1]); + hp = sm_gethostbyname(&host[1]); p[-1] = '.'; #if NAMED_BIND _res.options = oldopts; @@ -264,7 +263,7 @@ makeconnection(host, port, mci, usesecureport) { register char *p = &host[strlen(host) - 1]; - hp = gethostbyname(host); + hp = sm_gethostbyname(host); if (hp == NULL && *p == '.') { #if NAMED_BIND @@ -273,7 +272,7 @@ makeconnection(host, port, mci, usesecureport) _res.options &= ~(RES_DEFNAMES|RES_DNSRCH); #endif *p = '\0'; - hp = gethostbyname(host); + hp = sm_gethostbyname(host); *p = '.'; #if NAMED_BIND _res.options = oldopts; @@ -500,7 +499,6 @@ myhostname(hostbuf, size) int size; { register struct hostent *hp; - extern struct hostent *gethostbyname(); extern bool getcanonname(); extern int h_errno; @@ -508,7 +506,7 @@ myhostname(hostbuf, size) { (void) strcpy(hostbuf, "localhost"); } - hp = gethostbyname(hostbuf); + hp = sm_gethostbyname(hostbuf); if (hp == NULL) return NULL; if (strchr(hp->h_name, '.') != NULL || strchr(hostbuf, '.') == NULL) @@ -778,7 +776,6 @@ host_map_lookup(map, name, av, statp) char *cp; register STAB *s; char hbuf[MAXNAME + 1]; - extern struct hostent *gethostbyaddr(); #if NAMED_BIND extern int h_errno; #endif @@ -886,7 +883,7 @@ host_map_lookup(map, name, av, statp) ** Try to look it up in /etc/hosts */ - hp = gethostbyname(name); + hp = sm_gethostbyname(name); if (hp == NULL) { /* no dice there either */ @@ -906,7 +903,7 @@ host_map_lookup(map, name, av, statp) in_addr.s_addr = inet_addr(&name[1]); /* nope -- ask the name server */ - hp = gethostbyaddr((char *)&in_addr, INADDRSZ, AF_INET); + hp = sm_gethostbyaddr((char *)&in_addr, INADDRSZ, AF_INET); s->s_namecanon.nc_errno = errno; #if NAMED_BIND s->s_namecanon.nc_herrno = h_errno; @@ -1012,7 +1009,7 @@ hostnamebyanyaddr(sap) { #ifdef NETINET case AF_INET: - hp = gethostbyaddr((char *) &sap->sin.sin_addr, + hp = sm_gethostbyaddr((char *) &sap->sin.sin_addr, INADDRSZ, AF_INET); break; @@ -1020,7 +1017,7 @@ hostnamebyanyaddr(sap) #ifdef NETISO case AF_ISO: - hp = gethostbyaddr((char *) &sap->siso.siso_addr, + hp = sm_gethostbyaddr((char *) &sap->siso.siso_addr, sizeof sap->siso.siso_addr, AF_ISO); break; @@ -1031,7 +1028,7 @@ hostnamebyanyaddr(sap) break; default: - hp = gethostbyaddr(sap->sa.sa_data, + hp = sm_gethostbyaddr(sap->sa.sa_data, sizeof sap->sa.sa_data, sap->sa.sa_family); break; @@ -1132,7 +1129,7 @@ host_map_lookup(map, name, avp, statp) { register struct hostent *hp; - hp = gethostbyname(name); + hp = sm_gethostbyname(name); if (hp != NULL) return hp->h_name; *statp = EX_NOHOST; diff --git a/usr/src/usr.sbin/sendmail/src/deliver.c b/usr/src/usr.sbin/sendmail/src/deliver.c index 647568660f..a80bff4620 100644 --- a/usr/src/usr.sbin/sendmail/src/deliver.c +++ b/usr/src/usr.sbin/sendmail/src/deliver.c @@ -7,11 +7,10 @@ */ #ifndef lint -static char sccsid[] = "@(#)deliver.c 8.139 (Berkeley) %G%"; +static char sccsid[] = "@(#)deliver.c 8.140 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" -#include #include #if NAMED_BIND #include diff --git a/usr/src/usr.sbin/sendmail/src/domain.c b/usr/src/usr.sbin/sendmail/src/domain.c index 959b860c7a..2bae63bb9b 100644 --- a/usr/src/usr.sbin/sendmail/src/domain.c +++ b/usr/src/usr.sbin/sendmail/src/domain.c @@ -10,9 +10,9 @@ #ifndef lint #if NAMED_BIND -static char sccsid[] = "@(#)domain.c 8.33 (Berkeley) %G% (with name server)"; +static char sccsid[] = "@(#)domain.c 8.34 (Berkeley) %G% (with name server)"; #else -static char sccsid[] = "@(#)domain.c 8.33 (Berkeley) %G% (without name server)"; +static char sccsid[] = "@(#)domain.c 8.34 (Berkeley) %G% (without name server)"; #endif #endif /* not lint */ @@ -20,7 +20,6 @@ static char sccsid[] = "@(#)domain.c 8.33 (Berkeley) %G% (without name server)"; #include #include -#include typedef union { @@ -263,7 +262,7 @@ getmxrr(host, mxhosts, droplocalhost, rcode) { punt: if (seenlocal && - (!TryNullMXList || gethostbyname(host) == NULL)) + (!TryNullMXList || sm_gethostbyname(host) == NULL)) { /* ** If we have deleted all MX entries, this is @@ -870,7 +869,7 @@ getcanonname(host, hbsize, trymx) struct hostent *hp; char *p; - hp = gethostbyname(host); + hp = sm_gethostbyname(host); if (hp == NULL) return (FALSE); p = hp->h_name; diff --git a/usr/src/usr.sbin/sendmail/src/envelope.c b/usr/src/usr.sbin/sendmail/src/envelope.c index 85234809be..d81e41f8d7 100644 --- a/usr/src/usr.sbin/sendmail/src/envelope.c +++ b/usr/src/usr.sbin/sendmail/src/envelope.c @@ -7,11 +7,10 @@ */ #ifndef lint -static char sccsid[] = "@(#)envelope.c 8.56 (Berkeley) %G%"; +static char sccsid[] = "@(#)envelope.c 8.57 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" -#include /* ** NEWENVELOPE -- allocate a new envelope @@ -609,7 +608,6 @@ setsender(from, e, delimptr, internal) char *bp; char buf[MAXNAME + 2]; char pvpbuf[PSBUFSIZE]; - extern struct passwd *getpwnam(); extern char *FullName; if (tTd(45, 1)) @@ -717,7 +715,7 @@ setsender(from, e, delimptr, internal) FullName = NULL; } - if ((pw = getpwnam(e->e_from.q_user)) != NULL) + if ((pw = sm_getpwnam(e->e_from.q_user)) != NULL) { /* ** Process passwd file entry. diff --git a/usr/src/usr.sbin/sendmail/src/err.c b/usr/src/usr.sbin/sendmail/src/err.c index 1ef31662e1..7fff609f0c 100644 --- a/usr/src/usr.sbin/sendmail/src/err.c +++ b/usr/src/usr.sbin/sendmail/src/err.c @@ -7,13 +7,11 @@ */ #ifndef lint -static char sccsid[] = "@(#)err.c 8.31 (Berkeley) %G%"; +static char sccsid[] = "@(#)err.c 8.32 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" # include -# include -# include /* ** SYSERR -- Print error message. @@ -105,7 +103,7 @@ syserr(fmt, va_alist) } # ifdef LOG - pw = getpwuid(getuid()); + pw = sm_getpwuid(getuid()); if (pw != NULL) uname = pw->pw_name; else diff --git a/usr/src/usr.sbin/sendmail/src/main.c b/usr/src/usr.sbin/sendmail/src/main.c index 7ddc6515d7..01fa387787 100644 --- a/usr/src/usr.sbin/sendmail/src/main.c +++ b/usr/src/usr.sbin/sendmail/src/main.c @@ -13,17 +13,15 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 8.93 (Berkeley) %G%"; +static char sccsid[] = "@(#)main.c 8.94 (Berkeley) %G%"; #endif /* not lint */ #define _DEFINE #include "sendmail.h" -#include #if NAMED_BIND #include #endif -#include # ifdef lint char edata, end; @@ -210,7 +208,7 @@ main(argc, argv, envp) RealUid = getuid(); RealGid = getgid(); - pw = getpwuid(RealUid); + pw = sm_getpwuid(RealUid); if (pw != NULL) (void) strcpy(RealUserName, pw->pw_name); else diff --git a/usr/src/usr.sbin/sendmail/src/map.c b/usr/src/usr.sbin/sendmail/src/map.c index ed4ef26bee..a88840da3e 100644 --- a/usr/src/usr.sbin/sendmail/src/map.c +++ b/usr/src/usr.sbin/sendmail/src/map.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)map.c 8.50 (Berkeley) %G%"; +static char sccsid[] = "@(#)map.c 8.51 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -2026,8 +2026,6 @@ user_map_open(map, mode) ** USER_MAP_LOOKUP -- look up a user in the passwd file. */ -#include - char * user_map_lookup(map, key, av, statp) MAP *map; @@ -2041,7 +2039,7 @@ user_map_lookup(map, key, av, statp) printf("user_map_lookup(%s, %s)\n", map->map_mname, key); - pw = getpwnam(key); + pw = sm_getpwnam(key); if (pw == NULL) return NULL; if (bitset(MF_MATCHONLY, map->map_mflags)) diff --git a/usr/src/usr.sbin/sendmail/src/queue.c b/usr/src/usr.sbin/sendmail/src/queue.c index 572211046f..cf56400db6 100644 --- a/usr/src/usr.sbin/sendmail/src/queue.c +++ b/usr/src/usr.sbin/sendmail/src/queue.c @@ -10,14 +10,13 @@ #ifndef lint #ifdef QUEUE -static char sccsid[] = "@(#)queue.c 8.74 (Berkeley) %G% (with queueing)"; +static char sccsid[] = "@(#)queue.c 8.75 (Berkeley) %G% (with queueing)"; #else -static char sccsid[] = "@(#)queue.c 8.74 (Berkeley) %G% (without queueing)"; +static char sccsid[] = "@(#)queue.c 8.75 (Berkeley) %G% (without queueing)"; #endif #endif /* not lint */ # include -# include # include # ifdef QUEUE @@ -432,7 +431,7 @@ printctladdr(a, tfp) lastuid = uid; lastctladdr = a; - if (uid == 0 || (pw = getpwuid(uid)) == NULL) + if (uid == 0 || (pw = sm_getpwuid(uid)) == NULL) uname = ""; else uname = pw->pw_name; @@ -1814,7 +1813,7 @@ setctluser(user) p = strchr(user, ':'); if (p != NULL) *p++ = '\0'; - if (*user != '\0' && (pw = getpwnam(user)) != NULL) + if (*user != '\0' && (pw = sm_getpwnam(user)) != NULL) { if (strcmp(pw->pw_dir, "/") == 0) a->q_home = ""; diff --git a/usr/src/usr.sbin/sendmail/src/readcf.c b/usr/src/usr.sbin/sendmail/src/readcf.c index 70412c0e4d..3a0cb82476 100644 --- a/usr/src/usr.sbin/sendmail/src/readcf.c +++ b/usr/src/usr.sbin/sendmail/src/readcf.c @@ -7,11 +7,10 @@ */ #ifndef lint -static char sccsid[] = "@(#)readcf.c 8.76 (Berkeley) %G%"; +static char sccsid[] = "@(#)readcf.c 8.77 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" -# include # include #if NAMED_BIND # include @@ -909,7 +908,7 @@ makemailer(line) *p++ = '\0'; if (*p != '\0') *p++ = '\0'; - pw = getpwnam(q); + pw = sm_getpwnam(q); if (pw == NULL) syserr("readcf: mailer U= flag: unknown user %s", q); else @@ -1810,7 +1809,7 @@ setoption(opt, val, sticky) register struct passwd *pw; DefUid = -1; - pw = getpwnam(val); + pw = sm_getpwnam(val); if (pw == NULL) syserr("readcf: option u: unknown user %s", val); else diff --git a/usr/src/usr.sbin/sendmail/src/recipient.c b/usr/src/usr.sbin/sendmail/src/recipient.c index f48b1c9acb..376f99a983 100644 --- a/usr/src/usr.sbin/sendmail/src/recipient.c +++ b/usr/src/usr.sbin/sendmail/src/recipient.c @@ -7,11 +7,10 @@ */ #ifndef lint -static char sccsid[] = "@(#)recipient.c 8.75 (Berkeley) %G%"; +static char sccsid[] = "@(#)recipient.c 8.76 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" -# include /* ** SENDTOLIST -- Designate a send list. @@ -630,8 +629,6 @@ finduser(name, fuzzyp) { register struct passwd *pw; register char *p; - extern struct passwd *getpwent(); - extern struct passwd *getpwnam(); if (tTd(29, 4)) printf("finduser(%s): ", name); @@ -652,7 +649,7 @@ finduser(name, fuzzyp) #endif /* look up this login name using fast path */ - if ((pw = getpwnam(name)) != NULL) + if ((pw = sm_getpwnam(name)) != NULL) { if (tTd(29, 4)) printf("found (non-fuzzy)\n"); @@ -1008,7 +1005,7 @@ resetuid: { register struct passwd *pw; - pw = getpwuid(st.st_uid); + pw = sm_getpwuid(st.st_uid); if (pw == NULL) ctladdr->q_flags |= QBOGUSSHELL; else diff --git a/usr/src/usr.sbin/sendmail/src/savemail.c b/usr/src/usr.sbin/sendmail/src/savemail.c index 840ac25665..94e73b79b6 100644 --- a/usr/src/usr.sbin/sendmail/src/savemail.c +++ b/usr/src/usr.sbin/sendmail/src/savemail.c @@ -7,11 +7,10 @@ */ #ifndef lint -static char sccsid[] = "@(#)savemail.c 8.61 (Berkeley) %G%"; +static char sccsid[] = "@(#)savemail.c 8.62 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" -# include /* ** SAVEMAIL -- Save mail on error @@ -61,7 +60,6 @@ savemail(e, sendbody) register char *p; MCI mcibuf; char buf[MAXLINE+1]; - extern struct passwd *getpwnam(); extern char *ttypath(); typedef int (*fnptr)(); extern bool writable(); @@ -309,7 +307,7 @@ savemail(e, sendbody) { if (e->e_from.q_home != NULL) p = e->e_from.q_home; - else if ((pw = getpwnam(e->e_from.q_user)) != NULL) + else if ((pw = sm_getpwnam(e->e_from.q_user)) != NULL) p = pw->pw_dir; } if (p == NULL) diff --git a/usr/src/usr.sbin/sendmail/src/sendmail.h b/usr/src/usr.sbin/sendmail/src/sendmail.h index fc3ef4adf3..e8885d5432 100644 --- a/usr/src/usr.sbin/sendmail/src/sendmail.h +++ b/usr/src/usr.sbin/sendmail/src/sendmail.h @@ -5,7 +5,7 @@ * * %sccs.include.redist.c% * - * @(#)sendmail.h 8.109 (Berkeley) %G% + * @(#)sendmail.h 8.110 (Berkeley) %G% */ /* @@ -15,7 +15,7 @@ # ifdef _DEFINE # define EXTERN # ifndef lint -static char SmailSccsId[] = "@(#)sendmail.h 8.109 %G%"; +static char SmailSccsId[] = "@(#)sendmail.h 8.110 %G%"; # endif # else /* _DEFINE */ # define EXTERN extern @@ -1099,6 +1099,10 @@ extern void finis __P(()); extern void clrevent __P((EVENT *)); extern void setsender __P((char *, ENVELOPE *, char **, bool)); extern FILE *safefopen __P((char *, int, int, int)); +extern struct hostent *sm_gethostbyname __P((const char *)); +extern struct hostent *sm_gethostbyaddr __P((const char *, int, int)); +extern struct passwd *sm_getpwnam __P((const char *)); +extern struct passwd *sm_getpwuid __P((uid_t)); /* ellipsis is a different case though */ #ifdef __STDC__ diff --git a/usr/src/usr.sbin/sendmail/src/udb.c b/usr/src/usr.sbin/sendmail/src/udb.c index e14258d3a2..c5ef5865a3 100644 --- a/usr/src/usr.sbin/sendmail/src/udb.c +++ b/usr/src/usr.sbin/sendmail/src/udb.c @@ -10,16 +10,15 @@ #ifndef lint #ifdef USERDB -static char sccsid [] = "@(#)udb.c 8.16 (Berkeley) %G% (with USERDB)"; +static char sccsid [] = "@(#)udb.c 8.17 (Berkeley) %G% (with USERDB)"; #else -static char sccsid [] = "@(#)udb.c 8.16 (Berkeley) %G% (without USERDB)"; +static char sccsid [] = "@(#)udb.c 8.17 (Berkeley) %G% (without USERDB)"; #endif #endif #ifdef USERDB #include -#include #include #ifdef HESIOD @@ -781,7 +780,7 @@ _udbx_init() for (i = 0; i < nmx; i++) { - h = gethostbyname(mxhosts[i]); + h = sm_gethostbyname(mxhosts[i]); if (h == NULL) continue; up->udb_type = UDB_REMOTE; diff --git a/usr/src/usr.sbin/sendmail/src/util.c b/usr/src/usr.sbin/sendmail/src/util.c index 1fcef30cae..a7833f0d08 100644 --- a/usr/src/usr.sbin/sendmail/src/util.c +++ b/usr/src/usr.sbin/sendmail/src/util.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)util.c 8.58 (Berkeley) %G%"; +static char sccsid[] = "@(#)util.c 8.59 (Berkeley) %G%"; #endif /* not lint */ # include "sendmail.h" @@ -1450,7 +1450,6 @@ checkfd012(where) ** none. */ -#include #include printopenfds(logit) @@ -1519,7 +1518,7 @@ dumpfd(fd, printclosed, logit) sprintf(p, "(badsock)"); else { - hp = gethostbyaddr((char *) &sin.sin_addr, + hp = sm_gethostbyaddr((char *) &sin.sin_addr, INADDRSZ, AF_INET); sprintf(p, "%s/%d", hp == NULL ? inet_ntoa(sin.sin_addr) : hp->h_name, ntohs(sin.sin_port)); @@ -1532,7 +1531,7 @@ dumpfd(fd, printclosed, logit) sprintf(p, "(badsock)"); else { - hp = gethostbyaddr((char *) &sin.sin_addr, + hp = sm_gethostbyaddr((char *) &sin.sin_addr, INADDRSZ, AF_INET); sprintf(p, "%s/%d", hp == NULL ? inet_ntoa(sin.sin_addr) : hp->h_name, ntohs(sin.sin_port)); -- 2.20.1