* options.h, g10.c (main), trustdb.c (ask_ownertrust): Add

--force-ownertrust option for debugging purposes.  This allows setting a
whole keyring to a given trust during an --update-trustdb.  Not for normal
use - it's just easier than hitting "4" all the time to test a large
trustdb.
This commit is contained in:
David Shaw 2002-11-07 04:37:27 +00:00
parent d771dd272d
commit bf4a893586
4 changed files with 35 additions and 6 deletions

View File

@ -1,5 +1,11 @@
2002-11-06 David Shaw <dshaw@jabberwocky.com>
* options.h, g10.c (main), trustdb.c (ask_ownertrust): Add
--force-ownertrust option for debugging purposes. This allows
setting a whole keyring to a given trust during an
--update-trustdb. Not for normal use - it's just easier than
hitting "4" all the time to test a large trustdb.
* pubkey-enc.c (get_session_key): With hidden recipients or try a
given passphrase against all secret keys rather than trying all
secret keys in turn. Don't if --try-all-secrets or --status-fd is

View File

@ -206,6 +206,7 @@ enum cmd_and_opt_values { aNull = 0,
oCompressSigs,
oAlwaysTrust,
oTrustModel,
oForceOwnertrust,
oEmuChecksumBug,
oRunAsShmCP,
oSetFilename,
@ -524,6 +525,7 @@ static ARGPARSE_OPTS opts[] = {
{ oDefCertCheckLevel, "default-cert-check-level", 1, "@"},
{ oAlwaysTrust, "always-trust", 0, "@"},
{ oTrustModel, "trust-model", 2, "@"},
{ oForceOwnertrust, "force-ownertrust", 1, "@"},
{ oEmuChecksumBug, "emulate-checksum-bug", 0, "@"},
{ oRunAsShmCP, "run-as-shm-coprocess", 4, "@" },
{ oSetFilename, "set-filename", 2, "@" },
@ -1460,6 +1462,15 @@ main( int argc, char **argv )
else
log_error("unknown trust model \"%s\"\n",pargs.r.ret_str);
break;
case oForceOwnertrust:
log_info(_("NOTE: %s is not for normal use!\n"),
"--force-ownertrust");
if(pargs.r.ret_int>=TRUST_UNDEFINED
&& pargs.r.ret_int<=TRUST_ULTIMATE)
opt.force_ownertrust=pargs.r.ret_int;
else
log_error("invalid ownertrust %d\n",pargs.r.ret_int);
break;
case oLoadExtension:
#ifndef __riscos__
#if defined(USE_DYNAMIC_LINKING) || defined(__MINGW32__)

View File

@ -89,6 +89,7 @@ struct {
int compress_keys;
int compress_sigs;
enum {TM_OPENPGP, TM_CLASSIC, TM_ALWAYS} trust_model;
unsigned int force_ownertrust;
int pgp2;
int pgp6;
int pgp7; /* if we get any more of these, it's time to look at a

View File

@ -1075,13 +1075,24 @@ ask_ownertrust (u32 *kid,int minimum)
return TRUST_UNKNOWN;
}
ot=edit_ownertrust(pk,0);
if(ot>0)
ot = get_ownertrust (pk);
else if(ot==0)
ot = minimum?minimum:TRUST_UNDEFINED;
if(opt.force_ownertrust)
{
log_info("force trust for key %08lX to %s\n",(ulong)kid[1],
trust_string(opt.force_ownertrust));
update_ownertrust(pk,opt.force_ownertrust);
ot=opt.force_ownertrust;
}
else
ot = -1; /* quit */
{
ot=edit_ownertrust(pk,0);
if(ot>0)
ot = get_ownertrust (pk);
else if(ot==0)
ot = minimum?minimum:TRUST_UNDEFINED;
else
ot = -1; /* quit */
}
free_public_key( pk );
return ot;