aboutsummaryrefslogtreecommitdiffstats
path: root/g10/gpg.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-04-04 14:39:59 +0000
committerWerner Koch <[email protected]>2023-04-04 14:39:59 +0000
commitd9e7488b17fdc617eec735e2c0485b69285ba511 (patch)
treecd1423ce0870d036b5e0b7dd0425eb7222d84d62 /g10/gpg.c
parentspeedo: Remove deleted prf files from the Windows installer (diff)
downloadgnupg-d9e7488b17fdc617eec735e2c0485b69285ba511.tar.gz
gnupg-d9e7488b17fdc617eec735e2c0485b69285ba511.zip
Use the keyboxd for a fresh install
* common/homedir.c (gnupg_maybe_make_homedir): Also create a common.conf. * g10/keydb.c: Include comopt.h. (maybe_create_keyring_or_box): Detect the creation of a common.conf. * g10/gpg.c (main): Avoid adding more resources in this case. * sm/keydb.c: Include comopt.h. (maybe_create_keybox): Detect the creation of a common.conf. * common/comopt.h (comopt): Remove the conditional "extern".
Diffstat (limited to 'g10/gpg.c')
-rw-r--r--g10/gpg.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index 84706ca6b..f52d13a76 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -4187,17 +4187,27 @@ main (int argc, char **argv)
* need to add the keyrings if we are running under SELinux, this
* is so that the rings are added to the list of secured files.
* We do not add any keyring if --no-keyring or --use-keyboxd has
- * been used. */
+ * been used. Note that keydb_add_resource may create a new
+ * homedir and also tries to write a common.conf to enable the use
+ * of the keyboxd - in this case a special error code is returned
+ * and use_keyboxd is then also set. */
if (!opt.use_keyboxd
&& default_keyring >= 0
&& (ALWAYS_ADD_KEYRINGS
|| (cmd != aDeArmor && cmd != aEnArmor && cmd != aGPGConfTest)))
{
+ gpg_error_t tmperr = 0;
+
if (!nrings || default_keyring > 0) /* Add default ring. */
- keydb_add_resource ("pubring" EXTSEP_S GPGEXT_GPG,
- KEYDB_RESOURCE_FLAG_DEFAULT);
- for (sl = nrings; sl; sl = sl->next )
- keydb_add_resource (sl->d, sl->flags);
+ tmperr = keydb_add_resource ("pubring" EXTSEP_S GPGEXT_GPG,
+ KEYDB_RESOURCE_FLAG_DEFAULT);
+ if (gpg_err_code (tmperr) == GPG_ERR_TRUE && opt.use_keyboxd)
+ ; /* The keyboxd has been enabled. */
+ else
+ {
+ for (sl = nrings; sl; sl = sl->next )
+ keydb_add_resource (sl->d, sl->flags);
+ }
}
FREE_STRLIST(nrings);