]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] don't use keyname from command line if using -S
authorEvan Hunt <each@isc.org>
Tue, 4 Mar 2014 17:07:26 +0000 (09:07 -0800)
committerEvan Hunt <each@isc.org>
Tue, 4 Mar 2014 17:07:26 +0000 (09:07 -0800)
bin/dnssec/dnssec-keyfromlabel.c

index b861c6ef823e3cc4cf641ab55ab71d50c637fd34..cdd441daf8a884977f76e4850fa0e5ff07631acd 100644 (file)
@@ -330,6 +330,17 @@ main(int argc, char **argv) {
                if (argc > isc_commandline_index + 1)
                        fatal("extraneous arguments");
 
+               dns_fixedname_init(&fname);
+               name = dns_fixedname_name(&fname);
+               isc_buffer_init(&buf, argv[isc_commandline_index],
+                               strlen(argv[isc_commandline_index]));
+               isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
+               ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
+               if (ret != ISC_R_SUCCESS)
+                       fatal("invalid key name %s: %s",
+                             argv[isc_commandline_index],
+                             isc_result_totext(ret));
+
                if (strchr(label, ':') == NULL) {
                        char *l;
                        int len;
@@ -542,16 +553,6 @@ main(int argc, char **argv) {
                fatal("a key with algorithm '%s' cannot be a zone key",
                      algname);
 
-       dns_fixedname_init(&fname);
-       name = dns_fixedname_name(&fname);
-       isc_buffer_init(&buf, argv[isc_commandline_index],
-                       strlen(argv[isc_commandline_index]));
-       isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
-       ret = dns_name_fromtext(name, &buf, dns_rootname, 0, NULL);
-       if (ret != ISC_R_SUCCESS)
-               fatal("invalid key name %s: %s", argv[isc_commandline_index],
-                     isc_result_totext(ret));
-
        isc_buffer_init(&buf, filename, sizeof(filename) - 1);
 
        /* associate the key */