open non-alias maps before initializing alias maps
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 12 Dec 1993 00:26:14 +0000 (16:26 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 12 Dec 1993 00:26:14 +0000 (16:26 -0800)
SCCS-vsn: usr.sbin/sendmail/src/map.c 8.20

usr/src/usr.sbin/sendmail/src/map.c

index 3bfb0c8..61926c2 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)map.c      8.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)map.c      8.20 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -310,7 +310,15 @@ initmaps(rebuild, e)
        checkfd012("entering initmaps");
 #endif
        CurEnv = e;
        checkfd012("entering initmaps");
 #endif
        CurEnv = e;
-       stabapply(map_init, rebuild);
+       if (rebuild)
+       {
+               stabapply(map_init, 1);
+               stabapply(map_init, 2);
+       }
+       else
+       {
+               stabapply(map_init, 0);
+       }
 #ifdef XDEBUG
        checkfd012("exiting initmaps");
 #endif
 #ifdef XDEBUG
        checkfd012("exiting initmaps");
 #endif
@@ -332,10 +340,19 @@ map_init(s, rebuild)
                return;
 
        if (tTd(38, 2))
                return;
 
        if (tTd(38, 2))
-               printf("map_init(%s:%s)\n",
+               printf("map_init(%s:%s, %d)\n",
                        map->map_class->map_cname == NULL ? "NULL" :
                                map->map_class->map_cname,
                        map->map_class->map_cname == NULL ? "NULL" :
                                map->map_class->map_cname,
-                       map->map_file == NULL ? "NULL" : map->map_file);
+                       map->map_file == NULL ? "NULL" : map->map_file,
+                       rebuild);
+
+       if (rebuild == (bitset(MF_ALIAS, map->map_mflags) &&
+                   bitset(MCF_REBUILDABLE, map->map_class->map_cflags) ? 1 : 2))
+       {
+               if (tTd(38, 3))
+                       printf("\twrong pass\n");
+               return;
+       }
 
        /* if already open, close it (for nested open) */
        if (bitset(MF_OPEN, map->map_mflags))
 
        /* if already open, close it (for nested open) */
        if (bitset(MF_OPEN, map->map_mflags))
@@ -344,18 +361,16 @@ map_init(s, rebuild)
                map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
        }
 
                map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
        }
 
-       if (rebuild)
+       if (rebuild == 2)
        {
        {
-               if (bitset(MF_ALIAS, map->map_mflags) &&
-                   bitset(MCF_REBUILDABLE, map->map_class->map_cflags))
-                       rebuildaliases(map, FALSE);
+               rebuildaliases(map, FALSE);
        }
        else
        {
                if (map->map_class->map_open(map, O_RDONLY))
                {
                        if (tTd(38, 4))
        }
        else
        {
                if (map->map_class->map_open(map, O_RDONLY))
                {
                        if (tTd(38, 4))
-                               printf("%s:%s: valid\n",
+                               printf("\t%s:%s: valid\n",
                                        map->map_class->map_cname == NULL ? "NULL" :
                                                map->map_class->map_cname,
                                        map->map_file == NULL ? "NULL" :
                                        map->map_class->map_cname == NULL ? "NULL" :
                                                map->map_class->map_cname,
                                        map->map_file == NULL ? "NULL" :
@@ -363,7 +378,7 @@ map_init(s, rebuild)
                        map->map_mflags |= MF_OPEN;
                }
                else if (tTd(38, 4))
                        map->map_mflags |= MF_OPEN;
                }
                else if (tTd(38, 4))
-                       printf("%s:%s: invalid: %s\n",
+                       printf("\t%s:%s: invalid: %s\n",
                                map->map_class->map_cname == NULL ? "NULL" :
                                        map->map_class->map_cname,
                                map->map_file == NULL ? "NULL" :
                                map->map_class->map_cname == NULL ? "NULL" :
                                        map->map_class->map_cname,
                                map->map_file == NULL ? "NULL" :