From: Eric Allman Date: Sun, 11 Dec 1994 01:30:18 +0000 (-0800) Subject: if a non-optional map cannot be opened, queue mail that needs it X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/22944c86ff4776c8d1632a1b6e7d82fcb2315c7b if a non-optional map cannot be opened, queue mail that needs it SCCS-vsn: usr.sbin/sendmail/src/map.c 8.38 --- diff --git a/usr/src/usr.sbin/sendmail/src/map.c b/usr/src/usr.sbin/sendmail/src/map.c index a1b69f2511..34ee107562 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.37 (Berkeley) %G%"; +static char sccsid[] = "@(#)map.c 8.38 (Berkeley) %G%"; #endif /* not lint */ #include "sendmail.h" @@ -419,15 +419,25 @@ map_init(s, rebuild) 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; + } + } } } /* @@ -1009,7 +1019,7 @@ nis_map_open(map, mode) 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; } @@ -1025,7 +1035,7 @@ nis_map_open(map, mode) 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; @@ -1168,7 +1178,7 @@ nisplus_map_open(map, mode) 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 @@ -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)) - 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 @@ -2304,3 +2314,26 @@ null_map_store(map, key, val) { 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, +};