diff options
author | Werner Koch <[email protected]> | 2016-03-17 14:15:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-03-17 14:15:48 +0000 |
commit | 1aad5c6277ea3852ff57bbf680f61c9136ce4d5c (patch) | |
tree | cc287b2686140cb7fb8ef59cc4390069fd06c05d | |
parent | doc: Improve documentation of --enable-large-rsa. (diff) | |
download | gnupg-1aad5c6277ea3852ff57bbf680f61c9136ce4d5c.tar.gz gnupg-1aad5c6277ea3852ff57bbf680f61c9136ce4d5c.zip |
sm: Always create a keybox header when creating a new keybox.
* sm/keydb.c (maybe_create_keybox): Create the header blob.
--
This is required so that g10/keydb.c can properly detect that a keybox
file is actually there. Just writing a 0 zero length keybox file is
not sufficient because a file with that name may also be an old-style
OpenPGP keyring.
GnuPG-bug-id: 2275
Signed-off-by: Werner Koch <[email protected]>
-rw-r--r-- | sm/keydb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sm/keydb.c b/sm/keydb.c index f5705cb45..495eb497f 100644 --- a/sm/keydb.c +++ b/sm/keydb.c @@ -213,6 +213,18 @@ maybe_create_keybox (char *filename, int force, int *r_created) } umask (oldmask); + /* Make sure that at least one record is in a new keybox file, so + that the detection magic for OpenPGP keyboxes works the next time + it is used. */ + rc = _keybox_write_header_blob (fp, 0); + if (rc) + { + fclose (fp); + log_error (_("error creating keybox '%s': %s\n"), + filename, gpg_strerror (rc)); + goto leave; + } + if (!opt.quiet) log_info (_("keybox '%s' created\n"), filename); if (r_created) |