if a non-optional map cannot be opened, queue mail that needs it
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 11 Dec 1994 01:30:18 +0000 (17:30 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 11 Dec 1994 01:30:18 +0000 (17:30 -0800)
SCCS-vsn: usr.sbin/sendmail/src/map.c 8.38

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

index a1b69f2..34ee107 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)map.c      8.37 (Berkeley) %G%";
+static char sccsid[] = "@(#)map.c      8.38 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -419,15 +419,25 @@ map_init(s, rebuild)
                                                map->map_file);
                        map->map_mflags |= MF_OPEN;
                }
                                                map->map_file);
                        map->map_mflags |= MF_OPEN;
                }
-               else if (tTd(38, 4))
-                       printf("\t%s:%s %s: invalid: %s\n",
-                               map->map_class->map_cname == NULL ? "NULL" :
-                                       map->map_class->map_cname,
-                               map->map_mname == NULL ? "NULL" :
-                                       map->map_mname,
-                               map->map_file == NULL ? "NULL" :
-                                       map->map_file,
-                               errstring(errno));
+               else
+               {
+                       if (tTd(38, 4))
+                               printf("\t%s:%s %s: invalid: %s\n",
+                                       map->map_class->map_cname == NULL ? "NULL" :
+                                               map->map_class->map_cname,
+                                       map->map_mname == NULL ? "NULL" :
+                                               map->map_mname,
+                                       map->map_file == NULL ? "NULL" :
+                                               map->map_file,
+                                       errstring(errno));
+                       if (!bitset(MF_OPTIONAL, map->map_mflags))
+                       {
+                               extern MAPCLASS BogusMapClass;
+
+                               map->map_class = &BogusMapClass;
+                               map->map_mflags |= MF_OPEN;
+                       }
+               }
        }
 }
 \f/*
        }
 }
 \f/*
@@ -1009,7 +1019,7 @@ nis_map_open(map, mode)
                if (yperr != 0)
                {
                        if (!bitset(MF_OPTIONAL, map->map_mflags))
                if (yperr != 0)
                {
                        if (!bitset(MF_OPTIONAL, map->map_mflags))
-                               syserr("NIS map %s specified, but NIS not running\n",
+                               syserr("421 NIS map %s specified, but NIS not running\n",
                                        map->map_file);
                        return FALSE;
                }
                                        map->map_file);
                        return FALSE;
                }
@@ -1025,7 +1035,7 @@ nis_map_open(map, mode)
                return TRUE;
 
        if (!bitset(MF_OPTIONAL, map->map_mflags))
                return TRUE;
 
        if (!bitset(MF_OPTIONAL, map->map_mflags))
-               syserr("Cannot bind to domain %s: %s", map->map_domain,
+               syserr("421 Cannot bind to domain %s: %s", map->map_domain,
                        yperr_string(yperr));
 
        return FALSE;
                        yperr_string(yperr));
 
        return FALSE;
@@ -1168,7 +1178,7 @@ nisplus_map_open(map, mode)
                  default:              /* all other nisplus errors */
 #if 0
                        if (!bitset(MF_OPTIONAL, map->map_mflags))
                  default:              /* all other nisplus errors */
 #if 0
                        if (!bitset(MF_OPTIONAL, map->map_mflags))
-                               syserr("Cannot find table %s.%s: %s",
+                               syserr("421 Cannot find table %s.%s: %s",
                                        map->map_file, map->map_domain,
                                        nis_sperrno(res->status));
 #endif
                                        map->map_file, map->map_domain,
                                        nis_sperrno(res->status));
 #endif
@@ -1190,7 +1200,7 @@ nisplus_map_open(map, mode)
                        printf("nisplus_map_open: %s is not a table\n", qbuf);
 #if 0
                if (!bitset(MF_OPTIONAL, map->map_mflags))
                        printf("nisplus_map_open: %s is not a table\n", qbuf);
 #if 0
                if (!bitset(MF_OPTIONAL, map->map_mflags))
-                       syserr("%s.%s: %s is not a table",
+                       syserr("421 %s.%s: %s is not a table",
                                map->map_file, map->map_domain,
                                nis_sperrno(res->status));
 #endif
                                map->map_file, map->map_domain,
                                nis_sperrno(res->status));
 #endif
@@ -2304,3 +2314,26 @@ null_map_store(map, key, val)
 {
        return;
 }
 {
        return;
 }
+
+
+/*
+**  BOGUS stubs
+*/
+
+char *
+bogus_map_lookup(map, key, args, pstat)
+       MAP *map;
+       char *key;
+       char **args;
+       int *pstat;
+{
+       *pstat = EX_TEMPFAIL;
+       return NULL;
+}
+
+MAPCLASS       BogusMapClass =
+{
+       "bogus-map",            NULL,           0,
+       NULL,           bogus_map_lookup,       null_map_store,
+       null_map_open,  null_map_close,
+};