Avoid emitting RCS ID in object file.
authordrepper <drepper>
Wed, 19 Jul 2000 21:58:49 +0000 (21:58 +0000)
committerdrepper <drepper>
Wed, 19 Jul 2000 21:58:49 +0000 (21:58 +0000)
resolv/ns_name.c
resolv/ns_netint.c
resolv/ns_parse.c
resolv/ns_print.c
resolv/ns_samedomain.c
resolv/ns_ttl.c

index b75f731..cb63935 100644 (file)
@@ -15,8 +15,8 @@
  * SOFTWARE.
  */
 
-#ifndef lint
-static const char rcsid[] = "$Id$";
+#if !defined(_LIBC) && !defined(lint)
+static const char rcsid[] = "$BINDId: ns_name.c,v 8.15 2000/03/30 22:53:46 vixie Exp $";
 #endif
 
 #include <sys/types.h>
@@ -375,7 +375,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
        u_char *dstp;
        const u_char **cpp, **lpp, *eob, *msg;
        const u_char *srcp;
-       int n, l;
+       int n, l, first = 1;
 
        srcp = src;
        dstp = dst;
@@ -424,9 +424,10 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
                        }
                        /* Not found, save it. */
                        if (lastdnptr != NULL && cpp < lastdnptr - 1 &&
-                           (dstp - msg) < 0x4000) {
+                           (dstp - msg) < 0x4000 && first) {
                                *cpp++ = dstp;
                                *cpp = NULL;
+                               first = 0;
                        }
                }
                /* copy label to buffer */
@@ -499,6 +500,23 @@ ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
 }
 
 /*
+ * Reset dnptrs so that there are no active references to pointers at or
+ * after src.
+ */
+void
+ns_name_rollback(const u_char *src, const u_char **dnptrs,
+                const u_char **lastdnptr)
+{
+       while (dnptrs < lastdnptr && *dnptrs != NULL) {
+               if (*dnptrs >= src) {
+                       *dnptrs = NULL;
+                       break;
+               }
+               dnptrs++;
+       }
+}
+
+/*
  * ns_name_skip(ptrptr, eom)
  *     Advance *ptrptr to skip over the compressed name it points at.
  * return:
@@ -600,36 +618,48 @@ dn_find(const u_char *domain, const u_char *msg,
        u_int n;
 
        for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
-               dn = domain;
-               sp = cp = *cpp;
-               while ((n = *cp++) != 0) {
-                       /*
-                        * check for indirection
-                        */
-                       switch (n & NS_CMPRSFLGS) {
-                       case 0:                 /* normal case, n == len */
-                               if (n != *dn++)
-                                       goto next;
-                               for ((void)NULL; n > 0; n--)
-                                       if (mklower(*dn++) != mklower(*cp++))
+               sp = *cpp;
+               /*
+                * terminate search on:
+                * root label
+                * compression pointer
+                * unusable offset
+                */
+               while (*sp != 0 && (*sp & NS_CMPRSFLGS) == 0 &&
+                      (sp - msg) < 0x4000) {
+                       dn = domain;
+                       cp = sp;
+                       while ((n = *cp++) != 0) {
+                               /*
+                                * check for indirection
+                                */
+                               switch (n & NS_CMPRSFLGS) {
+                               case 0:         /* normal case, n == len */
+                                       if (n != *dn++)
                                                goto next;
-                               /* Is next root for both ? */
-                               if (*dn == '\0' && *cp == '\0')
-                                       return (sp - msg);
-                               if (*dn)
-                                       continue;
-                               goto next;
-
-                       case NS_CMPRSFLGS:      /* indirection */
-                               cp = msg + (((n & 0x3f) << 8) | *cp);
-                               break;
-
-                       default:        /* illegal type */
-                               __set_errno (EMSGSIZE);
-                               return (-1);
+                                       for ((void)NULL; n > 0; n--)
+                                               if (mklower(*dn++) !=
+                                                   mklower(*cp++))
+                                                       goto next;
+                                       /* Is next root for both ? */
+                                       if (*dn == '\0' && *cp == '\0')
+                                               return (sp - msg);
+                                       if (*dn)
+                                               continue;
+                                       goto next;
+
+                               case NS_CMPRSFLGS:      /* indirection */
+                                       cp = msg + (((n & 0x3f) << 8) | *cp);
+                                       break;
+
+                               default:        /* illegal type */
+                                       __set_errno (EMSGSIZE);
+                                       return (-1);
+                               }
                        }
+ next:
+                       sp += *sp + 1;
                }
- next: ;
        }
        __set_errno (ENOENT);
        return (-1);
index 9dcf91c..ff24128 100644 (file)
@@ -15,8 +15,8 @@
  * SOFTWARE.
  */
 
-#ifndef lint
-static const char rcsid[] = "$Id$";
+#if !defined(_LIBC) && !defined(lint)
+static const char rcsid[] = "$BINDId: ns_netint.c,v 8.4 1999/10/13 16:39:35 vixie Exp $";
 #endif
 
 /* Import. */
