change bestmx map to not do resolver domain searching (RES_DNSRCH)
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 16 Jun 1995 10:24:14 +0000 (02:24 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 16 Jun 1995 10:24:14 +0000 (02:24 -0800)
SCCS-vsn: usr.sbin/sendmail/src/domain.c 8.45
SCCS-vsn: usr.sbin/sendmail/src/map.c 8.78

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

index 85ea835..b19841d 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #if NAMED_BIND
 
 #ifndef lint
 #if NAMED_BIND
-static char sccsid[] = "@(#)domain.c   8.44 (Berkeley) %G% (with name server)";
+static char sccsid[] = "@(#)domain.c   8.45 (Berkeley) %G% (with name server)";
 #else
 #else
-static char sccsid[] = "@(#)domain.c   8.44 (Berkeley) %G% (without name server)";
+static char sccsid[] = "@(#)domain.c   8.45 (Berkeley) %G% (without name server)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -388,6 +388,35 @@ mxrand(host)
        return hfunc;
 }
 \f/*
        return hfunc;
 }
 \f/*
+**  BESTMX -- find the best MX for a name
+**
+**     This is really a hack, but I don't see any obvious way
+**     to generalize it at the moment.
+*/
+
+char *
+bestmx_map_lookup(map, name, av, statp)
+       MAP *map;
+       char *name;
+       char **av;
+       int *statp;
+{
+       int nmx;
+       auto int rcode;
+       int saveopts = _res.options;
+       char *mxhosts[MAXMXHOSTS + 1];
+
+       _res.options &= ~(RES_DNSRCH|RES_DEFNAMES);
+       nmx = getmxrr(name, mxhosts, FALSE, &rcode);
+       _res.options = saveopts;
+       if (nmx <= 0)
+               return NULL;
+       if (bitset(MF_MATCHONLY, map->map_mflags))
+               return map_rewrite(map, name, strlen(name), NULL);
+       else
+               return map_rewrite(map, mxhosts[0], strlen(mxhosts[0]), av);
+}
+\f/*
 **  DNS_GETCANONNAME -- get the canonical name for named host using DNS
 **
 **     This algorithm tries to be smart about wildcard MX records.
 **  DNS_GETCANONNAME -- get the canonical name for named host using DNS
 **
 **     This algorithm tries to be smart about wildcard MX records.
index 3157675..9ea2099 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)map.c      8.77 (Berkeley) %G%";
+static char sccsid[] = "@(#)map.c      8.78 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -2582,36 +2582,6 @@ user_map_lookup(map, key, av, statp)
        }
 }
 \f/*
        }
 }
 \f/*
-**  BESTMX -- find the best MX for a name
-**
-**     This is really a hack, but I don't see any obvious way
-**     to generalize it at the moment.
-*/
-
-#if NAMED_BIND
-
-char *
-bestmx_map_lookup(map, name, av, statp)
-       MAP *map;
-       char *name;
-       char **av;
-       int *statp;
-{
-        int nmx;
-        auto int rcode;
-        char *mxhosts[MAXMXHOSTS + 1];
-
-       nmx = getmxrr(name, mxhosts, FALSE, &rcode);
-       if (nmx <= 0)
-               return NULL;
-       if (bitset(MF_MATCHONLY, map->map_mflags))
-               return map_rewrite(map, name, strlen(name), NULL);
-       else
-               return map_rewrite(map, mxhosts[0], strlen(mxhosts[0]), av);
-}
-
-#endif
-\f/*
 **  Program map type.
 **
 **     This provides access to arbitrary programs.  It should be used
 **  Program map type.
 **
 **     This provides access to arbitrary programs.  It should be used