ndr_dns LIBNDR_FLAG_STR_NO_COMPRESSION
authorStefan Metzmacher <metze@samba.org>
Thu, 12 May 2016 15:19:04 +0000 (17:19 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 13 May 2016 10:09:15 +0000 (12:09 +0200)
librpc/ndr/libndr.h
librpc/ndr/ndr_dns.c

index 10054376eec892938327e98eecc7878a3c536cc2..a5532969639e2628ee15d85ab50c66dd3b74eae3 100644 (file)
@@ -125,6 +125,8 @@ struct ndr_print {
 #define LIBNDR_FLAG_STR_RAW8           (1<<13)
 #define LIBNDR_STRING_FLAGS            (0x7FFC)
 
+#define LIBNDR_FLAG_STR_NO_COMPRESSION         (1<<14)
+
 /*
  * don't debug NDR_ERR_BUFSIZE failures,
  * as the available buffer might be incomplete.
index ab0c83a7e84391154e31cc9c9609d85c81688d13..d3625be4001e9fbf81b315dd76401609e7bd0704 100644 (file)
@@ -164,33 +164,36 @@ _PUBLIC_ enum ndr_err_code ndr_push_dns_string(struct ndr_push *ndr,
        }
 
        while (s && *s) {
-               enum ndr_err_code ndr_err;
                char *compname;
                size_t complen;
-               uint32_t offset;
 
                /* see if we have pushed the remaining string already,
                 * if so we use a label pointer to this string
                 */
-               ndr_err = ndr_token_retrieve_cmp_fn(&ndr->dns_string_list, s,
-                                                   &offset,
-                                                   (comparison_fn_t)strcmp,
-                                                   false);
-               if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-                       uint8_t b[2];
-
-                       if (offset > 0x3FFF) {
-                               return ndr_push_error(ndr, NDR_ERR_STRING,
-                                                     "offset for dns string " \
-                                                     "label pointer " \
-                                                     "%u[%08X] > 0x00003FFF",
-                                                     offset, offset);
+               if (!(ndr->flags & LIBNDR_FLAG_STR_NO_COMPRESSION)) {
+                       enum ndr_err_code ndr_err;
+                       uint32_t offset;
+
+                       ndr_err = ndr_token_retrieve_cmp_fn(&ndr->dns_string_list, s,
+                                                           &offset,
+                                                           (comparison_fn_t)strcmp,
+                                                           false);
+                       if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                               uint8_t b[2];
+
+                               if (offset > 0x3FFF) {
+                                       return ndr_push_error(ndr, NDR_ERR_STRING,
+                                                             "offset for dns string " \
+                                                             "label pointer " \
+                                                             "%u[%08X] > 0x00003FFF",
+                                                             offset, offset);
+                               }
+
+                               b[0] = 0xC0 | (offset>>8);
+                               b[1] = (offset & 0xFF);
+
+                               return ndr_push_bytes(ndr, b, 2);
                        }
-
-                       b[0] = 0xC0 | (offset>>8);
-                       b[1] = (offset & 0xFF);
-
-                       return ndr_push_bytes(ndr, b, 2);
                }
 
                complen = strcspn(s, ".");