index 7bbdc41..d305eae 100644 (file)
@@ -15,8 +15,8 @@
  * SOFTWARE.
  */
 
-#ifndef lint
-static const char rcsid[] = "$Id$";
+#if !defined(_LIBC) && !defined(lint)
+static const char rcsid[] = "$BINDId: ns_parse.c,v 8.13 1999/10/13 16:39:35 vixie Exp $";
 #endif
 
 /* Import. */
index cce3fb6..7a2ef70 100644 (file)
  * SOFTWARE.
  */
 
-#ifndef lint
-static const char rcsid[] = "$Id$";
+#if !defined(_LIBC) && !defined(lint)
+static const char rcsid[] = "$BINDId: ns_print.c,v 8.18 2000/02/29 05:48:12 vixie Exp $";
 #endif
 
 /* Import. */
+
 #include <sys/types.h>
 #include <sys/socket.h>
 
@@ -27,6 +28,7 @@ static const char rcsid[] = "$Id$";
 #include <arpa/nameser.h>
 #include <arpa/inet.h>
 
+#include <assert.h>
 #include <errno.h>
 #include <resolv.h>
 #include <string.h>
@@ -53,6 +55,7 @@ static int    addtab(size_t len, size_t target, int spaced,
                       char **buf, size_t *buflen);
 
 /* Proto. */
+
 #ifndef _LIBC
 u_int16_t       dst_s_dns_key_id(const u_char *, const int);
 #endif
@@ -122,9 +125,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
                        T(addstr("@\t\t\t", 4, &buf, &buflen));
                } else {
                        T(addstr(name, len, &buf, &buflen));
-                       /* Origin not used and no trailing dot? */
-                       if ((!origin || !origin[0] || name[len] == '\0') &&
-                           name[len - 1] != '.') {
+                       /* Origin not used or not root, and no trailing dot? */
+                       if (((origin == NULL || origin[0] == '\0') ||
+                           (origin[0] != '.' && origin[1] != '\0' &&
+                           name[len] == '\0')) && name[len - 1] != '.') {
                                T(addstr(".", 1, &buf, &buflen));
                                len++;
                        }
@@ -480,6 +484,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
                n = SPRINTF((tmp, " ; key_tag= %u", key_id));
                T(addstr(tmp, n, &buf, &buflen));
 #endif /* !_LIBC */
+
                break;
            }
 
@@ -749,20 +754,22 @@ addname(const u_char *msg, size_t msglen,
        if (n < 0)
                goto enospc;    /* Guess. */
        newlen = prune_origin(*buf, origin);
-       if ((origin == NULL || origin[0] == '\0' || (*buf)[newlen] == '\0') &&
-           (newlen == 0 || (*buf)[newlen - 1] != '.')) {
-               /* No trailing dot. */
-               if (newlen + 2 > *buflen)
-                       goto enospc;    /* No room for ".\0". */
-               (*buf)[newlen++] = '.';
-               (*buf)[newlen] = '\0';
-       }
        if (newlen == 0) {
                /* Use "@" instead of name. */
                if (newlen + 2 > *buflen)
                        goto enospc;        /* No room for "@\0". */
                (*buf)[newlen++] = '@';
                (*buf)[newlen] = '\0';
+       } else {
+               if (((origin == NULL || origin[0] == '\0') ||
+                   (origin[0] != '.' && origin[1] != '\0' &&
+                   (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') {
+                       /* No trailing dot. */
+                       if (newlen + 2 > *buflen)
+                               goto enospc;    /* No room for ".\0". */
+                       (*buf)[newlen++] = '.';
+                       (*buf)[newlen] = '\0';
+               }
        }
        *pp += n;
        addlen(newlen, buf, buflen);
@@ -777,9 +784,7 @@ addname(const u_char *msg, size_t msglen,
 
 static void
 addlen(size_t len, char **buf, size_t *buflen) {
-#if 0
-       INSIST(len <= *buflen);
-#endif
+       assert(len <= *buflen);
        *buf += len;
        *buflen -= len;
 }
index bac5a63..1fb1c55 100644 (file)
@@ -15,8 +15,8 @@
  * SOFTWARE.
  */
 
-#ifndef lint
-static const char rcsid[] = "$Id$";
+#if !defined(_LIBC) && !defined(lint)
+static const char rcsid[] = "$BINDId: ns_samedomain.c,v 8.9 1999/10/15 21:06:51 vixie Exp $";
 #endif
 
 #include <sys/types.h>
index 6be2b0d..c5d5af2 100644 (file)
  * SOFTWARE.
  */
 
-#ifndef lint
-static const char rcsid[] = "$Id$";
+#if !defined(_LIBC) && !defined(lint)
+static const char rcsid[] = "$BINDId: ns_ttl.c,v 8.8 1999/10/13 16:39:36 vixie Exp $";
 #endif
 
 /* Import. */
+
 #include <arpa/nameser.h>
 
 #include <ctype.h>