aboutsummaryrefslogtreecommitdiffstats
path: root/common/name-value.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-11-21common: Check wether to set the modified flag in nve_set.Werner Koch1-22/+8
* common/name-value.c (nvc_set): Factor code out to ... (nve_set): here.
2023-11-21agent: Update the key file only if not changed.Werner Koch1-6/+41
* 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
2023-06-07dirmngr: Extend the AD_QUERY command.Werner Koch1-1/+1
* dirmngr/server.c (cmd_ad_query): Add options --help and --subst. (cmd_getinfo): Add sub-command "sid". * dirmngr/ks-engine.h (KS_GET_FLAG_SUBST): New. * dirmngr/ks-engine-ldap.c (ks_ldap_help_variables): New. (getval_for_filter): New. (map_rid_to_dn): New. (ks_ldap_query): Support variables. -- The new variables features makes it easier to write AD queries without requiring domain specific expressions.
2023-05-26common: New function nve_setWerner Koch1-0/+24
* common/name-value.c (nve_set): New. -- Taken from 2.2 commit 706adf669173ec604158e4a2f4337e3da6cb1e45
2023-05-26common: New function nve_setWerner Koch1-0/+24
* common/name-value.c (nve_set): New. -- Taken from 2.2 commit 706adf669173ec604158e4a2f4337e3da6cb1e45
2023-01-24common: Slight redefinition of nvc_get_boolean.Werner Koch1-5/+9
* common/name-value.c (nvc_get_boolean): Rewrite. -- The function may now return a positive or negative number instead of just 1 for true. All callers were already prepared for this. GnuPG-bug-id: 6212
2022-09-01common: Make nvc_lookup more robust.Werner Koch1-1/+12
* common/name-value.c (nvc_first): Allow for NULL arg. (nvc_lookup): Allow for PK being NULL. -- GnuPG-bug-id: 6176
2022-08-11common: New function nvc_get_boolean.Werner Koch1-0/+22
* common/name-value.c (nvc_get_boolean): New.
2021-05-20common: Avoid double-freeJakub Jelen1-0/+1
* common/name-value.c (do_nvc_parse): reset to null after ownership change -- Signed-off-by: Jakub Jelen <[email protected]> GnuPG-bug-id: 5393
2021-04-13common: Fix memory leaks.Jakub Jelen1-1/+5
* common/name-value.c (do_nvc_parse): Free NAME. * common/recsel.c (recsel_parse_expr): Release SE_HEAD and EXPR_BUFFER. -- GnuPG-bug-id: 5393 Signed-off-by: Jakub Jelen <[email protected]>
2019-08-06common: Fix line break handling, finding a space.NIIBE Yutaka1-3/+3
* common/name-value.c (assert_raw_value): Correctly find a space. Signed-off-by: NIIBE Yutaka <[email protected]>
2019-05-07common: New functions nvc_delete_named and nvc_get_string.Werner Koch1-0/+34
* common/name-value.c (nvc_delete_named): New. (nvc_get_string): New. Signed-off-by: Werner Koch <[email protected]>
2019-05-03common: In private key mode write "Key:" always last in name-value.Werner Koch1-13/+40
* common/name-value.c (nvc_write): Take care of Key. Factor some code out to ... (write_one_entry): new. -- The key item is in general not manual editable thus we put it at the end of a file. Signed-off-by: Werner Koch <[email protected]>
2017-02-21Clean up word replication.Yuri Chornoivan1-1/+1
-- This fixes extra word repetitions (like "the the" or "is is") in the code and docs. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2016-11-05Change all http://www.gnu.org in license notices to https://Werner Koch1-1/+1
--
2016-09-02common: Check read errors in name-value.cWerner Koch1-1/+6
* common/name-value.c: Check for read errors. Signed-off-by: Werner Koch <[email protected]>
2016-06-23common: Add dedicated private key functions to name-value.c.Werner Koch1-18/+64
* common/name-value.c (struct name_value_container): Add field 'private_key_mode'. (my_error): New. Use instead of gpg_error. (nvc_new_private_key): New. (nve_release): Add arg 'private_key_mode'. (nvc_release): Call nve_release with private_key_mode flag. (nvc_delete): Ditto. (_nvc_add): Do no special case "Key:" in non-private_key_mode. (nvc_get_private_key): Return error in non-private_key_mode. (nvc_set_private_key): Ditto. (nvc_parse): Factor all code out to ... (do_nvc_parse): new. Add arg 'for_private_key'. (nvc_parse_private_key): New. * agent/findkey.c (write_extended_private_key): Replace nvc_parse by nvc_parse_private_key. (read_key_file): Ditto. * common/t-name-value.c (private_key_mode): New variable. (my_nvc_new): New. Replace all callers. (test_key_extraction): Take mode in account. (run_tests): Ditto. (run_modification_tests): Ditto. (parse): Ditto. (main): Add option --parse and rename --parse to --parse-key. -- Signed-off-by: Werner Koch <[email protected]>
2016-06-23common: Rename external symbols in name-value.c.Werner Koch1-53/+53
* common/name-value.c, common/name-value.h: Rename symbol prefixes from "pkc_" to "nvc_" and from "pke_" to "nve_". Change all callers. Signed-off-by: Werner Koch <[email protected]>
2016-06-23common: Rename private-keys.c to name-value.cWerner Koch1-2/+7
* common/private-keys.c: Rename to name-value.c. * common/private-keys.h: Rename to name-value.h. Chage all users. * common/t-private-keys.c: Rename to t-name-value.c. * common/Makefile.am: Adjust accordingly. -- The module is cool enough to be used for other purposes as well. Thus we better change the name. Signed-off-by: Werner Koch <[email protected]>
2016-04-25common: Minor fixes for the new private-keys.c.Werner Koch1-31/+41
* common/private-keys.c (my_error_from_syserror): New. Use it in place of gpg_error_from_syserror. (_pkc_add, pkc_lookup, pke_next_value): Use ascii_strcasecmp. (pkc_parse): Use xtrystrdup and append_to_strlist_try as intended. (_pkc_add): Add braces around if-statement. -- We should have a macro so that we do not need to define a wrapper function like my_error_from_syserror in files where it is needed. I am not sure about a proper name, "my_" seems to be the easiest replacement. Note that the global DEFAULT_ERRSOURCE is relatively new to replace the need to convey the error source in function calls; we want that function from common/ return the error source of the main binary. We require that a key is ASCII and thus we better use ascii_strcasecmp to avoid problems with strange locales. Signed-off-by: Werner Koch <[email protected]>
2016-04-21common: Drop unused variables, fix warnings.Justus Winter1-1/+1
-- Signed-off-by: Justus Winter <[email protected]>
2016-04-21common: Add support for the new extended private key format.Justus Winter1-0/+740
* agent/findkey.c (write_extended_private_key): New function. (agent_write_private_key): Detect if an existing file is in extended format and update the key within if it is. (read_key_file): Handle the new format. * agent/keyformat.txt: Document the new format. * common/Makefile.am: Add the new files. * common/private-keys.c: New file. * common/private-keys.h: Likewise. * common/t-private-keys.c: Likewise. * common/util.h (alphap, alnump): New macros. * tests/migrations: Add test demonstrating that we can cope with the new format. -- GnuPG 2.3+ will use a new format to store private keys that is both more flexible and easier to read and edit by human beings. The new format stores name,value-pairs using the common mail and http header convention. This patch adds the parser and support code and prepares GnuPG 2.1 for the new format. Signed-off-by: Justus Winter <[email protected]>