1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-05 12:31:50 +01:00

gpg: Change --print-pka-records into an option.

* g10/gpg.c (aPrintPKARecords): Rename to oPrintPKARecords and do not
use it as a command.
* g10/keylist.c (list_keyblock): List PKA rceords also for secret
keys.
--

An option allows to use it more flexible.  For example to select only
secret keys.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-03-10 13:44:40 +01:00
parent 14af2be022
commit 7b5b52f326
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 11 additions and 18 deletions

View File

@ -2114,6 +2114,13 @@ as it is easily machine parsed. The details of this format are
documented in the file @file{doc/DETAILS}, which is included in the GnuPG documented in the file @file{doc/DETAILS}, which is included in the GnuPG
source distribution. source distribution.
@item --print-pka-records
@opindex print-pka-records
Modify the output of the list commands to print PKA records suitable
to put into DNS zone files. An ORIGIN line is printed before each
record to allow diverting the records to the corresponding zone file.
@item --fixed-list-mode @item --fixed-list-mode
@opindex fixed-list-mode @opindex fixed-list-mode
Do not merge primary user ID and primary key in @option{--with-colon} Do not merge primary user ID and primary key in @option{--with-colon}

View File

@ -132,7 +132,6 @@ enum cmd_and_opt_values
aSendKeys, aSendKeys,
aRecvKeys, aRecvKeys,
aLocateKeys, aLocateKeys,
aPrintPKARecords,
aSearchKeys, aSearchKeys,
aRefreshKeys, aRefreshKeys,
aFetchKeys, aFetchKeys,
@ -383,6 +382,7 @@ enum cmd_and_opt_values
oAllowWeakDigestAlgos, oAllowWeakDigestAlgos,
oFakedSystemTime, oFakedSystemTime,
oNoAutostart, oNoAutostart,
oPrintPKARecords,
oNoop oNoop
}; };
@ -409,7 +409,6 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_c (aCheckKeys, "check-sigs",N_("list and check key signatures")), ARGPARSE_c (aCheckKeys, "check-sigs",N_("list and check key signatures")),
ARGPARSE_c (oFingerprint, "fingerprint", N_("list keys and fingerprints")), ARGPARSE_c (oFingerprint, "fingerprint", N_("list keys and fingerprints")),
ARGPARSE_c (aListSecretKeys, "list-secret-keys", N_("list secret keys")), ARGPARSE_c (aListSecretKeys, "list-secret-keys", N_("list secret keys")),
ARGPARSE_c (aPrintPKARecords, "print-pka-records", "@"),
ARGPARSE_c (aKeygen, "gen-key", ARGPARSE_c (aKeygen, "gen-key",
N_("generate a new key pair")), N_("generate a new key pair")),
ARGPARSE_c (aQuickKeygen, "quick-gen-key" , ARGPARSE_c (aQuickKeygen, "quick-gen-key" ,
@ -712,6 +711,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oFixedListMode, "fixed-list-mode", "@"), ARGPARSE_s_n (oFixedListMode, "fixed-list-mode", "@"),
ARGPARSE_s_n (oLegacyListMode, "legacy-list-mode", "@"), ARGPARSE_s_n (oLegacyListMode, "legacy-list-mode", "@"),
ARGPARSE_s_n (oListOnly, "list-only", "@"), ARGPARSE_s_n (oListOnly, "list-only", "@"),
ARGPARSE_s_n (oPrintPKARecords, "print-pka-records", "@"),
ARGPARSE_s_n (oIgnoreTimeConflict, "ignore-time-conflict", "@"), ARGPARSE_s_n (oIgnoreTimeConflict, "ignore-time-conflict", "@"),
ARGPARSE_s_n (oIgnoreValidFrom, "ignore-valid-from", "@"), ARGPARSE_s_n (oIgnoreValidFrom, "ignore-valid-from", "@"),
ARGPARSE_s_n (oIgnoreCrcError, "ignore-crc-error", "@"), ARGPARSE_s_n (oIgnoreCrcError, "ignore-crc-error", "@"),
@ -2329,11 +2329,6 @@ main (int argc, char **argv)
set_cmd (&cmd, pargs.r_opt); set_cmd (&cmd, pargs.r_opt);
break; break;
case aPrintPKARecords:
set_cmd (&cmd, pargs.r_opt);
opt.print_pka_records = 1;
break;
case aKeygen: case aKeygen:
case aFullKeygen: case aFullKeygen:
case aEditKey: case aEditKey:
@ -2974,6 +2969,7 @@ main (int argc, char **argv)
case oFastListMode: opt.fast_list_mode = 1; break; case oFastListMode: opt.fast_list_mode = 1; break;
case oFixedListMode: /* Dummy */ break; case oFixedListMode: /* Dummy */ break;
case oLegacyListMode: opt.legacy_list_mode = 1; break; case oLegacyListMode: opt.legacy_list_mode = 1; break;
case oPrintPKARecords: opt.print_pka_records = 1; break;
case oListOnly: opt.list_only=1; break; case oListOnly: opt.list_only=1; break;
case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break; case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break;
case oIgnoreValidFrom: opt.ignore_valid_from = 1; break; case oIgnoreValidFrom: opt.ignore_valid_from = 1; break;
@ -3879,13 +3875,6 @@ main (int argc, char **argv)
public_key_list (ctrl, sl, 1); public_key_list (ctrl, sl, 1);
free_strlist (sl); free_strlist (sl);
break; break;
case aPrintPKARecords:
sl = NULL;
for (; argc; argc--, argv++)
add_to_strlist2( &sl, *argv, utf8_strings );
public_key_list (ctrl, sl, 0);
free_strlist (sl);
break;
case aQuickKeygen: case aQuickKeygen:
if (argc != 1 ) if (argc != 1 )

View File

@ -1647,10 +1647,7 @@ list_keyblock (KBNODE keyblock, int secret, int has_secret, int fpr,
{ {
reorder_keyblock (keyblock); reorder_keyblock (keyblock);
if (opt.print_pka_records) if (opt.print_pka_records)
{ list_keyblock_pka (keyblock);
if (!secret)
list_keyblock_pka (keyblock);
}
else if (opt.with_colons) else if (opt.with_colons)
list_keyblock_colon (keyblock, secret, has_secret, fpr); list_keyblock_colon (keyblock, secret, has_secret, fpr);
else else