aboutsummaryrefslogtreecommitdiffstats
path: root/tools/gpgconf.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-12-16 15:00:15 +0000
committerWerner Koch <[email protected]>2016-12-16 15:05:02 +0000
commit76cd64a5baf6057b199c01f7999b327f1f4a87bc (patch)
tree9975cc64b46a26afe4a69ed9c9dcc5a3ded771d9 /tools/gpgconf.c
parentgpgconf: Fix --apply-defaults. (diff)
downloadgnupg-76cd64a5baf6057b199c01f7999b327f1f4a87bc.tar.gz
gnupg-76cd64a5baf6057b199c01f7999b327f1f4a87bc.zip
gpgconf: New command --apply-profile.
* tools/gpgconf.c (aApplyProfile): New. (opts): New command --apply-profile. (main): Implement that command. * tools/gpgconf-comp.c (option_check_validity): Add arg VERBATIM. (change_options_program): Ditto. (change_one_value): Ditto. (gc_component_change_options): Ditto. (gc_apply_profile): New. -- Here is an example for a profile --8<---------------cut here---------------start------------->8--- # foo.prf - Sample profile [gpg] compliance de-vs default-new-key-algo brainpoolP256r1+brainpoolP256r1 [gpgsm] enable-crl-checks [gpg-agent] default-cache-ttl 900 max-cache-ttl [] 3600 no-allow-mark-trusted no-allow-external-cache enforce-passphrase-constraints min-passphrase-len 9 min-passphrase-nonalpha 0 [dirmngr] keyserver hkp://keys.gnupg.net allow-ocsp --8<---------------cut here---------------end--------------->8--- Note that flags inside of brackets are allowed after the option name. The only defined flag for now is "[default]". In case the value starts with a bracket, it is possible to insert "[]" as a nop-flag. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/gpgconf.c')
-rw-r--r--tools/gpgconf.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index d056f4f57..af65424e0 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -60,6 +60,7 @@ enum cmd_and_opt_values
aKill,
aCreateSocketDir,
aRemoveSocketDir,
+ aApplyProfile,
aReload
};
@@ -76,6 +77,8 @@ static ARGPARSE_OPTS opts[] =
{ aCheckOptions, "check-options", 256, N_("|COMPONENT|check options") },
{ aApplyDefaults, "apply-defaults", 256,
N_("apply global default values") },
+ { aApplyProfile, "apply-profile", 256,
+ N_("|FILE|update configuration files using FILE") },
{ aListDirs, "list-dirs", 256,
N_("get the configuration directories for @GPGCONF@") },
{ aListConfig, "list-config", 256,
@@ -495,6 +498,7 @@ main (int argc, char **argv)
case aChangeOptions:
case aCheckOptions:
case aApplyDefaults:
+ case aApplyProfile:
case aListConfig:
case aCheckConfig:
case aQuerySWDB:
@@ -568,7 +572,8 @@ main (int argc, char **argv)
if (cmd == aListOptions)
gc_component_list_options (idx, get_outfp (&outfp));
else if (cmd == aChangeOptions)
- gc_component_change_options (idx, es_stdin, get_outfp (&outfp));
+ gc_component_change_options (idx, es_stdin,
+ get_outfp (&outfp), 0);
}
}
break;
@@ -659,6 +664,12 @@ main (int argc, char **argv)
exit (1);
break;
+ case aApplyProfile:
+ gc_component_retrieve_options (-1);
+ if (gc_apply_profile (fname))
+ exit (1);
+ break;
+
case aListDirs:
/* Show the system configuration directories for gpgconf. */
get_outfp (&outfp);