fix problem that can cause CNAMEs to be misinterpreted
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 27 Apr 1993 03:44:09 +0000 (19:44 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 27 Apr 1993 03:44:09 +0000 (19:44 -0800)
SCCS-vsn: usr.sbin/sendmail/src/domain.c 6.20

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

index 6831419..c0cc09f 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef NAMED_BIND
 
 #ifndef lint
 #ifdef NAMED_BIND
-static char sccsid[] = "@(#)domain.c   6.19.1.1 (Berkeley) %G% (with name server)";
+static char sccsid[] = "@(#)domain.c   6.20 (Berkeley) %G% (with name server)";
 #else
 #else
-static char sccsid[] = "@(#)domain.c   6.19.1.1 (Berkeley) %G% (without name server)";
+static char sccsid[] = "@(#)domain.c   6.20 (Berkeley) %G% (without name server)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -349,10 +349,6 @@ getcanonname(host, hbsize)
        if ((_res.options & RES_INIT) == 0 && res_init() == -1)
                return (FALSE);
 
        if ((_res.options & RES_INIT) == 0 && res_init() == -1)
                return (FALSE);
 
-       for (cp = host, n = 0; *cp; cp++)
-               if (*cp == '.')
-                       n++;
-
        /*
        **  Initialize domain search list.  If there is at least one
        **  dot in the name, search the unmodified name first so we
        /*
        **  Initialize domain search list.  If there is at least one
        **  dot in the name, search the unmodified name first so we
@@ -363,6 +359,11 @@ getcanonname(host, hbsize)
        **  list by tearing apart the host name.
        */
 
        **  list by tearing apart the host name.
        */
 
+cnameloop:
+       for (cp = host, n = 0; *cp; cp++)
+               if (*cp == '.')
+                       n++;
+
        dp = searchlist;
        if (n > 0)
                *dp++ = "";
        dp = searchlist;
        if (n > 0)
                *dp++ = "";
@@ -381,8 +382,6 @@ getcanonname(host, hbsize)
        **  Now run through the search list for the name in question.
        */
 
        **  Now run through the search list for the name in question.
        */
 
-cnameloop:
-       dp = searchlist;
        mxmatch = NULL;
        qtype = T_ANY;
 
        mxmatch = NULL;
        qtype = T_ANY;