aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* argparse: Fix a memory leak.NIIBE Yutaka11 days1-0/+1
| | | | | | | | * src/argparse.c (handle_meta_echo): Free the STRING. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Time for a new error code; this time GPG_ERR_UNEXPECTED_PACKETWerner Koch2025-05-161-0/+1
| | | | | | | | | | -- We already have _tag which is used for ASN.1, _MSG which is used by protocols like WKS and TLS, and the GPG_ERR_UNEXPECTED which is unrelated the former one and means just that an error was not expected. OpenPGP also has some cases where a packet is not expected. A dedicated error code thus makes sense.
* Add commands mkdir and chdir to gpg-errorWerner Koch2025-04-241-32/+62
| | | | | | | | * src/gpg-error.c (main): Add new commands mkdir and chdir. Allow for commands w/o dashes. -- Again some more or less useful stuff for testing on Windows.
* w32: Yet another extended length path kludge.Werner Koch2025-04-241-3/+7
| | | | | | | | * src/sysutils.c (_gpgrt_fname_to_wchar): Change threshold from 255 to 250. -- Updates-commit: 65114f24e13f835a289f791ed7a5e408b2843d59
* w32: More changes to the extended length path handling.Werner Koch2025-04-221-32/+90
| | | | | | | | | | | | | | | | | | | | * src/sysutils.c (has_path_separator): New. (_gpgrt_fname_to_wchar): Rewrite to add the prefix only when needed. ---- GetFullPathNameW has no MAX_PATH limit and thus can be used with any input. We now prefix the resulting absolute path after the call to GFPN. This allows to check whether the CWD is an UNC and thus use the right prefix. We also don't run the entire thing for just a drive letter etc and further skip the prefix if the absolute path is less than MAX_PATH. This gives better backward compatibility. There is also now a GPGRT_DISABLE_EXTLENPATH=-2 which does not disable the extended path handling but enables debug output. To actually disable the feature a positive value must be used. Updates-commit 28ae4ee194ec56e98123d3aceda130161dfd2df8 GnuPG-bug-id: 5754
* Mark the initializations with __nonstring__ attribute.NIIBE Yutaka2025-04-212-0/+7
| | | | | | | | | | * src/b64enc.c (bintoasc): Use GPGRT_ATTR_NONSTRING. * src/gpg-error.h.in (GPGRT_ATTR_NONSTRING): New. -- GnuPG-bug-id: 7621 Signed-off-by: NIIBE Yutaka <[email protected]>
* Release 1.54libgpg-error-1.54gpgrt-1.54Werner Koch2025-04-171-1/+1
|
* w32: Fix extended length path handling for UNC specified files.Werner Koch2025-04-161-4/+26
| | | | | | | | | | | | | | | | | | | | | * src/sysutils.c (_gpgrt_fname_to_wchar): Fix the extended length path support for UNC file names. Also add an envvar to disable the entire extended length path support. -- GnuPG-bug-id: 5754 Fixes-commit: a4a692fcf1ed128693ec6d64d5e3163775aad10b With the last fix we fixed the extended length path support but it also truned outa wrong implementaion of it for UNC. Before the previous patch the UNC support was already wrong but it exhibited itself only when the requested UNC was already long. The patch then kicked in the support more often and in particular always if an UNC was used (due to the new checking for backslashes and not just the length). To avoid further surprises we now have an envvar to disable that support entirely. But if should be correct now ;-).
* Add command --fopen to gpg-error to help testingWerner Koch2025-04-161-2/+22
| | | | | | | | | | * src/gpg-error.c (main): Implement command --fopen. Also ignore log file settings from the Registry. -- To test estream functions it is useful to have commands to run some of them. Here we use gpgrt_fopen (fname, "r,sysopen") for the --fopen command.
* Use gpgrt_stream_t for the API of gpgrt_nvc_*.NIIBE Yutaka2025-04-091-2/+2
| | | | | | | | | | | | | * src/gpg-error.h.in (gpgrt_nvc_parse): Use gpgrt_stream_t. (gpgrt_nvc_write): Likewise. -- For applications with no GPGRT_ENABLE_ES_MACROS, it's good not to use estream_t here. Fixes-commit: 7ec1f27b60eec95297c5267ab5ebbdb73b263c3f Signed-off-by: NIIBE Yutaka <[email protected]>
* Release 1.52libgpg-error-1.52gpgrt-1.52Werner Koch2025-04-083-3/+7
|
* argparse: Make getreg meta command work on Unix.Werner Koch2025-04-071-7/+93
| | | | | | | | | | | * src/argparse.c (_gpgrt_argparse_internal_s): Add fields no_registry and registry. (initialize): Init them. (emulated_registry_lookup): New. (handle_meta_getenv): Use it. * tests/etc/t-argparse.conf: Add a getreg meta command. * tests/t-argparse.c (opt): Add a disable-akr command. * tests/etc/Registry: New.
* Add a section mode to the name-value functions.Werner Koch2025-04-072-9/+74
| | | | | | | | | | * src/gpg-error.h.in (GPGRT_NVC_SECTION): New. * src/name-value.c (_gpgrt_name_value_container): Add section_mode. (_gpgrt_nvc_new): Set it. (_gpgrt_nvc_get_flag): Return it. (valid_name): Add arg sectionmode and change callers. (do_nvc_parse): Parse section names in section mode. (_gpgrt_nvc_write): Return an error in section mode.
* Allow name-value lookup w/o a trailing colon for the name.Werner Koch2025-04-071-24/+59
| | | | | | | | | | | | | | * src/name-value.c (_gpgrt_name_value_entry): Add field namelen. (ascii_memcasecmp): New. (same_name_p): New. (valid_name): Strip the colon and return the length. (do_nvc_add): Set namelen. (_gpgrt_nvc_lookup): Simplify. * tests/t-name-value.c (test_getting_values): Add some extra tests. -- The requirement for a colon after the name is too cumbersome.
* New public API gpgrt_nvc_* and gpgrt_nve_*Werner Koch2025-04-078-4/+1155
| | | | | | | | | | | | | | | | | | * src/name-value.c: New. * tests/t-name-value.c: New. * src/gpg-error.def.in: Add new functions. * src/gpg-error.h.in: Ditto. * src/gpg-error.vers: Ditto. * src/visibility.c: Ditto. * src/visibility.h: Ditto. -- These new functions were originally added to GnuPG taken from current GnuPG master. The license has been changed from (LGPL-3.0-or-later OR GPL-2.0-or-later) to LGPL-2.1-or-later: Everything was written by me or employees/contractors of g10 Code GmbH. The private key handling has been removed because that would require Libgcrypt functions. Some functions are changed.
* Update the copyright notice.Werner Koch2025-04-071-1/+1
| | | | | * configure.ac (GPGRT_STD_COPYRIGHT_LINE): New. * src/gpg-error.c (my_strusage): Use it here.
* w32: Improve the detection of the need for a \\?\ prefixWerner Koch2025-04-041-3/+5
| | | | | | | | | | | | | * src/sysutils.c (_gpgrt_fname_to_wchar): Use the no-max-path prefix for shorter files and for filenames with path separators. -- Depending on the current directory the old threshold of 230 was to larger. Now we use a lower limit which should handle most standard file names w/o the need for the prefix. We also always do this if the requested file includes a directory part. Updates-commit: 32dad4e4135f0bdc436ed684da753d4b0cdb0ea1
* New public API gpgrt_strlist_*Werner Koch2025-04-0110-212/+353
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/strlist.c: Rename all functions to have a _gpgrt_strlist prefix. (append_to_strlist2, strlist_length): Remove. (_gpgrt_strlist_free): rtake care of the wipe flag. (_gpgrt_strlist_add): Add a flags arg to use it for prepend and append. Return an error on failure. (_gpgrt_strlist_tokenize): Ditto. (_gpgrt_strlist_copy): Chnage to return an error on failure. (_gpgrt_strlist_pop): Ditto. * src/Makefile.am (libgpg_error_la_SOURCES): Add strlist.c. * src/argparse.c (trim_spaces): Move to ... * src/stringutils.c (_gpgrt_trim_spaces): here and rename. * src/visibility.c: Add wrappers for all exported functions. * src/visibility.h: MArk exported functions as visisble. * src/gpg-error.def.in: Export new functions * src/gpg-error.vers: Ditto. * src/gpg-error.h.in (GPGRT_STRLIST_APPEND): New. (GPGRT_STRLIST_WIPE): New. (gpgrt_strlist_free): New. (gpgrt_strlist_add): New. (gpgrt_strlist_tokenize): New. (gpgrt_strlist_copy): New. (gpgrt_strlist_rev): New. (gpgrt_strlist_prev): New. (gpgrt_strlist_last): New. (gpgrt_strlist_pop): New. (gpgrt_strlist_find): New. (gpgrt_strlist_count): New inline function. -- This is a modified set of function as used by gpg for ages. These are quite useful functions and will be needed internally for some other planned features. The idea is to make their counterparts in gnupg wrapper around those new functions. After we have moved the secure memory stuff from Libgcrypt to here we can also implement a GPGRT_STRLICT_SECMEM flag to allow allocating strings here ion secure memory. For now we only have the WIPE flag which wipes the memory on free.
* Add source file strlist.cWerner Koch2025-03-281-0/+355
| | | | | | | | | | | | | | | | | | | | -- This is a copy from current GnuPG master. The license has been chnaged from (LGPL-3.0-or-later OR GPL-2.0-or-later) to LGPL-2.1-or-later: Almost everything was written by me or by employees of g10 Code GmbH. The only exception is strlist_pop 2002-06-14 David Shaw <[email protected]> * strgutil.c (pop_strlist): New function to pop the head off of a strlist. from gnupg-1.4/util/strgutil.c. However the function is to obvious to inhibit the license change. It needs to be changes anyway with followup commits. Signed-off-by: Werner Koch <[email protected]>
* gpgrt-config: Append default directory to PKG_CONFIG_PATH.NIIBE Yutaka2025-02-061-11/+6
| | | | | | | | * src/gpgrt-config.in: Fix initializing PKG_CONFIG_PATH. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Skip gpg-error-config-test.sh for specific incompatible pkg-config.NIIBE Yutaka2025-01-221-0/+9
| | | | | | | | | | | * src/gpg-error-config-test.sh.in: Skip the test with pkgconf 1.8.0. -- Possibly, we need to skip with 1.9.0, 1.9.1, 1.9.2, and 1.9.3, too. pkgconf 1.8.1 (on Debian) works well. Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Care about closefrom/close call is interrupted.NIIBE Yutaka2025-01-141-62/+54
| | | | | | | | | | | | * src/spawn-posix.c (closefrom_really): Handle interrupted call of closefrom. (close_except): Likewise for call of close. (_gpgrt_close_all_fds): Use closefrom_really and close_except. -- GnuPG-bug-id: 7478 Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Use closefrom when available.NIIBE Yutaka2025-01-081-2/+46
| | | | | | | | | * configure.ac (AC_CHECK_FUNCS): Check closefrom. * src/spawn-posix.c [HAVE_CLOSEFROM]: Use closefrom if possible. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* New Windows API gpgrt_w32_reg_get_string.Werner Koch2024-12-126-8/+90
| | | | | | | | | | | | | | | | | | | | | | | | | * src/w32-reg.c (_gpgrt_w32_reg_query_string): Implement a prefix for root and consider an empty string for root also HKCU. * src/visibility.c (gpgrt_w32_reg_get_string): New. * src/gpg-error.def.in: Add new function. * src/gpg-error.c (my_strusage): Print the Windows version (32 or 64 bit) of the binary. (main): New command --getreg. -- This function is already used internally and we have a similar function in GnuPG. It is much more convenient to work with this function. Also we can now pass the KEY_WOW64_32KEY andKEY_WOW64_64KEY flags to the registry read functions. For example !32key!HKLM\software\gnu\gnupg:ntdskeyserver returns the value using the KEY_WOW64_32KEY flag; likewise for !64key!. If !cross! is used the reversed flag of the binary type is used.
* spawn:w32: Fix a memory leak on an error path.NIIBE Yutaka2024-11-141-4/+4
| | | | | | | | | | * src/spawn-w32.c (spawn_detached): Make sure to release lpAttributeList. (_gpgrt_process_spawn): Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Shorter identifier gpgrt_spawn_actions_set_env_rev.NIIBE Yutaka2024-10-168-15/+15
| | | | | | | | | | | | | | | | | | * src/gpg-error.def.in: Rename to gpgrt_spawn_actions_set_env_rev. * src/gpg-error.h.in: Likewise. * src/gpg-error.vers: Likewise. * src/gpgrt-int.h: Likewise. * src/spawn-posix.c: Likewise. * src/spawn-w32.c: Likewise. * src/visibility.c: Likewise. * src/visibility.h: Likewise. * tests/t-spawn.c (run_test): Use gpgrt_spawn_actions_set_env_rev. -- Fixes-commit: 1860f6407f834b681c21f67db7236eaad161524c GnuPG-bug-id: 7307 Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Add new function to modify environment.NIIBE Yutaka2024-10-118-8/+264
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpg-error.def.in (gpgrt_spawn_actions_set_envchange): New. * src/gpg-error.vers (gpgrt_spawn_actions_set_envchange): New. * src/gpg-error.h.in (gpgrt_spawn_actions_set_envchange): New. * src/gpgrt-int.h (_gpgrt_spawn_actions_set_envchange): New. * src/spawn-posix.c (struct gpgrt_spawn_actions): New field ENVCHANGE. (prepare_environ): New. (my_exec): Take care of ENVCHANGE. (_gpgrt_spawn_actions_set_envchange): New. * src/spawn-w32.c (struct gpgrt_spawn_actions): New field ENVCHANGE. (prepare_env_block): New. (_gpgrt_spawn_actions_set_envchange): New. (spawn_detached, _gpgrt_process_spawn): Take care of ENVCHANGE. * src/visibility.c (gpgrt_spawn_actions_set_envchange): New. * src/visibility.h (gpgrt_spawn_actions_set_envchange): New. * tests/Makefile.am (TESTS): Add t-spawn. * tests/t-spawn.c: New. -- GnuPG-bug-id: 7307 Signed-off-by: NIIBE Yutaka <[email protected]>
* w32: Fix releasing memory for UTF-8 text.NIIBE Yutaka2024-10-101-8/+8
| | | | | | | | | * src/spawn-w32.c (spawn_detached): Use _gpgrt_free_wchar. (_gpgrt_process_spawn): Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* estream: Let poll return an error for a closed fd.Werner Koch2024-09-241-0/+5
| | | | * src/estream.c (_gpgrt_poll): Set got_nval.
* posix: Fix forgotten _gpgrt_post_syscall on error path.NIIBE Yutaka2024-09-191-0/+1
| | | | | | | | * src/spawn-posix.c (do_create_pipe_and_estream): Call post_syscall. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* posix: Fix memory leak for spawn.NIIBE Yutaka2024-09-191-0/+1
| | | | | | | | * src/spawn-posix.c (spawn_detached): Free ARGV. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* w32:spawn: Remove unused function get_max_fds.NIIBE Yutaka2024-09-161-21/+0
| | | | | | | | * src/spawn-w32.c (get_max_fds): Remove. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* w32: Clarify the environment block encoding.NIIBE Yutaka2024-09-061-0/+3
| | | | | | | | | | | | | | * src/spawn-w32.c (_gpgrt_spawn_actions_set_envvars): It's an ASCII string. -- In future, we can extend it as UTF-8 string. When doing so, we will detect ASCII or utf-8, and if needed, convert it to Unicode wchar string with four-byte-zero terminated, and let the flag have CREATE_UNICODE_ENVIRONMENT. Signed-off-by: NIIBE Yutaka <[email protected]>
* w32: Add GPGRT_PROCESS_ALLOW_SET_FG for gpgrt_process_spawn.NIIBE Yutaka2024-08-272-2/+4
| | | | | | | | | | | | * src/gpg-error.h.in (GPGRT_PROCESS_ALLOW_SET_FG): New. * src/spawn-w32.c (_gpgrt_process_spawn): Support the flag. -- When GPGME will use gpgrt_process_spawn in future, this flag will be needed to support GPGME_SPAWN_ALLOW_SET_FG. Signed-off-by: NIIBE Yutaka <[email protected]>
* w32: Allow initialization of new threads to utf8 mode.Werner Koch2024-08-024-9/+35
| | | | | | | | | * src/init.c (utf8_for_new_threads): New var. (_gpgrt_w32_utf8_for_new_threads): New func. (get_tls): Init the TLS utf8 flag from the new var. * src/w32-gettext.c (_gpg_w32_gettext_use_utf8): Implement new flag. -- GnuPG-bug-id: 7185
* Put the full commit id into VERSION.Werner Koch2024-07-041-2/+2
| | | | | | | | * autogen.sh <find-version>: Also print the full commit id. * configure.ac: Get the full commit id. Add it to VERSION. (BUILD_REVISION): Replace this ac_define by (BUILD_COMMITID): this. * src/version.c (cright_blurb): Use here.
* core: Declare environ for macOS and others.Werner Koch2024-06-201-0/+3
| | | | | | | * src/spawn-posix.c (environ): Declare. -- GnuPG-bug-id: 7169
* spawn: New flag GPGRT_PROCESS_NO_EUID_CHECKWerner Koch2024-06-192-8/+13
| | | | | | * src/gpg-error.h.in (GPGRT_PROCESS_NO_EUID_CHECK): New. * src/spawn-posix.c (spawn_detached): Move check to ... (_gpgrt_process_spawn): here and skip if flag is set.
* spawn: Keep struct definitions at the top of the file.Werner Koch2024-06-192-34/+51
| | | | | * src/spawn-posix.c: Move include and struct defs around. * src/spawn-w32.c: Move struct defs around.
* Apply spell fix.NIIBE Yutaka2024-06-131-1/+1
| | | | | | * src/gpg-error.m4: Apply spell fix from GnuPG master. Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix gpg-error.m4.NIIBE Yutaka2024-06-131-14/+23
| | | | | | | | | | | * src/gpg-error.m4 (_AM_PATH_GPGRT_CONFIG): Don't set gpg_error_config_version. (AM_PATH_GPG_ERROR): Set GPG_ERROR_CONFIG here and set gpg_error_config_version with GPG_ERROR_CONFIG. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Support the use case in libassuan where PGMNAME==NULL.NIIBE Yutaka2024-06-072-5/+24
| | | | | | | | | | | * src/spawn-posix.c (my_exec): When PGMNAME==NULL, just fork. (_gpgrt_process_spawn): Support PGMNAME==NULL use case. * src/spawn-w32.c (_gpgrt_process_spawn): Return GPG_ERR_INV_ARG, when PGMNAME==NULL. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Expose gpgrt_spawn_actions functions.NIIBE Yutaka2024-06-066-8/+30
| | | | | | | | | | | | * src/gpg-error.def.in: Update. * src/gpg-error.h.in: Add declarations. * src/gpg-error.vers: Update. * src/visibility.c: Update. * src/visibility.h: Update. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Add new GPGRT_PROCESS_NO_CONSOLE for Windows.NIIBE Yutaka2024-06-062-0/+5
| | | | | | | | | | | | | * src/gpg-error.h.in (GPGRT_PROCESS_NO_CONSOLE): New. * src/spawn-w32.c (_gpgrt_process_spawn): Handle GPGRT_PROCESS_NO_CONSOLE. -- This may be used to support ASSUAN_PIPE_CONNECT_DETACHED in libassuan. Signed-off-by: NIIBE Yutaka <[email protected]>
* Cleanup spawn API implementation.NIIBE Yutaka2024-06-063-95/+57
| | | | | | -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix return type of gpgrt_b64dec_*.NIIBE Yutaka2024-06-062-4/+4
| | | | | | | | | | * src/gpg-error.h.in (gpgrt_b64dec_proc): Return gpg_err_code_t. (gpgrt_b64dec_finish): Ditto. * src/visibility.c: Fix return type. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn:w32: Allow for up to 32 inherited handles.Werner Koch2024-06-051-2/+2
| | | | | | | | * src/spawn-w32.c (spawn_detached): Increase array size. (_gpgrt_process_spawn): Ditto. -- The former limit of 16 might be a bit too low for some use cases.
* spawn: Avoid bumping the error counter.Werner Koch2024-06-052-20/+22
| | | | | | | | | | | | | | | * src/spawn-posix.c: Use log_info instead of log_error. * src/spawn-w32.c: Ditto. (spawn_detached): Fix copying of hd[2] (_gpgrt_process_spawn): Ditto. -- The spawn function might be used to run helper processes which are non-critical for the operation of the program. For example to display help. Bumping the error counter via gpgrt_log_error would then let the entire program fail which might be surprising. It is better to just print an informational message and let the caller decide what to do with the returned error code.
* spawn: Expose spawn functions API.NIIBE Yutaka2024-06-059-129/+184
| | | | | | | | | | | | | * src/gpg-error.def.in: Update. * src/gpg-error.vers: Update. * src/gpg-error.h.in: Add declarations. * src/visibility.c: Add implementations. * src/visibility.h: Expose them. -- GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn:w32: Fix setting of dwFlags for CreateProcess.NIIBE Yutaka2024-06-041-1/+2
| | | | | | | | | * src/spawn-w32.c (_gpgrt_process_spawn): Only set STARTF_USESTDHANDLES with active handles. -- Signed-off-by: NIIBE Yutaka <[email protected]>