]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
quote addresses in YAML output
authorEvan Hunt <each@isc.org>
Sat, 27 Aug 2022 00:58:55 +0000 (17:58 -0700)
committerEvan Hunt <each@isc.org>
Wed, 31 Aug 2022 22:32:24 +0000 (15:32 -0700)
YAML strings should be quoted if they contain colon characters.
Since IPv6 addresses do, we now quote the query_address and
response_address strings in all YAML output.

bin/dig/dig.c
bin/tools/dnstap-read.c
bin/tools/mdig.c

index a416f3fd47613ec43677cecb4fadcfa9c8e942ee..49143e581b740e42b36f351ae5065c5c209b5465 100644 (file)
@@ -784,7 +784,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
                                strlcat(sockstr, "0", sizeof(sockstr));
                        }
 
-                       printf("    response_address: %s\n", sockstr);
+                       printf("    response_address: \"%s\"\n", sockstr);
                        printf("    response_port: %u\n", sport);
                }
 
@@ -801,7 +801,7 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
                                strlcat(sockstr, "0", sizeof(sockstr));
                        }
 
-                       printf("    query_address: %s\n", sockstr);
+                       printf("    query_address: \"%s\"\n", sockstr);
                        printf("    query_port: %u\n", sport);
                }
 
index 78b95a76fbbcc7753b7c45b1e2d151f80989e087..933e76ad04df97aa7aa5e34132e8c6ee9db26432 100644 (file)
@@ -266,7 +266,7 @@ print_yaml(dns_dtdata_t *dt) {
 
                (void)inet_ntop(ip->len == 4 ? AF_INET : AF_INET6, ip->data,
                                buf, sizeof(buf));
-               printf("  query_address: %s\n", buf);
+               printf("  query_address: \"%s\"\n", buf);
        }
 
        if (m->has_response_address) {
@@ -275,7 +275,7 @@ print_yaml(dns_dtdata_t *dt) {
 
                (void)inet_ntop(ip->len == 4 ? AF_INET : AF_INET6, ip->data,
                                buf, sizeof(buf));
-               printf("  response_address: %s\n", buf);
+               printf("  response_address: \"%s\"\n", buf);
        }
 
        if (m->has_query_port) {
index 9e814599194bd57ede7e8df51e05983bc49a383f..1d28ea979f40b986a9906292d81f97a267c9aa88 100644 (file)
@@ -331,7 +331,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
                        if (hash != NULL) {
                                *hash = '\0';
                        }
-                       printf("    response_address: %s\n", sockstr);
+                       printf("    response_address: \"%s\"\n", sockstr);
                        printf("    response_port: %u\n", sport);
                }
 
@@ -342,7 +342,7 @@ recvresponse(isc_task_t *task, isc_event_t *event) {
                        if (hash != NULL) {
                                *hash = '\0';
                        }
-                       printf("    query_address: %s\n", sockstr);
+                       printf("    query_address: \"%s\"\n", sockstr);
                        printf("    query_port: %u\n", sport);
                }