aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2024-10-04 10:03:11 +0000
committerWerner Koch <[email protected]>2024-10-04 10:03:11 +0000
commita5527edebbad3a3a4a5dc93d61133f75eac6bc89 (patch)
tree67f54cf3c5de9dbef75a80f5780c60df39eafa0c
parentgpgsm: Implement a cache for the KEYINFO queries. (diff)
downloadgnupg-a5527edebbad3a3a4a5dc93d61133f75eac6bc89.tar.gz
gnupg-a5527edebbad3a3a4a5dc93d61133f75eac6bc89.zip
gpgsm: Add compatibility flag no-keyinfo-cache
* sm/gpgsm.c (compatibility_flags): Add flag. * sm/gpgsm.h (COMPAT_NO_KEYINFO_CACHE): New. * sm/call-agent.c (gpgsm_agent_istrusted): Act upon it. (gpgsm_agent_keyinfo): Ditto.
-rw-r--r--sm/call-agent.c6
-rw-r--r--sm/gpgsm.c1
-rw-r--r--sm/gpgsm.h2
3 files changed, 9 insertions, 0 deletions
diff --git a/sm/call-agent.c b/sm/call-agent.c
index 01577243d..a7e23a225 100644
--- a/sm/call-agent.c
+++ b/sm/call-agent.c
@@ -1011,6 +1011,9 @@ gpgsm_agent_istrusted (ctrl_t ctrl, ksba_cert_t cert, const char *hexfpr,
}
/* First try to get the info from the cache. */
+ if ((opt.compat_flags & COMPAT_NO_KEYINFO_CACHE))
+ istrusted_cache_disabled = 1;
+
if (!istrusted_cache_disabled && !istrusted_cache_valid)
{
/* Cache is empty - fill it. */
@@ -1445,6 +1448,9 @@ gpgsm_agent_keyinfo (ctrl_t ctrl, const char *hexkeygrip, char **r_serialno)
return gpg_error (GPG_ERR_INV_VALUE);
/* First try to fill the cache. */
+ if ((opt.compat_flags & COMPAT_NO_KEYINFO_CACHE))
+ keyinfo_cache_disabled = 1;
+
if (!keyinfo_cache_disabled && !ctrl->keyinfo_cache_valid)
{
parm.fill_mode = 1;
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index 01b3f011f..ea37a4a4c 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -470,6 +470,7 @@ static struct compatibility_flags_s compatibility_flags [] =
{
{ COMPAT_ALLOW_KA_TO_ENCR, "allow-ka-to-encr" },
{ COMPAT_NO_CHAIN_CACHE, "no-chain-cache" },
+ { COMPAT_NO_KEYINFO_CACHE, "no-keyinfo-cache" },
{ 0, NULL }
};
diff --git a/sm/gpgsm.h b/sm/gpgsm.h
index 6b543ed04..f239f21b6 100644
--- a/sm/gpgsm.h
+++ b/sm/gpgsm.h
@@ -186,6 +186,8 @@ struct
/* Not actually a compatibiliy flag but useful to limit the
* required memory for a validated key listing. */
#define COMPAT_NO_CHAIN_CACHE 2
+/* Ditto. But here to disable the keyinfo and istrusted cache. */
+#define COMPAT_NO_KEYINFO_CACHE 4
/* Forward declaration for an object defined in server.c */
struct server_local_s;