]> www.infradead.org Git - users/dhowells/kafs-client.git/commitdiff
Fix a couple of bugs in kafs-dns
authorDavid Howells <dhowells@redhat.com>
Tue, 9 Jun 2020 13:24:55 +0000 (14:24 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 9 Jun 2020 13:27:25 +0000 (14:27 +0100)
Fix kafs-dns in the following ways:

 (1) The -V flag should not require an argument.

 (2) The srv=N callout info should check that N is supplied, else it will
     crash.

Signed-off-by: David Howells <dhowells@redhat.com>
src/dns_main.c

index 2c1e5a31e97e712b21c540267255b72c69d2b9a5..0e1e62b5f2c1fb826b2a2ac839d3c947301e01a1 100644 (file)
@@ -56,7 +56,6 @@ static const char key_type[] = "dns_resolver";
 static const char afsdb_query_type[] = "afsdb:";
 static key_serial_t key;
 static int debug_mode;
-static bool one_addr_only = true;
 static unsigned int output_version = 0;
 
 /*
@@ -197,9 +196,9 @@ static void parse_callout(char *options, struct kafs_lookup_context *ctx)
                } else if (strcmp(k, "ipv6") == 0) {
                        ctx->want_ipv4_addrs = false;
                        ctx->want_ipv6_addrs = true;
-               } else if (strcmp(k, "list") == 0) {
-                       one_addr_only = false;
                } else if (strcmp(k, "srv") == 0) {
+                       if (!val)
+                               error("Option srv missing version");
                        output_version = atoi(val);
                }
        } while (*options);
@@ -235,7 +234,7 @@ int main(int argc, char *argv[])
 
        openlog(prog, 0, LOG_DAEMON);
 
-       while ((ret = getopt_long(argc, argv, "Dvc:N:o:V:", long_options, NULL)) != -1) {
+       while ((ret = getopt_long(argc, argv, "Dvc:N:o:V", long_options, NULL)) != -1) {
                switch (ret) {
                case 'c':
                        if (filec >= 9) {