Bug 2127 - incorrectness of do_print_resource_record()
Summary: incorrectness of do_print_resource_record()
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-keygen (show other bugs)
Version: 6.2p1
Hardware: All FreeBSD
: P5 minor
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_6_3
  Show dependency treegraph
 
Reported: 2013-07-10 08:40 AEST by Arthur Mesh
Modified: 2021-04-23 15:08 AEST (History)
2 users (show)

See Also:


Attachments
Skip asking for filename (552 bytes, patch)
2013-07-12 10:30 AEST, Damien Miller
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur Mesh 2013-07-10 08:40:00 AEST
Line 1304 seems incorrect. Call to ask_filename() doesn't modify fname, and
hence is of no use.

1293 /*
1294  * Print the SSHFP RR.
1295  */
1296 static int
1297 do_print_resource_record(struct passwd *pw, char *fname, char *hname)
1298 {
1299         Key *public;
1300         char *comment = NULL;
1301         struct stat st;
1302 
1303         if (fname == NULL)
1304                 ask_filename(pw, "Enter file in which the key is");
1305         if (stat(fname, &st) < 0) {
1306                 if (errno == ENOENT)
1307                         return 0;
1308                 perror(fname);
1309                 exit(1);
1310         }
1311         public = key_load_public(fname, &comment);
1312         if (public != NULL) {
1313                 export_dns_rr(hname, public, stdout, print_generic);
1314                 key_free(public);
1315                 xfree(comment);
1316                 return 1;
1317         }
1318         if (comment)
1319                 xfree(comment);
1320 
1321         printf("failed to read v2 public key from %s.\n", fname);
1322         exit(1);
1323 }
Comment 1 Damien Miller 2013-07-12 10:30:14 AEST
Created attachment 2310 [details]
Skip asking for filename

This code is unreachable: the function will never be called with a null filename anyway (see main), so we can just skip asking.
Comment 2 Damien Miller 2013-07-12 15:42:18 AEST
fix applied - this will be in openssh-6.3. Thanks!
Comment 3 Damien Miller 2021-04-23 15:08:40 AEST
closing resolved bugs as of 8.6p1 release