summaryrefslogtreecommitdiffstats
path: root/g10/tdbio.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-10-11 09:25:58 +0200
committerWerner Koch <wk@gnupg.org>2014-03-07 10:44:27 +0100
commitd8f0b83e4f04641e5e9adbdd8abada15380f981c (patch)
tree3f6cbf91c73ca9fec54874696675cd6fa55107cd /g10/tdbio.c
parentgpg: Print a "not found" message for an unknown key in --key-edit. (diff)
downloadgnupg2-d8f0b83e4f04641e5e9adbdd8abada15380f981c.tar.xz
gnupg2-d8f0b83e4f04641e5e9adbdd8abada15380f981c.zip
gpg: Do not require a trustdb with --always-trust.
* g10/tdbio.c (tdbio_set_dbname): Add arg R_NOFILE. * g10/trustdb.c (trustdb_args): Add field no_trustdb. (init_trustdb): Set that field. (revalidation_mark): Take care of a nonexistent trustdb file. (read_trust_options): Ditto. (tdb_get_ownertrust): Ditto. (tdb_get_min_ownertrust): Ditto. (tdb_update_ownertrust): Ditto. (update_min_ownertrust): Ditto. (tdb_clear_ownertrusts): Ditto. (tdb_cache_disabled_value): Ditto. (tdb_check_trustdb_stale): Ditto. (tdb_get_validity_core): Ditto. * g10/gpg.c (main): Do not create a trustdb with most commands for trust-model always. -- This slightly changes the semantics of most commands in that they won't create a trustdb if --trust-model=always is used. It just does not make sense to create a trustdb if there is no need for it. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 1a0eeaacd1bf09fe5125dbc3f56016bc20f3512e) Resolved conflicts: NEWS g10/trustdb.c: Manually apply changes due to changed function names. Note that this also includes the fix for clear_ownertrust, see GnuPG-bug-id: 1622.
Diffstat (limited to 'g10/tdbio.c')
-rw-r--r--g10/tdbio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/g10/tdbio.c b/g10/tdbio.c
index 0a659b141..db7a67c05 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -480,7 +480,7 @@ create_version_record (void)
int
-tdbio_set_dbname( const char *new_dbname, int create )
+tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
{
char *fname;
static int initialized = 0;
@@ -490,6 +490,8 @@ tdbio_set_dbname( const char *new_dbname, int create )
initialized = 1;
}
+ *r_nofile = 0;
+
if(new_dbname==NULL)
fname=make_filename(opt.homedir,"trustdb" EXTSEP_S GPGEXT_GPG, NULL);
else if (*new_dbname != DIRSEP_C )
@@ -515,7 +517,9 @@ tdbio_set_dbname( const char *new_dbname, int create )
xfree(fname);
return G10ERR_TRUSTDB;
}
- if( create ) {
+ if (!create)
+ *r_nofile = 1;
+ else {
FILE *fp;
TRUSTREC rec;
int rc;