- OpenBSD CVS Sync

- jakob@cvs.openbsd.org 2006/03/15 08:46:44
     [ssh-keygen.c]
     if no key file are given when printing the DNS host record, use the
     host key file(s) as default. ok djm@
This commit is contained in:
Damien Miller 2006-03-26 13:48:01 +11:00
parent 2dbbf8e9fc
commit cb314828eb
2 changed files with 39 additions and 10 deletions

View File

@ -1,3 +1,10 @@
20060326
- OpenBSD CVS Sync
- jakob@cvs.openbsd.org 2006/03/15 08:46:44
[ssh-keygen.c]
if no key file are given when printing the DNS host record, use the
host key file(s) as default. ok djm@
20060325 20060325
- OpenBSD CVS Sync - OpenBSD CVS Sync
- djm@cvs.openbsd.org 2006/03/16 04:24:42 - djm@cvs.openbsd.org 2006/03/16 04:24:42
@ -4254,4 +4261,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4241 2006/03/25 13:11:46 djm Exp $ $Id: ChangeLog,v 1.4242 2006/03/26 02:48:01 djm Exp $

View File

@ -858,30 +858,32 @@ do_change_passphrase(struct passwd *pw)
/* /*
* Print the SSHFP RR. * Print the SSHFP RR.
*/ */
static void static int
do_print_resource_record(struct passwd *pw, char *hname) do_print_resource_record(struct passwd *pw, char *fname, char *hname)
{ {
Key *public; Key *public;
char *comment = NULL; char *comment = NULL;
struct stat st; struct stat st;
if (!have_identity) if (fname == NULL)
ask_filename(pw, "Enter file in which the key is"); ask_filename(pw, "Enter file in which the key is");
if (stat(identity_file, &st) < 0) { if (stat(fname, &st) < 0) {
perror(identity_file); if (errno == ENOENT)
return 0;
perror(fname);
exit(1); exit(1);
} }
public = key_load_public(identity_file, &comment); public = key_load_public(fname, &comment);
if (public != NULL) { if (public != NULL) {
export_dns_rr(hname, public, stdout, print_generic); export_dns_rr(hname, public, stdout, print_generic);
key_free(public); key_free(public);
xfree(comment); xfree(comment);
exit(0); return 1;
} }
if (comment) if (comment)
xfree(comment); xfree(comment);
printf("failed to read v2 public key from %s.\n", identity_file); printf("failed to read v2 public key from %s.\n", fname);
exit(1); exit(1);
} }
@ -1224,7 +1226,27 @@ main(int ac, char **av)
if (print_public) if (print_public)
do_print_public(pw); do_print_public(pw);
if (rr_hostname != NULL) { if (rr_hostname != NULL) {
do_print_resource_record(pw, rr_hostname); unsigned int n = 0;
if (have_identity) {
n = do_print_resource_record(pw,
identity_file, rr_hostname);
if (n == 0) {
perror(identity_file);
exit(1);
}
exit(0);
} else {
n += do_print_resource_record(pw,
_PATH_HOST_RSA_KEY_FILE, rr_hostname);
n += do_print_resource_record(pw,
_PATH_HOST_DSA_KEY_FILE, rr_hostname);
if (n == 0)
fatal("no keys found.");
exit(0);
}
} }
if (reader_id != NULL) { if (reader_id != NULL) {
#ifdef SMARTCARD #ifdef SMARTCARD