diff options
author | Werner Koch <wk@gnupg.org> | 2017-03-31 20:03:52 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2017-03-31 20:07:20 +0200 |
commit | 8f2671d2cc022af2f564e296bdeb3bb2d2734ef4 (patch) | |
tree | 0a5dfac0bb36cf364e313b000967863e42783793 /g10/tdbdump.c | |
parent | gpg: Consistent use of preprocessor conditionals. (diff) | |
download | gnupg2-8f2671d2cc022af2f564e296bdeb3bb2d2734ef4.tar.xz gnupg2-8f2671d2cc022af2f564e296bdeb3bb2d2734ef4.zip |
gpg: Pass CTRL to many more functions.
--
For proper operations as a server we need to avoid global variables.
Thus we need to pass the session state CTRL to most functions. Quite
a lot of changes but fortunately straightforward to do.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/tdbdump.c')
-rw-r--r-- | g10/tdbdump.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/g10/tdbdump.c b/g10/tdbdump.c index a5ad32d6c..5ea903f45 100644 --- a/g10/tdbdump.c +++ b/g10/tdbdump.c @@ -49,9 +49,9 @@ * Write a record; die on error. */ static void -write_record( TRUSTREC *rec ) +write_record (ctrl_t ctrl, TRUSTREC *rec) { - int rc = tdbio_write_record( rec ); + int rc = tdbio_write_record (ctrl, rec); if( !rc ) return; log_error(_("trust record %lu, type %d: write failed: %s\n"), @@ -64,13 +64,13 @@ write_record( TRUSTREC *rec ) * Dump the entire trustdb to FP or only the entries of one key. */ void -list_trustdb (estream_t fp, const char *username) +list_trustdb (ctrl_t ctrl, estream_t fp, const char *username) { TRUSTREC rec; (void)username; - init_trustdb (0); + init_trustdb (ctrl, 0); /* For now we ignore the user ID. */ if (1) { @@ -94,14 +94,14 @@ list_trustdb (estream_t fp, const char *username) * Print a list of all defined owner trust value. */ void -export_ownertrust() +export_ownertrust (ctrl_t ctrl) { TRUSTREC rec; ulong recnum; int i; byte *p; - init_trustdb (0); + init_trustdb (ctrl, 0); es_printf (_("# List of assigned trustvalues, created %s\n" "# (Use \"gpg --import-ownertrust\" to restore them)\n"), asctimestamp( make_timestamp() ) ); @@ -121,7 +121,7 @@ export_ownertrust() void -import_ownertrust( const char *fname ) +import_ownertrust (ctrl_t ctrl, const char *fname ) { estream_t fp; int is_stdin=0; @@ -133,7 +133,7 @@ import_ownertrust( const char *fname ) int any = 0; int rc; - init_trustdb (0); + init_trustdb (ctrl, 0); if( iobuf_is_pipe_filename (fname) ) { fp = es_stdin; fname = "[stdin]"; @@ -202,7 +202,7 @@ import_ownertrust( const char *fname ) log_info("setting ownertrust to %u\n", otrust ); } rec.r.trust.ownertrust = otrust; - write_record (&rec ); + write_record (ctrl, &rec); any = 1; } } @@ -210,11 +210,11 @@ import_ownertrust( const char *fname ) if (!opt.quiet) log_info("inserting ownertrust of %u\n", otrust ); memset (&rec, 0, sizeof rec); - rec.recnum = tdbio_new_recnum (); + rec.recnum = tdbio_new_recnum (ctrl); rec.rectype = RECTYPE_TRUST; memcpy (rec.r.trust.fingerprint, fpr, 20); rec.r.trust.ownertrust = otrust; - write_record (&rec ); + write_record (ctrl, &rec); any = 1; } else /* error */ @@ -228,7 +228,7 @@ import_ownertrust( const char *fname ) if (any) { - revalidation_mark (); + revalidation_mark (ctrl); rc = tdbio_sync (); if (rc) log_error (_("trustdb: sync failed: %s\n"), gpg_strerror (rc) ); |