Bugzilla – Attachment 3315 Details for
Bug 3052
Print key comment along with public key (-y flag)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
print key comment when printing pubkey from private
bz3052.diff (text/plain), 2.40 KB, created by
Damien Miller
on 2019-08-30 14:31:37 AEST
(
hide
)
Description:
print key comment when printing pubkey from private
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2019-08-30 14:31:37 AEST
Size:
2.40 KB
patch
obsolete
>commit 188b470b2cd2cf61b48478883f3c0c3661a0cbc9 >Author: Damien Miller <djm@mindrot.org> >Date: Fri Aug 30 14:30:41 2019 +1000 > > print key comment when printing pubkey from priv > >diff --git a/ssh-keygen.c b/ssh-keygen.c >index d7154880..d10b41e7 100644 >--- a/ssh-keygen.c >+++ b/ssh-keygen.c >@@ -271,13 +271,15 @@ ask_filename(struct passwd *pw, const char *prompt) > } > > static struct sshkey * >-load_identity(char *filename) >+load_identity(char *filename, char **commentp) > { > char *pass; > struct sshkey *prv; > int r; > >- if ((r = sshkey_load_private(filename, "", &prv, NULL)) == 0) >+ if (commentp != NULL) >+ *commentp = NULL; >+ if ((r = sshkey_load_private(filename, "", &prv, commentp)) == 0) > return prv; > if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) > fatal("Load key \"%s\": %s", filename, ssh_err(r)); >@@ -285,7 +287,7 @@ load_identity(char *filename) > pass = xstrdup(identity_passphrase); > else > pass = read_passphrase("Enter passphrase: ", RP_ALLOW_STDIN); >- r = sshkey_load_private(filename, pass, &prv, NULL); >+ r = sshkey_load_private(filename, pass, &prv, commentp); > explicit_bzero(pass, strlen(pass)); > free(pass); > if (r != 0) >@@ -379,7 +381,7 @@ do_convert_to(struct passwd *pw) > if (stat(identity_file, &st) == -1) > fatal("%s: %s: %s", __progname, identity_file, strerror(errno)); > if ((r = sshkey_load_public(identity_file, &k, NULL)) != 0) >- k = load_identity(identity_file); >+ k = load_identity(identity_file, NULL); > switch (convert_format) { > case FMT_RFC4716: > do_convert_to_ssh2(pw, k); >@@ -752,16 +754,20 @@ do_print_public(struct passwd *pw) > struct sshkey *prv; > struct stat st; > int r; >+ char *comment = NULL; > > if (!have_identity) > ask_filename(pw, "Enter file in which the key is"); > if (stat(identity_file, &st) == -1) > fatal("%s: %s", identity_file, strerror(errno)); >- prv = load_identity(identity_file); >+ prv = load_identity(identity_file, &comment); > if ((r = sshkey_write(prv, stdout)) != 0) > error("sshkey_write failed: %s", ssh_err(r)); > sshkey_free(prv); >+ if (comment != NULL && *comment != '\0') >+ fprintf(stdout, " %s", comment); > fprintf(stdout, "\n"); >+ free(comment); > exit(0); > } > >@@ -1721,7 +1727,7 @@ do_ca_sign(struct passwd *pw, const char *ca_key_path, int prefer_agent, > ca->flags |= SSHKEY_FLAG_EXT; > } else { > /* CA key is assumed to be a private key on the filesystem */ >- ca = load_identity(tmp); >+ ca = load_identity(tmp, NULL); > } > free(tmp); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dtucker
:
ok+
Actions:
View
|
Diff
Attachments on
bug 3052
: 3315