diff options
author | Werner Koch <wk@gnupg.org> | 2023-03-16 09:46:05 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2023-03-16 09:46:05 +0100 |
commit | e4ac3e7dec92acce32398f571959c7a33534f0c4 (patch) | |
tree | efe905888d31623d76bae0e90da79978794cf94e | |
parent | gpgtar: Do not allow the use of stdout for --status-fd (diff) | |
download | gnupg2-e4ac3e7dec92acce32398f571959c7a33534f0c4.tar.xz gnupg2-e4ac3e7dec92acce32398f571959c7a33534f0c4.zip |
gpgsm: New option --no-pretty-dn
* sm/gpgsm.c (oNoPrettyDN): New.
(opts): Add --no-pretty-dn.
(main): Implement.
* sm/gpgsm.h (opt): Add no_pretty_dn.
* sm/certdump.c (gpgsm_es_print_name): Act upon.
-rw-r--r-- | doc/gpgsm.texi | 9 | ||||
-rw-r--r-- | sm/certdump.c | 9 | ||||
-rw-r--r-- | sm/gpgsm.c | 7 | ||||
-rw-r--r-- | sm/gpgsm.h | 2 |
4 files changed, 25 insertions, 2 deletions
diff --git a/doc/gpgsm.texi b/doc/gpgsm.texi index a117009bd..364345741 100644 --- a/doc/gpgsm.texi +++ b/doc/gpgsm.texi @@ -629,6 +629,15 @@ always listed in @option{--with-colons} mode. Include info about the presence of a secret key in public key listings done with @code{--with-colons}. +@item --no-pretty-dn +@opindex no-pretty-dn +By default gpgsm prints distinguished names (DNs) like the Issuer or +Subject in a more readable format (e.g. using a well defined order of +the parts). However, this format can't be used as input strings. +This option reverts printing to standard RFC-2253 format and thus +avoids the need to use --dump-cert or --with-colons to get the +``real'' name. + @end table @c ******************************************* diff --git a/sm/certdump.c b/sm/certdump.c index 3ad0edbe3..03bfd4106 100644 --- a/sm/certdump.c +++ b/sm/certdump.c @@ -728,7 +728,14 @@ gpgsm_es_print_name2 (estream_t fp, const char *name, int translate) void gpgsm_es_print_name (estream_t fp, const char *name) { - gpgsm_es_print_name2 (fp, name, 1); + if (opt.no_pretty_dn) + { + if (!name) + name = "[error]"; + es_write_sanitized (fp, name, strlen (name), NULL, NULL); + } + else + gpgsm_es_print_name2 (fp, name, 1); } diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 8ca398360..aeb6ad7a9 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -170,6 +170,7 @@ enum cmd_and_opt_values { oWithKeyScreening, oAnswerYes, oAnswerNo, + oNoPrettyDN, oKeyring, oDefaultKey, oDefRecipient, @@ -385,7 +386,7 @@ static gpgrt_opt_t opts[] = { ARGPARSE_s_n (oWithKeygrip, "with-keygrip", "@"), ARGPARSE_s_n (oWithSecret, "with-secret", "@"), ARGPARSE_s_n (oWithKeyScreening,"with-key-screening", "@"), - + ARGPARSE_s_n (oNoPrettyDN, "no-pretty-dn", "@"), ARGPARSE_header ("Security", N_("Options controlling the security")), @@ -1318,6 +1319,10 @@ main ( int argc, char **argv) opt.with_key_screening = 1; break; + case oNoPrettyDN: + opt.no_pretty_dn = 1; + break; + case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break; case oChUid: break; /* Command line only (see above). */ case oAgentProgram: opt.agent_program = pargs.r.ret_str; break; diff --git a/sm/gpgsm.h b/sm/gpgsm.h index e09dd75e9..6149b8491 100644 --- a/sm/gpgsm.h +++ b/sm/gpgsm.h @@ -85,6 +85,8 @@ struct int with_key_screening; /* Option --with-key-screening active. */ + int no_pretty_dn; /* Option --no-pretty-dn */ + int pinentry_mode; int request_origin; |