]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
minor bugfix in mdig: when using +multi, +norrcomments was ignored
authorEvan Hunt <each@isc.org>
Tue, 30 Jul 2019 19:28:20 +0000 (12:28 -0700)
committerEvan Hunt <each@isc.org>
Thu, 8 Aug 2019 03:55:14 +0000 (20:55 -0700)
(cherry picked from commit edab51b4205a273b8b215b6bfd0563661a09a4d9)

bin/tools/mdig.c

index b27fc1df213869566a02e086ac85e57b582c5338..53579d468d0da56d0e6d0fe14aee975bb8466b77 100644 (file)
@@ -94,7 +94,7 @@ static bool besteffort = true;
 static bool display_short_form = false;
 static bool display_headers = true;
 static bool display_comments = true;
-static bool display_rrcomments = true;
+static int display_rrcomments = 0;
 static bool display_ttlunits = true;
 static bool display_ttl = true;
 static bool display_class = true;
@@ -248,7 +248,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
                styleflags |= DNS_STYLEFLAG_COMMENT;
        if (display_unknown_format)
                styleflags |= DNS_STYLEFLAG_UNKNOWNFORMAT;
-       if (display_rrcomments)
+       if (display_rrcomments > 0)
                styleflags |= DNS_STYLEFLAG_RRCOMMENT;
        if (display_ttlunits)
                styleflags |= DNS_STYLEFLAG_TTL_UNITS;
@@ -266,7 +266,10 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
                styleflags |= DNS_STYLEFLAG_TTL;
                styleflags |= DNS_STYLEFLAG_MULTILINE;
                styleflags |= DNS_STYLEFLAG_COMMENT;
-               styleflags |= DNS_STYLEFLAG_RRCOMMENT;
+               /* Turn on rrcomments unless explicitly disabled */
+               if (display_rrcomments >= 0) {
+                       styleflags |= DNS_STYLEFLAG_RRCOMMENT;
+               }
        }
        if (display_multiline || (!display_ttl && !display_class))
                result = dns_master_stylecreate2(&style, styleflags,
@@ -1125,7 +1128,7 @@ plus_option(char *option, struct query *query, bool global)
                        display_authority = state;
                        display_additional = state;
                        display_comments = state;
-                       display_rrcomments = state;
+                       display_rrcomments = state ? 1 : -1;
                        break;
                case 'n': /* answer */
                        FULLCHECK("answer");
@@ -1367,7 +1370,7 @@ plus_option(char *option, struct query *query, bool global)
                case 'r':
                        FULLCHECK("rrcomments");
                        GLOBAL();
-                       display_rrcomments = state;
+                       display_rrcomments = state ? 1 : -1;
                        break;
                default:
                        goto invalid_option;
@@ -1385,7 +1388,7 @@ plus_option(char *option, struct query *query, bool global)
                                display_authority = false;
                                display_additional = false;
                                display_comments = false;
-                               display_rrcomments = false;
+                               display_rrcomments = -1;
                        }
                        break;
                case 'p': /* split */