mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
gpg: Remove tofu database format "split".
* g10/options.h (struct opt): Remove field tofu_db_format. * g10/gpg.h (server_control_s): Add fields tofu.batch_update_ref and tofu.batch_update_started. * g10/gpg.c (parse_tofu_db_format): Remove. (main): Make option --tofu-db-format obsolete. * g10/tofu.c: Major rework. Remove the pretty complicated and slower split format and with that all the caching. Use the dbs struct directly. Move global vars for batch update into CTRL. Change calling conventions of some function to take CTRL or DBS pointers instead of the former low-level database pointer. -- The split database format might have been nice for use with Unison but it bypasses the concept of a relational database by doing parts of this itself and also risking deadlocks. Working with the Tofu database for debugging or experiments is also not possible with parts of the database logic implemented in gpg. The Tofu support is quite new and we can assume that it is not in real use now. Thus we better remove that now so that we do not need to maintain it for all future. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
a27410a251
commit
5b59999ce0
52
doc/DETAILS
52
doc/DETAILS
@ -1144,6 +1144,55 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
|
||||
stored in the version info record.
|
||||
|
||||
|
||||
* Database scheme for the TOFU info
|
||||
|
||||
#+begin_src sql
|
||||
--
|
||||
-- The VERSION table holds the version of our TOFU data structures.
|
||||
--
|
||||
CREATE TABLE version (
|
||||
version integer -- As of now this is always 1
|
||||
);
|
||||
|
||||
--
|
||||
-- The BINDINGS table associates mail addresses with keys.
|
||||
--
|
||||
CREATE TABLE bindings (
|
||||
oid integer primary key autoincrement,
|
||||
fingerprint text, -- The key's fingerprint in hex
|
||||
email text, -- The normalized mail address destilled from user_id
|
||||
user_id text, -- The unmodified user id
|
||||
time integer, -- The time this binding was first observed.
|
||||
policy boolean check
|
||||
(policy in (1, 2, 3, 4, 5)), -- The trust policy with the values:
|
||||
-- 1 := Auto
|
||||
-- 2 := Good
|
||||
-- 3 := Unknown
|
||||
-- 4 := Bad
|
||||
-- 5 := Ask
|
||||
conflict string, -- NULL or a hex formatted fingerprint.
|
||||
unique (fingerprint, email)
|
||||
);
|
||||
|
||||
CREATE INDEX bindings_fingerprint_email on bindings (fingerprint, email);
|
||||
CREATE INDEX bindings_email on bindings (email);
|
||||
|
||||
--
|
||||
-- The SIGNATURES table records all data signatures we verified
|
||||
--
|
||||
CREATE TABLE signatures (
|
||||
binding integer not null, -- Link to bindings table,
|
||||
-- references bindings.oid.
|
||||
sig_digest text, -- The digest of the signed message.
|
||||
origin text, -- String describing who initially fed
|
||||
-- the signature to gpg (e.g. "email:claws").
|
||||
sig_time integer, -- Timestamp from the signature.
|
||||
time integer, -- Time this record was created.
|
||||
primary key (binding, sig_digest, origin)
|
||||
);
|
||||
#+end_src
|
||||
|
||||
|
||||
* GNU extensions to the S2K algorithm
|
||||
|
||||
1 octet - S2K Usage: either 254 or 255.
|
||||
@ -1169,6 +1218,9 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB:
|
||||
|
||||
* Keyserver helper message format
|
||||
|
||||
*This information is obsolete*
|
||||
(Keyserver helpers have been replaced by dirmngr)
|
||||
|
||||
The keyserver may be contacted by a Unix Domain socket or via TCP.
|
||||
|
||||
The format of a request is:
|
||||
|
19
doc/gpg.texi
19
doc/gpg.texi
@ -1840,25 +1840,6 @@ key signer (defaults to 3)
|
||||
The default TOFU policy (defaults to @code{auto}). For more
|
||||
information about the meaning of this option, @xref{trust-model-tofu}.
|
||||
|
||||
@item --tofu-db-format @code{auto|split|flat}
|
||||
@opindex tofu-default-policy
|
||||
The format for the TOFU DB.
|
||||
|
||||
The split file format splits the data across many DBs under the
|
||||
@code{tofu.d} directory (one per email address and one per key). This
|
||||
makes it easier to automatically synchronize the data using a tool
|
||||
such as Unison (@url{https://www.cis.upenn.edu/~bcpierce/unison/}),
|
||||
since the individual files change rarely.
|
||||
|
||||
The flat file format keeps all of the data in the single file
|
||||
@code{tofu.db}. This format results in better performance.
|
||||
|
||||
If set to auto (which is the default), GnuPG will first check for the
|
||||
existence of @code{tofu.d} and @code{tofu.db}. If one of these
|
||||
exists, the corresponding format is used. If neither or both of these
|
||||
exist, then GnuPG defaults to the @code{split} format. In the latter
|
||||
case, a warning is emitted.
|
||||
|
||||
@item --max-cert-depth @code{n}
|
||||
@opindex max-cert-depth
|
||||
Maximum depth of a certification chain (default is 5).
|
||||
|
31
g10/gpg.c
31
g10/gpg.c
@ -709,7 +709,6 @@ static ARGPARSE_OPTS opts[] = {
|
||||
#endif
|
||||
ARGPARSE_s_s (oTrustModel, "trust-model", "@"),
|
||||
ARGPARSE_s_s (oTOFUDefaultPolicy, "tofu-default-policy", "@"),
|
||||
ARGPARSE_s_s (oTOFUDBFormat, "tofu-db-format", "@"),
|
||||
ARGPARSE_s_s (oSetFilename, "set-filename", "@"),
|
||||
ARGPARSE_s_n (oForYourEyesOnly, "for-your-eyes-only", "@"),
|
||||
ARGPARSE_s_n (oNoForYourEyesOnly, "no-for-your-eyes-only", "@"),
|
||||
@ -851,6 +850,7 @@ static ARGPARSE_OPTS opts[] = {
|
||||
ARGPARSE_s_s (opcscDriver, "pcsc-driver", "@"),
|
||||
ARGPARSE_s_n (oDisableCCID, "disable-ccid", "@"),
|
||||
ARGPARSE_s_n (oHonorHttpProxy, "honor-http-proxy", "@"),
|
||||
ARGPARSE_s_s (oTOFUDBFormat, "tofu-db-format", "@"),
|
||||
|
||||
/* Dummy options. */
|
||||
ARGPARSE_s_n (oNoop, "sk-comments", "@"),
|
||||
@ -2020,32 +2020,6 @@ parse_tofu_policy (const char *policystr)
|
||||
g10_exit (1);
|
||||
}
|
||||
|
||||
static int
|
||||
parse_tofu_db_format (const char *db_format)
|
||||
{
|
||||
#ifdef USE_TOFU
|
||||
if (ascii_strcasecmp (db_format, "auto") == 0)
|
||||
return TOFU_DB_AUTO;
|
||||
else if (ascii_strcasecmp (db_format, "split") == 0)
|
||||
return TOFU_DB_SPLIT;
|
||||
else if (ascii_strcasecmp (db_format, "flat") == 0)
|
||||
return TOFU_DB_FLAT;
|
||||
else if (ascii_strcasecmp (db_format, "help") == 0)
|
||||
{
|
||||
log_info ("available TOFU DB fomats: auto, split, flat\n");
|
||||
g10_exit (1);
|
||||
}
|
||||
else
|
||||
#endif /*USE_TOFU*/
|
||||
{
|
||||
log_error (_("unknown TOFU DB format '%s'\n"), db_format);
|
||||
if (!opt.quiet)
|
||||
log_info (_("(use \"help\" to list choices)\n"));
|
||||
g10_exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function called to initialized a new control object. It is
|
||||
assumed that this object has been zeroed out before calling this
|
||||
function. */
|
||||
@ -2252,7 +2226,6 @@ main (int argc, char **argv)
|
||||
opt.trust_model = TM_AUTO;
|
||||
#endif
|
||||
opt.tofu_default_policy = TOFU_POLICY_AUTO;
|
||||
opt.tofu_db_format = TOFU_DB_AUTO;
|
||||
opt.mangle_dos_filenames = 0;
|
||||
opt.min_cert_level = 2;
|
||||
set_screen_dimensions ();
|
||||
@ -2692,7 +2665,7 @@ main (int argc, char **argv)
|
||||
opt.tofu_default_policy = parse_tofu_policy (pargs.r.ret_str);
|
||||
break;
|
||||
case oTOFUDBFormat:
|
||||
opt.tofu_db_format = parse_tofu_db_format (pargs.r.ret_str);
|
||||
obsolete_option (configname, configlineno, "tofu-db-format");
|
||||
break;
|
||||
|
||||
case oForceOwnertrust:
|
||||
|
@ -82,6 +82,8 @@ struct server_control_s
|
||||
/* Local data for tofu.c */
|
||||
struct {
|
||||
tofu_dbs_t dbs;
|
||||
int batch_update_ref;
|
||||
time_t batch_update_started;
|
||||
} tofu;
|
||||
|
||||
};
|
||||
|
@ -680,11 +680,13 @@ tofu_policy_str (enum tofu_policy policy)
|
||||
}
|
||||
|
||||
void
|
||||
tofu_begin_batch_update (void)
|
||||
tofu_begin_batch_update (ctrl_t ctrl)
|
||||
{
|
||||
(void)ctrl;
|
||||
}
|
||||
|
||||
void
|
||||
tofu_end_batch_update (void)
|
||||
tofu_end_batch_update (ctrl_t ctrl)
|
||||
{
|
||||
(void)ctrl;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public_key_list (ctrl_t ctrl, strlist_t list, int locate_mode)
|
||||
check_trustdb_stale (ctrl);
|
||||
|
||||
#ifdef USE_TOFU
|
||||
tofu_begin_batch_update ();
|
||||
tofu_begin_batch_update (ctrl);
|
||||
#endif
|
||||
|
||||
if (locate_mode)
|
||||
@ -145,7 +145,7 @@ public_key_list (ctrl_t ctrl, strlist_t list, int locate_mode)
|
||||
list_one (ctrl, list, 0, opt.with_secret);
|
||||
|
||||
#ifdef USE_TOFU
|
||||
tofu_end_batch_update ();
|
||||
tofu_end_batch_update (ctrl);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -116,17 +116,13 @@ struct
|
||||
int skip_verify;
|
||||
int skip_hidden_recipients;
|
||||
|
||||
/* TM_CLASSIC must be zero to accommodate trustdbs generated before
|
||||
/* TM_CLASSIC must be zero to accommodate trustdbsg generated before
|
||||
we started storing the trust model inside the trustdb. */
|
||||
enum
|
||||
{
|
||||
TM_CLASSIC=0, TM_PGP=1, TM_EXTERNAL=2,
|
||||
TM_ALWAYS, TM_DIRECT, TM_AUTO, TM_TOFU, TM_TOFU_PGP
|
||||
} trust_model;
|
||||
enum
|
||||
{
|
||||
TOFU_DB_AUTO=0, TOFU_DB_SPLIT, TOFU_DB_FLAT
|
||||
} tofu_db_format;
|
||||
enum tofu_policy tofu_default_policy;
|
||||
int force_ownertrust;
|
||||
enum
|
||||
|
@ -493,11 +493,13 @@ tofu_policy_str (enum tofu_policy policy)
|
||||
}
|
||||
|
||||
void
|
||||
tofu_begin_batch_update (void)
|
||||
tofu_begin_batch_update (ctrl_t ctrl)
|
||||
{
|
||||
(void)ctrl;
|
||||
}
|
||||
|
||||
void
|
||||
tofu_end_batch_update (void)
|
||||
tofu_end_batch_update (ctrl_t ctrl)
|
||||
{
|
||||
(void)ctrl;
|
||||
}
|
||||
|
803
g10/tofu.c
803
g10/tofu.c
File diff suppressed because it is too large
Load Diff
@ -112,8 +112,8 @@ gpg_error_t tofu_get_policy (ctrl_t ctrl,
|
||||
/* When doing a lot of DB activities (in particular, when listing
|
||||
keys), this causes the DB to enter batch mode, which can
|
||||
significantly speed up operations. */
|
||||
void tofu_begin_batch_update (void);
|
||||
void tofu_end_batch_update (void);
|
||||
void tofu_begin_batch_update (ctrl_t ctrl);
|
||||
void tofu_end_batch_update (ctrl_t ctrl);
|
||||
|
||||
/* Release all of the resources associated with a DB meta-handle. */
|
||||
void tofu_closedbs (ctrl_t ctrl);
|
||||
|
@ -164,4 +164,4 @@
|
||||
(checkpolicy "BC15C85A" format "ask")
|
||||
(checkpolicy "2183839A" format "bad")
|
||||
(checkpolicy "EE37CF96" format "ask"))
|
||||
'("split" "flat"))
|
||||
'("flat"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user