pull getpwXXX and gethostbyXXX calls out into conf.c so they can
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 1 Apr 1995 01:52:31 +0000 (17:52 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 1 Apr 1995 01:52:31 +0000 (17:52 -0800)
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

17 files changed:
usr/src/usr.sbin/sendmail/src/alias.c
usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/conf.h
usr/src/usr.sbin/sendmail/src/daemon.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/domain.c
usr/src/usr.sbin/sendmail/src/envelope.c
usr/src/usr.sbin/sendmail/src/err.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/map.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/udb.c
usr/src/usr.sbin/sendmail/src/util.c

index 8f9df51..b560550 100644 (file)
@@ -7,10 +7,9 @@
  */
 
 # include "sendmail.h"
  */
 
 # include "sendmail.h"
-# include <pwd.h>
 
 #ifndef lint
 
 #ifndef lint
-static char sccsid[] = "@(#)alias.c    8.40 (Berkeley) %G%";
+static char sccsid[] = "@(#)alias.c    8.41 (Berkeley) %G%";
 #endif /* not lint */
 
 
 #endif /* not lint */
 
 
index eb27d03..358e6d8 100644 (file)
@@ -7,15 +7,13 @@
  */
 
 #ifndef lint
  */
 
 #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 <sys/ioctl.h>
 # include <sys/param.h>
 #endif /* not lint */
 
 # include "sendmail.h"
 # include "pathnames.h"
 # include <sys/ioctl.h>
 # include <sys/param.h>
-# include <netdb.h>
-# include <pwd.h>
 
 /*
 **  CONF.C -- Sendmail Configuration Tables.
 
 /*
 **  CONF.C -- Sendmail Configuration Tables.
@@ -209,7 +207,7 @@ setdefuser()
        static char defuserbuf[40];
 
        DefUser = defuserbuf;
        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");
                strcpy(defuserbuf, defpwent->pw_name);
        else
                strcpy(defuserbuf, "nobody");
@@ -770,7 +768,7 @@ username()
                myname = getlogin();
                if (myname == NULL || myname[0] == '\0')
                {
                myname = getlogin();
                if (myname == NULL || myname[0] == '\0')
                {
-                       pw = getpwuid(RealUid);
+                       pw = sm_getpwuid(RealUid);
                        if (pw != NULL)
                                myname = newstr(pw->pw_name);
                }
                        if (pw != NULL)
                                myname = newstr(pw->pw_name);
                }
@@ -779,10 +777,10 @@ username()
                        uid_t uid = RealUid;
 
                        myname = newstr(myname);
                        uid_t uid = RealUid;
 
                        myname = newstr(myname);
-                       if ((pw = getpwnam(myname)) == NULL ||
+                       if ((pw = sm_getpwnam(myname)) == NULL ||
                              (uid != 0 && uid != pw->pw_uid))
                        {
                              (uid != 0 && uid != pw->pw_uid))
                        {
-                               pw = getpwuid(uid);
+                               pw = sm_getpwuid(uid);
                                if (pw != NULL)
                                        myname = newstr(pw->pw_name);
                        }
                                if (pw != NULL)
                                        myname = newstr(pw->pw_name);
                        }
@@ -2735,22 +2733,23 @@ strtol(nptr, endptr, base)
 
 #endif
 \f/*
 
 #endif
 \f/*
-**  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 *
 extern int     h_errno;
 
 struct hostent *
-solaris_gethostbyname(name)
+sm_gethostbyname(name)
        const char *name;
 {
        const char *name;
 {
+#if defined(SOLARIS) && SOLARIS < 204
+       extern int h_errno;
+
 # if SOLARIS == 203
        static struct hostent hp;
        static char buf[1000];
 # if SOLARIS == 203
        static struct hostent hp;
        static char buf[1000];
@@ -2762,14 +2761,20 @@ solaris_gethostbyname(name)
 
        return __switch_gethostbyname(name);
 # endif
 
        return __switch_gethostbyname(name);
 # endif
+#else
+       return gethostbyname(name);
+#endif
 }
 
 struct hostent *
 }
 
 struct hostent *
-solaris_gethostbyaddr(addr, len, type)
+sm_gethostbyaddr(addr, len, type)
        const char *addr;
        int len;
        int 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];
 # 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
 
        return __switch_gethostbyaddr(addr, len, type);
 # endif
+#else
+       return gethostbyaddr(addr, len, type);
+#endif
 }
 }
+\f/*
+**  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);
+}
 \f/*
 **  NI_PROPVAL -- netinfo property value lookup routine
 **
 \f/*
 **  NI_PROPVAL -- netinfo property value lookup routine
 **
index 30ee778..8f780e4 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)conf.h      8.142 (Berkeley) %G%
+ *     @(#)conf.h      8.143 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -19,6 +19,8 @@
 # include <sys/wait.h>
 # include <fcntl.h>
 # include <signal.h>
 # include <sys/wait.h>
 # include <fcntl.h>
 # include <signal.h>
+# include <netdb.h>
+# include <pwd.h>
 
 /**********************************************************************
 **  Table sizes, etc....
 
 /**********************************************************************
 **  Table sizes, etc....
index 361ff06..bd258a2 100644 (file)
 
 #ifndef lint
 #ifdef DAEMON
 
 #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
 #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
 
 #endif
 #endif /* not lint */
 
 #ifdef DAEMON
 
-# include <netdb.h>
 # include <arpa/inet.h>
 
 #if NAMED_BIND
 # include <arpa/inet.h>
 
 #if NAMED_BIND
@@ -230,7 +229,7 @@ makeconnection(host, port, mci, usesecureport)
 #endif
                        {
                                /* try it as a host name (avoid MX lookup) */
 #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
                                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';
                                        _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;
                                        p[-1] = '.';
 #if NAMED_BIND
                                        _res.options = oldopts;
@@ -264,7 +263,7 @@ makeconnection(host, port, mci, usesecureport)
        {
                register char *p = &host[strlen(host) - 1];
 
        {
                register char *p = &host[strlen(host) - 1];
 
-               hp = gethostbyname(host);
+               hp = sm_gethostbyname(host);
                if (hp == NULL && *p == '.')
                {
 #if NAMED_BIND
                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';
                        _res.options &= ~(RES_DEFNAMES|RES_DNSRCH);
 #endif
                        *p = '\0';
-                       hp = gethostbyname(host);
+                       hp = sm_gethostbyname(host);
                        *p = '.';
 #if NAMED_BIND
                        _res.options = oldopts;
                        *p = '.';
 #if NAMED_BIND
                        _res.options = oldopts;
@@ -500,7 +499,6 @@ myhostname(hostbuf, size)
        int size;
 {
        register struct hostent *hp;
        int size;
 {
        register struct hostent *hp;
-       extern struct hostent *gethostbyname();
        extern bool getcanonname();
        extern int h_errno;
 
        extern bool getcanonname();
        extern int h_errno;
 
@@ -508,7 +506,7 @@ myhostname(hostbuf, size)
        {
                (void) strcpy(hostbuf, "localhost");
        }
        {
                (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)
        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];
        char *cp;
        register STAB *s;
        char hbuf[MAXNAME + 1];
-       extern struct hostent *gethostbyaddr();
 #if NAMED_BIND
        extern int h_errno;
 #endif
 #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
                        */
 
                        **  Try to look it up in /etc/hosts
                        */
 
-                       hp = gethostbyname(name);
+                       hp = sm_gethostbyname(name);
                        if (hp == NULL)
                        {
                                /* no dice there either */
                        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 */
        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;
        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:
        {
 #ifdef NETINET
          case AF_INET:
-               hp = gethostbyaddr((char *) &sap->sin.sin_addr,
+               hp = sm_gethostbyaddr((char *) &sap->sin.sin_addr,
                        INADDRSZ,
                        AF_INET);
                break;
                        INADDRSZ,
                        AF_INET);
                break;
@@ -1020,7 +1017,7 @@ hostnamebyanyaddr(sap)
 
 #ifdef NETISO
          case AF_ISO:
 
 #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;
                        sizeof sap->siso.siso_addr,
                        AF_ISO);
                break;
@@ -1031,7 +1028,7 @@ hostnamebyanyaddr(sap)
                break;
 
          default:
                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;
                           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;
 
 {
        register struct hostent *hp;
 
-       hp = gethostbyname(name);
+       hp = sm_gethostbyname(name);
        if (hp != NULL)
                return hp->h_name;
        *statp = EX_NOHOST;
        if (hp != NULL)
                return hp->h_name;
        *statp = EX_NOHOST;
index 6475686..a80bff4 100644 (file)
@@ -7,11 +7,10 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 #include "sendmail.h"
-#include <netdb.h>
 #include <errno.h>
 #if NAMED_BIND
 #include <resolv.h>
 #include <errno.h>
 #if NAMED_BIND
 #include <resolv.h>
index 959b860..2bae63b 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #if NAMED_BIND
 
 #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
 #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 */
 
 #endif
 #endif /* not lint */
 
@@ -20,7 +20,6 @@ static char sccsid[] = "@(#)domain.c  8.33 (Berkeley) %G% (without name server)";
 
 #include <errno.h>
 #include <resolv.h>
 
 #include <errno.h>
 #include <resolv.h>
-#include <netdb.h>
 
 typedef union
 {
 
 typedef union
 {
@@ -263,7 +262,7 @@ getmxrr(host, mxhosts, droplocalhost, rcode)
        {
 punt:
                if (seenlocal &&
        {
 punt:
                if (seenlocal &&
-                   (!TryNullMXList || gethostbyname(host) == NULL))
+                   (!TryNullMXList || sm_gethostbyname(host) == NULL))
                {
                        /*
                        **  If we have deleted all MX entries, this is
                {
                        /*
                        **  If we have deleted all MX entries, this is
@@ -870,7 +869,7 @@ getcanonname(host, hbsize, trymx)
        struct hostent *hp;
        char *p;
 
        struct hostent *hp;
        char *p;
 
-       hp = gethostbyname(host);
+       hp = sm_gethostbyname(host);
        if (hp == NULL)
                return (FALSE);
        p = hp->h_name;
        if (hp == NULL)
                return (FALSE);
        p = hp->h_name;
index 8523480..d81e41f 100644 (file)
@@ -7,11 +7,10 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 #include "sendmail.h"
-#include <pwd.h>
 
 /*
 **  NEWENVELOPE -- allocate a new envelope
 
 /*
 **  NEWENVELOPE -- allocate a new envelope
@@ -609,7 +608,6 @@ setsender(from, e, delimptr, internal)
        char *bp;
        char buf[MAXNAME + 2];
        char pvpbuf[PSBUFSIZE];
        char *bp;
        char buf[MAXNAME + 2];
        char pvpbuf[PSBUFSIZE];
-       extern struct passwd *getpwnam();
        extern char *FullName;
 
        if (tTd(45, 1))
        extern char *FullName;
 
        if (tTd(45, 1))
@@ -717,7 +715,7 @@ setsender(from, e, delimptr, internal)
                                FullName = NULL;
                }
 
                                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.
                {
                        /*
                        **  Process passwd file entry.
index 1ef3166..7fff609 100644 (file)
@@ -7,13 +7,11 @@
  */
 
 #ifndef lint
  */
 
 #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 <errno.h>
 #endif /* not lint */
 
 # include "sendmail.h"
 # include <errno.h>
-# include <netdb.h>
-# include <pwd.h>
 
 /*
 **  SYSERR -- Print error message.
 
 /*
 **  SYSERR -- Print error message.
@@ -105,7 +103,7 @@ syserr(fmt, va_alist)
        }
 
 # ifdef LOG
        }
 
 # ifdef LOG
-       pw = getpwuid(getuid());
+       pw = sm_getpwuid(getuid());
        if (pw != NULL)
                uname = pw->pw_name;
        else
        if (pw != NULL)
                uname = pw->pw_name;
        else
index 7ddc651..01fa387 100644 (file)
@@ -13,17 +13,15 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #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"
 #endif /* not lint */
 
 #define        _DEFINE
 
 #include "sendmail.h"
-#include <netdb.h>
 #if NAMED_BIND
 #include <resolv.h>
 #endif
 #if NAMED_BIND
 #include <resolv.h>
 #endif
-#include <pwd.h>
 
 # ifdef lint
 char   edata, end;
 
 # ifdef lint
 char   edata, end;
@@ -210,7 +208,7 @@ main(argc, argv, envp)
        RealUid = getuid();
        RealGid = getgid();
 
        RealUid = getuid();
        RealGid = getgid();
 
-       pw = getpwuid(RealUid);
+       pw = sm_getpwuid(RealUid);
        if (pw != NULL)
                (void) strcpy(RealUserName, pw->pw_name);
        else
        if (pw != NULL)
                (void) strcpy(RealUserName, pw->pw_name);
        else
index ed4ef26..a88840d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #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.
 */
 
 **  USER_MAP_LOOKUP -- look up a user in the passwd file.
 */
 
-#include <pwd.h>
-
 char *
 user_map_lookup(map, key, av, statp)
        MAP *map;
 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);
 
                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))
        if (pw == NULL)
                return NULL;
        if (bitset(MF_MATCHONLY, map->map_mflags))
index 5722110..cf56400 100644 (file)
 
 #ifndef lint
 #ifdef QUEUE
 
 #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
 #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 <errno.h>
 #endif
 #endif /* not lint */
 
 # include <errno.h>
-# include <pwd.h>
 # include <dirent.h>
 
 # ifdef QUEUE
 # include <dirent.h>
 
 # ifdef QUEUE
@@ -432,7 +431,7 @@ printctladdr(a, tfp)
        lastuid = uid;
        lastctladdr = a;
 
        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;
                uname = "";
        else
                uname = pw->pw_name;
@@ -1814,7 +1813,7 @@ setctluser(user)
        p = strchr(user, ':');
        if (p != NULL)
                *p++ = '\0';
        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 = "";
        {
                if (strcmp(pw->pw_dir, "/") == 0)
                        a->q_home = "";
index 70412c0..3a0cb82 100644 (file)
@@ -7,11 +7,10 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 # include "sendmail.h"
-# include <pwd.h>
 # include <grp.h>
 #if NAMED_BIND
 # include <resolv.h>
 # include <grp.h>
 #if NAMED_BIND
 # include <resolv.h>
@@ -909,7 +908,7 @@ makemailer(line)
                                        *p++ = '\0';
                                if (*p != '\0')
                                        *p++ = '\0';
                                        *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
                                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;
                        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
                        if (pw == NULL)
                                syserr("readcf: option u: unknown user %s", val);
                        else
index f48b1c9..376f99a 100644 (file)
@@ -7,11 +7,10 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 # include "sendmail.h"
-# include <pwd.h>
 
 /*
 **  SENDTOLIST -- Designate a send list.
 
 /*
 **  SENDTOLIST -- Designate a send list.
@@ -630,8 +629,6 @@ finduser(name, fuzzyp)
 {
        register struct passwd *pw;
        register char *p;
 {
        register struct passwd *pw;
        register char *p;
-       extern struct passwd *getpwent();
-       extern struct passwd *getpwnam();
 
        if (tTd(29, 4))
                printf("finduser(%s): ", name);
 
        if (tTd(29, 4))
                printf("finduser(%s): ", name);
@@ -652,7 +649,7 @@ finduser(name, fuzzyp)
 #endif
 
        /* look up this login name using fast path */
 #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");
        {
                if (tTd(29, 4))
                        printf("found (non-fuzzy)\n");
@@ -1008,7 +1005,7 @@ resetuid:
        {
                register struct passwd *pw;
 
        {
                register struct passwd *pw;
 
-               pw = getpwuid(st.st_uid);
+               pw = sm_getpwuid(st.st_uid);
                if (pw == NULL)
                        ctladdr->q_flags |= QBOGUSSHELL;
                else
                if (pw == NULL)
                        ctladdr->q_flags |= QBOGUSSHELL;
                else
index 840ac25..94e73b7 100644 (file)
@@ -7,11 +7,10 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 # include "sendmail.h"
-# include <pwd.h>
 
 /*
 **  SAVEMAIL -- Save mail on error
 
 /*
 **  SAVEMAIL -- Save mail on error
@@ -61,7 +60,6 @@ savemail(e, sendbody)
        register char *p;
        MCI mcibuf;
        char buf[MAXLINE+1];
        register char *p;
        MCI mcibuf;
        char buf[MAXLINE+1];
-       extern struct passwd *getpwnam();
        extern char *ttypath();
        typedef int (*fnptr)();
        extern bool writable();
        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;
                        {
                                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)
                                        p = pw->pw_dir;
                        }
                        if (p == NULL)
index fc3ef4a..e8885d5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %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
 # 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
 # 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 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__
 
 /* ellipsis is a different case though */
 #ifdef __STDC__
index e14258d..c5ef586 100644 (file)
 
 #ifndef lint
 #ifdef USERDB
 
 #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
 #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 <errno.h>
 #endif
 #endif
 
 #ifdef USERDB
 
 #include <errno.h>
-#include <netdb.h>
 #include <db.h>
 
 #ifdef HESIOD
 #include <db.h>
 
 #ifdef HESIOD
@@ -781,7 +780,7 @@ _udbx_init()
 
                        for (i = 0; i < nmx; i++)
                        {
 
                        for (i = 0; i < nmx; i++)
                        {
-                               h = gethostbyname(mxhosts[i]);
+                               h = sm_gethostbyname(mxhosts[i]);
                                if (h == NULL)
                                        continue;
                                up->udb_type = UDB_REMOTE;
                                if (h == NULL)
                                        continue;
                                up->udb_type = UDB_REMOTE;
index 1fcef30..a7833f0 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #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"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -1450,7 +1450,6 @@ checkfd012(where)
 **             none.
 */
 
 **             none.
 */
 
-#include <netdb.h>
 #include <arpa/inet.h>
 
 printopenfds(logit)
 #include <arpa/inet.h>
 
 printopenfds(logit)
@@ -1519,7 +1518,7 @@ dumpfd(fd, printclosed, logit)
                        sprintf(p, "(badsock)");
                else
                {
                        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));
                                           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
                {
                        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));
                                           INADDRSZ, AF_INET);
                        sprintf(p, "%s/%d", hp == NULL ? inet_ntoa(sin.sin_addr)
                                                   : hp->h_name, ntohs(sin.sin_port));