From c47ec46526b603a4052873fab3e33ad5f03f758b Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sat, 15 Nov 2003 00:19:49 +0000 Subject: [PATCH] * options.h, trustdb.c (trust_model_string, init_trustdb): Add support for "external" trust model, where the user can provide a pregenerated trustdb. * keyedit.c (keyedit_menu): Do not allow editing ownertrust with an external trust model trustdb. --- g10/ChangeLog | 9 +++++++++ g10/keyedit.c | 7 +++++++ g10/options.h | 5 ++++- g10/trustdb.c | 17 ++++++++++------- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index fbcacbf9c..fc6267992 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,12 @@ +2003-11-14 David Shaw + + * options.h, trustdb.c (trust_model_string, init_trustdb): Add + support for "external" trust model, where the user can provide a + pregenerated trustdb. + + * keyedit.c (keyedit_menu): Do not allow editing ownertrust with + an external trust model trustdb. + 2003-11-13 David Shaw * options.h, g10.c, keyedit.c, keylist.c, mainproc.c: Clarify the diff --git a/g10/keyedit.c b/g10/keyedit.c index d3d1640a9..5ecec5941 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1565,6 +1565,13 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands, break; case cmdTRUST: + if(opt.trust_model==TM_EXTERNAL) + { + tty_printf(_("Owner trust may not be set while " + "using an user provided trust database\n")); + break; + } + show_key_with_all_names( keyblock, 0, 0, 0, 1, 0 ); tty_printf("\n"); if( edit_ownertrust( find_kbnode( keyblock, diff --git a/g10/options.h b/g10/options.h index b3738f524..64799361a 100644 --- a/g10/options.h +++ b/g10/options.h @@ -91,7 +91,10 @@ struct { int compress_sigs; /* TM_CLASSIC must be zero to accomodate trustdbs generated before we started storing the trust model inside the trustdb. */ - enum {TM_CLASSIC=0, TM_PGP=1, TM_ALWAYS, TM_AUTO} trust_model; + enum + { + TM_CLASSIC=0, TM_PGP=1, TM_EXTERNAL=2, TM_ALWAYS, TM_AUTO + } trust_model; unsigned int force_ownertrust; enum { diff --git a/g10/trustdb.c b/g10/trustdb.c index be8835807..c9f75b933 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -1,6 +1,6 @@ /* trustdb.c - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 - * Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001, 2002 + * 2003 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -388,10 +388,11 @@ trust_model_string(void) { switch(opt.trust_model) { - case TM_PGP: return "PGP"; - case TM_CLASSIC: return "classic"; - case TM_ALWAYS: return "always"; - default: return "unknown"; + case TM_CLASSIC: return "classic"; + case TM_PGP: return "PGP"; + case TM_EXTERNAL: return "external"; + case TM_ALWAYS: return "always"; + default: return "unknown"; } } @@ -438,7 +439,9 @@ init_trustdb() opt.trust_model=tdbio_read_model(); /* Sanity check this ;) */ - if(opt.trust_model!=TM_CLASSIC && opt.trust_model!=TM_PGP) + if(opt.trust_model!=TM_CLASSIC + && opt.trust_model!=TM_PGP + && opt.trust_model!=TM_EXTERNAL) { log_info(_("unable to use unknown trust model (%d) - " "assuming %s trust model\n"),opt.trust_model,"PGP");