1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

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".
This commit is contained in:
Werner Koch 2023-04-04 16:39:59 +02:00
parent db6ae6f6f8
commit d9e7488b17
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
8 changed files with 110 additions and 18 deletions

View file

@ -35,7 +35,6 @@
/* Common options for all GnuPG components. */
EXTERN_UNLESS_MAIN_MODULE
struct
{
char *logfile; /* Socket used by daemons for logging. */

View file

@ -789,8 +789,42 @@ gnupg_maybe_make_homedir (const char *fname, int quiet)
if (gnupg_mkdir (fname, "-rwx"))
log_fatal ( _("can't create directory '%s': %s\n"),
fname, strerror(errno) );
else if (!quiet )
log_info ( _("directory '%s' created\n"), fname );
else
{
estream_t fp;
char *fcommon;
if (!quiet )
log_info ( _("directory '%s' created\n"), fname );
#ifdef BUILD_WITH_KEYBOXD
/* A new default homedir has been created. Now create a
* common.conf. */
fcommon = make_filename (fname, "common.conf", NULL);
fp = es_fopen (fcommon, "wx,mode=-rw-r");
if (!fp)
{
log_info (_("error creating '%s': %s\n"), fcommon,
gpg_strerror (gpg_error_from_syserror ()));
}
else
{
if (es_fputs ("use-keyboxd\n", fp) == EOF)
{
log_info (_("error writing to '%s': %s\n"), fcommon,
gpg_strerror (es_ferror (fp)
? gpg_error_from_syserror ()
: gpg_error (GPG_ERR_EOF)));
es_fclose (fp);
}
else if (es_fclose (fp))
{
log_info (_("error closing '%s': %s\n"), fcommon,
gpg_strerror (gpg_error_from_syserror ()));
}
}
#endif /* BUILD_WITH_KEYBOXD */
}
}
}