aboutsummaryrefslogtreecommitdiffstats
path: root/common/name-value.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-11-21 07:34:04 +0000
committerWerner Koch <[email protected]>2023-11-21 07:37:41 +0000
commitcf2d3f7ba0b7ffd0f1c014186fb60630c132dba1 (patch)
treeab35e6ce0810bfdb0e881ef7ac67f8cd020ac99f /common/name-value.h
parentscd: New option --debug-allow-pin-logging. (diff)
downloadgnupg-cf2d3f7ba0b7ffd0f1c014186fb60630c132dba1.tar.gz
gnupg-cf2d3f7ba0b7ffd0f1c014186fb60630c132dba1.zip
agent: Update the key file only if not changed.
* common/name-value.c (struct name_value_container): Add flag "modified". (nvc_modified): New. (nvc_new): Set flag. (_nvc_add): Set flag. (nvc_delete): Set flag. (nvc_set): Set flag unless value did not change. (nve_set): Add arg PK. Change the caller. * agent/findkey.c (agent_write_private_key): Update only if modified. -- This helps software which uses a file system watcher to track changes to private keys. In particular smartcard triggered changes are a problem for such software because this may at worst trigger another smartcard read. GnuPG-bug-id: 6829
Diffstat (limited to 'common/name-value.h')
-rw-r--r--common/name-value.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/name-value.h b/common/name-value.h
index b3fc2f63c..dfded6678 100644
--- a/common/name-value.h
+++ b/common/name-value.h
@@ -50,6 +50,9 @@ nvc_t nvc_new_private_key (void);
/* Release a name value container structure. */
void nvc_release (nvc_t pk);
+/* Return the modified flag and optionally clear it. */
+int nvc_modified (nvc_t pk, int clear);
+
/* Get the name. */
char *nve_name (nve_t pke);
@@ -92,8 +95,8 @@ gpg_error_t nvc_add (nvc_t pk, const char *name, const char *value);
first entry is updated. */
gpg_error_t nvc_set (nvc_t pk, const char *name, const char *value);
-/* Update entry E to VALUE. */
-gpg_error_t nve_set (nve_t e, const char *value);
+/* Update entry E to VALUE. PK is optional. */
+gpg_error_t nve_set (nvc_t pk, nve_t e, const char *value);
/* Delete the given entry from PK. */
void nvc_delete (nvc_t pk, nve_t pke);