implementation of aliases that puts first unqualified A option
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 30 May 1995 09:17:24 +0000 (01:17 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 30 May 1995 09:17:24 +0000 (01:17 -0800)
as local; rest of A options after switched lookup

SCCS-vsn: usr.sbin/sendmail/src/alias.c 8.48
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.183

usr/src/usr.sbin/sendmail/src/alias.c
usr/src/usr.sbin/sendmail/src/conf.c

index 8a1712c..6335fb2 100644 (file)
@@ -9,12 +9,12 @@
 # include "sendmail.h"
 
 #ifndef lint
 # include "sendmail.h"
 
 #ifndef lint
-static char sccsid[] = "@(#)alias.c    8.47 (Berkeley) %G%";
+static char sccsid[] = "@(#)alias.c    8.48 (Berkeley) %G%";
 #endif /* not lint */
 
 
 MAP    *AliasDB[MAXALIASDB + 1];       /* actual database list */
 #endif /* not lint */
 
 
 MAP    *AliasDB[MAXALIASDB + 1];       /* actual database list */
-int    NAliasDBs;                      /* number of alias databases */
+int    NAliasDBs = 1;                  /* number of alias databases */
 \f/*
 **  ALIAS -- Compute aliases.
 **
 \f/*
 **  ALIAS -- Compute aliases.
 **
@@ -177,7 +177,7 @@ aliaslookup(name, pstat, e)
        for (dbno = 0; dbno < NAliasDBs; dbno++)
        {
                map = AliasDB[dbno];
        for (dbno = 0; dbno < NAliasDBs; dbno++)
        {
                map = AliasDB[dbno];
-               if (!bitset(MF_OPEN, map->map_mflags))
+               if (map == NULL || !bitset(MF_OPEN, map->map_mflags))
                        continue;
                p = (*map->map_class->map_lookup)(map, name, NULL, pstat);
                if (p != NULL)
                        continue;
                p = (*map->map_class->map_lookup)(map, name, NULL, pstat);
                if (p != NULL)
index 69f7d5e..4c850e7 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     8.182 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     8.183 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -426,6 +426,7 @@ inithostmaps()
 {
        register int i;
        int nmaps;
 {
        register int i;
        int nmaps;
+       STAB *s;
        char *maptype[MAXMAPSTACK];
        short mapreturn[MAXMAPACTIONS];
        char buf[MAXLINE];
        char *maptype[MAXMAPSTACK];
        short mapreturn[MAXMAPACTIONS];
        char buf[MAXLINE];
@@ -516,13 +517,21 @@ inithostmaps()
                }
 #endif
        }
                }
 #endif
        }
-       if (stab("aliases", ST_MAP, ST_FIND) == NULL)
+       s = stab("aliases", ST_MAP, ST_FIND);
+       if (s == NULL)
        {
                strcpy(buf, "aliases switch aliases");
                makemapentry(buf);
        {
                strcpy(buf, "aliases switch aliases");
                makemapentry(buf);
+               s = stab("aliases", ST_MAP, ST_FIND);
+       }
+       if (s == NULL)
+               syserr("inithostmaps: cannot initialize default aliases map");
+       else
+       {
+               extern MAP *AliasDB[MAXALIASDB + 1];
+
+               AliasDB[0] = &s->s_map;
        }
        }
-       strcpy(buf, "switch:aliases");
-       setalias(buf);
 
 #if 0          /* "user" map class is a better choice */
        /*
 
 #if 0          /* "user" map class is a better choice */
        /*