avoid loops on nameserver NO_DATA errors; getsockname can return
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 6 Mar 1993 07:09:46 +0000 (23:09 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 6 Mar 1993 07:09:46 +0000 (23:09 -0800)
zero length names on SunOS

SCCS-vsn: usr.sbin/sendmail/src/domain.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/version.c 6.35
SCCS-vsn: usr.sbin/sendmail/src/daemon.c 6.14

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

index 4baf030..26a9ab8 100644 (file)
@@ -13,9 +13,9 @@
 
 #ifndef lint
 #ifdef DAEMON
 
 #ifndef lint
 #ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c   6.13 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c   6.14 (Berkeley) %G% (with daemon mode)";
 #else
 #else
-static char sccsid[] = "@(#)daemon.c   6.13 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c   6.14 (Berkeley) %G% (without daemon mode)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -448,7 +448,8 @@ getrealhostname(fd)
        extern struct hostent *gethostbyaddr();
        extern char *inet_ntoa();
 
        extern struct hostent *gethostbyaddr();
        extern char *inet_ntoa();
 
-       if (getsockname(fd, (struct sockaddr *) &sin, &sinlen) < 0)
+       if (getsockname(fd, (struct sockaddr *) &sin, &sinlen) < 0 ||
+           sinlen <= 0)
                return NULL;
        hp = gethostbyaddr((char *) &sin.sin_addr, sizeof sin.sin_addr,
                           sin.sin_family);
                return NULL;
        hp = gethostbyaddr((char *) &sin.sin_addr, sizeof sin.sin_addr,
                           sin.sin_family);
index f9a07bc..7ca1b70 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef NAMED_BIND
 
 #ifndef lint
 #ifdef NAMED_BIND
-static char sccsid[] = "@(#)domain.c   6.9 (Berkeley) %G% (with name server)";
+static char sccsid[] = "@(#)domain.c   6.10 (Berkeley) %G% (with name server)";
 #else
 #else
-static char sccsid[] = "@(#)domain.c   6.9 (Berkeley) %G% (without name server)";
+static char sccsid[] = "@(#)domain.c   6.10 (Berkeley) %G% (without name server)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -370,12 +370,19 @@ getcanonname(host, hbsize)
                                return FALSE;
                        }
 
                                return FALSE;
                        }
 
-                       if (h_errno == HOST_NOT_FOUND)
+                       if (h_errno != HOST_NOT_FOUND)
                        {
                        {
-                               /* definitely no data for this address */
-                               dp++;
-                               qtype = T_ANY;          /* just in case */
-                               continue;
+                               /* might have another type of interest */
+                               if (qtype == T_ANY)
+                               {
+                                       qtype = T_A;
+                                       continue;
+                               }
+                               else if (qtype == T_A && !gotmx)
+                               {
+                                       qtype = T_MX;
+                                       continue;
+                               }
                        }
 
                        if (mxmatch != NULL)
                        }
 
                        if (mxmatch != NULL)
@@ -383,6 +390,10 @@ getcanonname(host, hbsize)
                                /* we matched before -- use that one */
                                break;
                        }
                                /* we matched before -- use that one */
                                break;
                        }
+
+                       /* otherwise, try the next name */
+                       dp++;
+                       qtype = T_ANY;
                        continue;
                }
                else if (tTd(8, 8))
                        continue;
                }
                else if (tTd(8, 8))
index 7a01655..189a6b7 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)version.c  6.34 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c  6.35 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-char   Version[] = "ALPHA-6.34";
+char   Version[] = "ALPHA-6.35";