mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: New option --with-key-origin.
* g10/getkey.c (parse_key_origin): Factor list out as ... (key_origin_list): new struct. (key_origin_string): New. * g10/gpg.c (oWithKeyOrigin): New const. (opts): New option --with-key-origin. (main): Implement option. * g10/options.h (struct opt): New flag with_key_origin. * g10/keylist.c (list_keyblock_print): Print key origin info. (list_keyblock_colon): Ditto.
This commit is contained in:
parent
bddc2e04f1
commit
165cdd8121
7 changed files with 90 additions and 12 deletions
|
@ -922,6 +922,21 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
|
|||
if (opt.with_key_data)
|
||||
print_key_data (pk);
|
||||
|
||||
if (opt.with_key_origin
|
||||
&& (pk->keyorg || pk->keyupdate || pk->updateurl))
|
||||
{
|
||||
char updatestr[MK_DATESTR_SIZE];
|
||||
|
||||
es_fprintf (es_stdout, " origin=%s last=%s %s",
|
||||
key_origin_string (pk->keyorg),
|
||||
mk_datestr (updatestr, sizeof updatestr, pk->keyupdate),
|
||||
pk->updateurl? "url=":"");
|
||||
if (pk->updateurl)
|
||||
print_utf8_string (es_stdout, pk->updateurl);
|
||||
es_putc ('\n', es_stdout);
|
||||
}
|
||||
|
||||
|
||||
for (kbctx = NULL; (node = walk_kbnode (keyblock, &kbctx, 0));)
|
||||
{
|
||||
if (node->pkt->pkttype == PKT_USER_ID)
|
||||
|
@ -987,6 +1002,22 @@ list_keyblock_print (ctrl_t ctrl, kbnode_t keyblock, int secret, int fpr,
|
|||
xfree (mbox);
|
||||
}
|
||||
|
||||
if (opt.with_key_origin
|
||||
&& (uid->keyorg || uid->keyupdate || uid->updateurl))
|
||||
{
|
||||
char updatestr[MK_DATESTR_SIZE];
|
||||
|
||||
es_fprintf (es_stdout, " %*sorigin=%s last=%s %s",
|
||||
indent, "",
|
||||
key_origin_string (uid->keyorg),
|
||||
mk_datestr (updatestr, sizeof updatestr,
|
||||
uid->keyupdate),
|
||||
pk->updateurl? "url=":"");
|
||||
if (pk->updateurl)
|
||||
print_utf8_string (es_stdout, pk->updateurl);
|
||||
es_putc ('\n', es_stdout);
|
||||
}
|
||||
|
||||
if ((opt.list_options & LIST_SHOW_PHOTOS) && uid->attribs != NULL)
|
||||
show_photos (ctrl, uid->attribs, uid->numattribs, pk, uid);
|
||||
}
|
||||
|
@ -1315,7 +1346,13 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
|
|||
es_putc (':', es_stdout); /* End of field 17. */
|
||||
print_compliance_flags (pk, keylength, curvename);
|
||||
es_putc (':', es_stdout); /* End of field 18 (compliance). */
|
||||
if (pk->keyupdate)
|
||||
es_fputs (colon_strtime (pk->keyupdate), es_stdout);
|
||||
es_putc (':', es_stdout); /* End of field 19 (last_update). */
|
||||
es_fprintf (es_stdout, "%d%s", pk->keyorg, pk->updateurl? " ":"");
|
||||
if (pk->updateurl)
|
||||
es_write_sanitized (es_stdout, pk->updateurl, strlen (pk->updateurl),
|
||||
":", NULL);
|
||||
es_putc (':', es_stdout); /* End of field 20 (origin). */
|
||||
es_putc ('\n', es_stdout);
|
||||
|
||||
|
@ -1367,7 +1404,14 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock,
|
|||
else
|
||||
es_write_sanitized (es_stdout, uid->name, uid->len, ":", NULL);
|
||||
es_fputs (":::::::::", es_stdout);
|
||||
if (uid->keyupdate)
|
||||
es_fputs (colon_strtime (uid->keyupdate), es_stdout);
|
||||
es_putc (':', es_stdout); /* End of field 19 (last_update). */
|
||||
es_fprintf (es_stdout, "%d%s", uid->keyorg, uid->updateurl? " ":"");
|
||||
if (uid->updateurl)
|
||||
es_write_sanitized (es_stdout,
|
||||
uid->updateurl, strlen (uid->updateurl),
|
||||
":", NULL);
|
||||
es_putc (':', es_stdout); /* End of field 20 (origin). */
|
||||
es_putc ('\n', es_stdout);
|
||||
#ifdef USE_TOFU
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue