aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: Make gpgrt_free robust against legacy free implementations.Werner Koch2021-05-201-0/+12
| | | | | | * src/init.c (_gpgrt_free): Shortcut NULL and save ERRNO. Signed-off-by: Werner Koch <[email protected]>
* build,tests: Fix leaks of memory or file pointer.Jakub Jelen2021-04-121-0/+1
| | | | | | | | | | | | * src/mkheader.c (parse_config_h): Close FP. * tests/t-b64.c (test_b64enc_string): Free STATE. (test_b64dec_string): Free BUFFER. * tests/t-syserror.c (main): Close FP. -- GnuPG-bug-id: 5381 Signed-off-by: Jakub Jelen <[email protected]>
* core: Fix gpgrt_wait_processes, by skipping invalid PID.NIIBE Yutaka2021-04-081-1/+6
| | | | | | | | | | | | | * src/spawn-posix.c (_gpgrt_wait_processes): Skip invalid PID. -- The API itself is not good to handle multiple processes. Given the API, skipping invalid PID is better for usefulness. GnuPG-bug-id: 5381 Reported-by: Jakub Jelen <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Fix gpgrt-config for handling 'Requires' field.NIIBE Yutaka2021-04-071-1/+2
| | | | | | | | | | * src/gpgrt-config.in (get_attr_l): Fix thinko for word split. -- GnuPG-bug-id: 5381 Reported-by: Jakub Jelen <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* m4: Fix previous commit.NIIBE Yutaka2021-03-311-1/+1
| | | | Signed-off-by: NIIBE Yutaka <[email protected]>
* m4: Support cross-compiling better.NIIBE Yutaka2021-03-311-3/+4
| | | | | | | | | | | * src/gpg-error.m4 (GPGRT_CONFIG): Prefer the one under $prefix. (sed expression): Better compatibility to POSIX sed. -- GnuPG-bug-id: 5365 Reported-by: Jay Freeman (saurik) Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Fix generation of lock-obj-pub.native.h for cross build.David Michael2021-03-261-1/+1
| | | | | | | | | * src/gen-lock-obj.sh: Capture echo output with quotes. -- Fixes-commit: 99ae862a96a569724f49a604ebb7d3f6d2c2d374 Signed-off-by: David Michael <[email protected]>
* core: Add GPG_ERR_SOURCE_TPM2D.Werner Koch2021-03-221-2/+2
| | | | * src/err-sources.h.in (GPG_ERR_SOURCE_TPM2D): New.
* w32: Allow Unicode paths for the gettext domain.Werner Koch2021-03-051-45/+12
| | | | | * src/w32-gettext.c: Remove remaining WindowsCE support (load_domain): Use CreateFileW.
* w32: Minor cleanup of w32-gettextWerner Koch2021-03-042-3/+6
| | | | | | | * src/w32-gettext.c: Include gpgrt.h instead gpg-error.h. (utf8_to_wchar): Use underscored function. (_gpg_w32_textdomain): Ditto. --
* build: Support --disable-threads by gen-lock-obj.sh.NIIBE Yutaka2021-02-181-1/+17
| | | | | | | | | | | * configure.ac: Supply --disable-threads to gen-lock-obj.sh. Tighten the condition of using gen-lock-obj.sh for GNU/Linux. * src/gen-lock-obj.sh: Support --disable-threads. -- GnuPG-bug-id: 5296 Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Fix gpgrt-config.NIIBE Yutaka2021-02-161-6/+1
| | | | | | | | | * src/gpgrt-config.in: Remove delimiter variable. -- Fixes-commit: 7b81ec272b0c54ac893c09be4715b76e84c27b23 Signed-off-by: NIIBE Yutaka <[email protected]>
* build: More fix for determining libdir for gpgrt-config.NIIBE Yutaka2021-02-161-11/+33
| | | | | | | | | | * src/gpg-error.m4: Use CC -print-search-dirs for better support of GNU style cross prefix. -- GnuPG-bug-id: 5293 Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Fix the previous change.NIIBE Yutaka2021-02-151-6/+6
| | | | | | | | | * src/gpg-error.m4: Fix test condition for GPGRT_CONFIG. Fix behaviour when there is no GPG_ERROR_CONFIG. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Improve how to determine $libdir for gpgrt-configNIIBE Yutaka2021-02-121-46/+42
| | | | | | | | | * src/gpg-error.m4: Fix $gpgrt_libdir handling. -- GnuPG-bug-id: 5293 Signed-off-by: NIIBE Yutaka <[email protected]>
* Support cross-compiling on more platforms.NIIBE Yutaka2021-02-091-4/+12
| | | | | | | | | * src/gen-lock-obj.sh (ECHO_C, ECHO_N): Portability fix. -- GnuPG-bug-id: 5289 Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Yet another fix to the ignore meta command.Werner Koch2020-12-211-1/+18
| | | | | * src/argparse.c (_gpgrt_argparse): Entirely skip ignored sysconf commands. Fix state transitions in the ignore case.
* Release 1.40libgpg-error-1.40gpgrt-1.40Werner Koch2020-12-211-1/+2
| | | | * configure.ac: Bump LT version to C31/A31/R0.
* w32: Allow Unicode for internal getusername function.Werner Koch2020-12-211-9/+19
| | | | | | | | | | * src/sysutils.c (_gpgrt_getusername) [W32]: Use GetUserNameW. -- This is used by argparse for user specific parts. Tested using the echo meta-command. Signed-off-by: Werner Koch <[email protected]>
* core: Fix the "ignore" meta command of the argparser.Werner Koch2020-12-181-35/+54
| | | | | | | | | | | | | * src/argparse.c (_gpgrt_argparse): Factor some code out to ... (prepare_arg_return): new. (_gpgrt_argparse): No missing arg error in ignore sections. -- Options in an [ignore] section do not anymore lead to an error if an argument is missing. However, if the option is also in a force section the error is thrown. Signed-off-by: Werner Koch <[email protected]>
* m4: Update with newer autoconf constructs.NIIBE Yutaka2020-11-171-3/+3
| | | | | | * src/gpg-error.m4: Replace AC_HELP_STRING to AS_HELP_STRING. Signed-off-by: NIIBE Yutaka <[email protected]>
* New public function gpgrt_access.Werner Koch2020-10-199-3/+69
| | | | | | | | | | | | | | | | | | | | | | * src/gpg-error.h.in (gpgrt_access): New. * src/gpg-error.vers. src/gpg-error.def.in: Add new function. * src/sysutils.c (any8bitchar): New. (_gpgrt_access): New. * src/visibility.c (gpgrt_access): New. * src/spawn-w32.c (_gpgrt_spawn_process_detached): Use it. * src/argparse.c (try_versioned_conffile): Use it. * tests/t-stringutils.c (check_access): New simple test. -- This is basically a wrapper to allow handling of utf8 encoded file names on Windows. This also fixes the case for versioned config files in directories with non-ascii characters. The new test needs to be run manually on Windows using a directory with Unicode characters. GnuPG-bug-id: 5098
* w32: Support utf8 also for getcwd.Werner Koch2020-10-094-22/+74
| | | | | | | | | | | | * src/sysutils.c (_gpgrt_getcwd) [W32]: Implement utf-8 support. * src/w32-gettext.c (wchar_to_native): Factor some code out to .. (wchar_to_cp): new. (_gpgrt_wchar_to_utf8): New. * tests/t-stringutils.c: Include windows.h. (utf8_to_wchar): New. (wchar_to_utf8): New. (mygetcwd): Use wchar version for Windows. (main): New option --pwd.
* doc: Fix typos in commentsWerner Koch2020-10-081-1/+1
| | | | --
* Release 1.39libgpg-error-1.39gpgrt-1.39Werner Koch2020-08-241-1/+1
|
* core,w32: Add UTF-8 support to gpgrt_fopen, gpgrt_mkdir and gpgrt_chdir.Werner Koch2020-08-216-20/+227
| | | | | | | | | | | | | | | | | | | | * src/protos.h: New. * src/Makefile.am (libgpg_error_la_SOURCES): Add file. * src/gpgrt-int.h: Include protos.h. * src/sysutils.c (_gpgrt_mkdir) [W32]: Make UTF-8 aware. (_gpgrt_chdir) [W32]: Ditto. * src/w32-gettext.c: Include protos.h. (utf8_to_wchar): Allow for strings. (_gpgrt_utf8_to_wchar): New. (_gpgrt_free_wchar): New. * src/estream.c (map_w32_to_errno): Add more error codes. (_gpgrt_w32_set_errno): New. (any8bitchar) [W32]: New helper. (func_file_create) [W32]: Convert file name and use _wopen. -- GnuPG-bug-id: 4083 Signed-off-by: Werner Koch <[email protected]>
* argparse: Handle a corner case of wrong ARGC.NIIBE Yutaka2020-08-211-2/+1
| | | | | | * src/argparse.c (arg_parse): Avoid null dereference when ARGC is wrong. Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix a current gcc's -fsanitize warning.Werner Koch2020-08-171-2/+2
| | | | | | | | * src/argparse.c (ARGPARSE_FLAG__INITIALIZED): Make sure it is an unsigned int. -- GnuPG-bug-id: 5026
* core,w32: Use timeout in es_poll even if there are no FDs.Werner Koch2020-08-111-3/+17
| | | | | | | | | | | | * src/w32-estream.c (_gpgrt_w32_poll): Sleep if there are no handles to wait for. -- This better matches the semantics of poll and select and avoid busy waitins. We had this problem for example in the LDAP helper process reaper of GnuPG's Dirmngr. Signed-off-by: Werner Koch <[email protected]>
* Make --lib-version work again.Werner Koch2020-08-051-3/+36
| | | | | | | | | | | * src/gpg-error.c (main): Add printing code. -- This was lost while changing to the included option parser back in 2018. The new code also does some prettying of the output. Fixes-commit: 11ce9bc3d6fe75859e18112824ae7ec3ca0fc8df Signed-off-by: Werner Koch <[email protected]>
* gpgrt-config: Fix handling 'Requires' field.NIIBE Yutaka2020-08-031-6/+11
| | | | | | | | | | * src/gpgrt-config.in (get_attr_l): New. (all_required_config_files): Use get_attr_l. -- GnuPG-bug-id: 5010 Signed-off-by: NIIBE Yutaka <[email protected]>
* w32: Add gpgrt_fcancel to the definition.NIIBE Yutaka2020-07-151-0/+2
| | | | | | | * src/gpg-error.def.in (gpgrt_fcancel): Add. Fixes-commit: 3413489d25577e3fe7f529b8e610a45d2bd1857c Signed-off-by: NIIBE Yutaka <[email protected]>
* estream: Add gpgrt_fcancelWerner Koch2020-06-267-9/+44
| | | | | | | | | | | | * src/estream.c (do_close): Add arg 'cancel_mode' and chnage all callers. (_gpgrt_fcancel): New. * src/gpg-error.def.in, src/gpg-error.vers: Add function. * src/visibility.c (gpgrt_fcancel): New. * src/gpg-error.h.in (gpgrt_fcancel): New. -- Signed-off-by: Werner Koch <[email protected]>
* build: Fix the gpg-error-config test for cross build.NIIBE Yutaka2020-06-151-0/+2
| | | | | | | * src/gpg-error-config-test.sh.in: Clear PKG_CONFIG_SYSROOT_DIR. GnuPG-bug-id: 4973 Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Fix cross-compiling into a separate build dir.David Michael2020-06-031-1/+1
| | | | | | | | | * configure.ac: Create the src directory before writing into it. * src/Makefile.am (EXTRA_DIST): Add gen-lock-obj.sh. -- Signed-off-by: David Michael <[email protected]>
* syscfg: add 64-bit big-endian MIPS architecturedkg/fix-4952Daniel Kahn Gillmor2020-05-192-0/+26
| | | | | | | | | | | | | * src/syscfg/lock-obj-pub.mips64-unknown-linux-gnuabi64.h: new. * src/Makefile.am (lock_obj_pub): Add it. -- This information was dervied and reported by YunQiang Su <[email protected]>. GnuPG-bug-id: 4952 Debian-bug-id: 960161 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* build: Use gen-lock-obj.sh script when possible.NIIBE Yutaka2020-04-091-0/+7
| | | | | | | | | | | | | * configure.ac (HAVE_GENERATED_LOCK_OBJ_H): New. * src/Makefile.am: Support HAVE_GENERATED_LOCK_OBJ_H. -- For cross build, when possible (currently for GNU/Linux), generate lock-obj-pub.native.h by the script. GnuPG-bug-id: 4774 Signed-off-by: NIIBE Yutaka <[email protected]>
* build: Add a shell script to generate lock-obj-pub.h.NIIBE Yutaka2020-04-091-0/+112
| | | | | | * src/gen-lock-obj.sh: New. Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Improve the echo and info meta commands of the arg parserWerner Koch2020-04-031-9/+74
| | | | | | | | | | | * src/argparse.c (handle_meta_echo): Substitue some vars. (handle_meta_user): Factor some code out to ... (assure_username): new. -- Yeah, that is not really needed but might sometimes be helpful. Signed-off-by: Werner Koch <[email protected]>
* core: Implement meta command [user] also for WindowsWerner Koch2020-04-032-2/+21
| | | | | | | | | | * src/argparse.c (initialize): Clear username. * src/sysutils.c (_gpgrt_getusername): Implement for Windows. -- This also fixes a missing intialization Signed-off-by: Werner Koch <[email protected]>
* core: Implement meta command [user] for the arg parser.Werner Koch2020-04-033-25/+106
| | | | | | | | | | | | | | | | | | | | * src/sysutils.c (_gpgrt_getusername): New. * src/argparse.c (struct _gpgrt_argparse_internal_s): New flags user_* and store the current user. (initialize): Free new malloced field. Clear new flags. (handle_meta_user): Implement. (handle_metacmd): Implement user sections. Remove "group" meta command. (_gpgrt_argparse): Implement user sections. (finish_read_sys): Reset new vars. -- Implementing group would be somewhat complicated and it is doubtful whether this really makes sense and is manageable for the admin. Note that we have not yet implemented this for Windows. Signed-off-by: Werner Koch <[email protected]>
* core: Tweak the printing of headers in the --help output.Werner Koch2020-03-062-8/+19
| | | | | | | * src/argparse.c (show_help): Do not print empty sections between headers. Signed-off-by: Werner Koch <[email protected]>
* core: Add features for pretty printing the helpWerner Koch2020-03-062-7/+35
| | | | | | | | | | | | | | | | | | | | * src/gpg-error.h.in (ARGPARSE_OPT_HEADER): New. (ARGPARSE_OPT_VERBATIM): New. (ARGPARSE_verbatim): New. (ARGPARSE_header): New. * src/argparse.c (show_help): Implement them. -- These two macros are useful for custom help screens. In contrast to the ARGPARSE_group hack they do not need a short option number (we use 1 here as a surrogate) and not the "@" hack. Thus already translated strings can be used. ARGPARSE_header further allows to specify a symbolic name for the group and does some minor formatting. If such a symbolic name is given --dump-option-table also emits this as a pseudo option for consumption by GUIs which for example use tabs to group options. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgrt_reallocarray.Werner Koch2020-03-037-0/+63
| | | | | | | | | | | | | | | | | * src/init.c (_gpgrt_reallocarray): New. * src/visibility.c (gpgrt_reallocarray): New. * src/gpg-error.vers, src/gpg-error.def.in: Add new function. * src/gpg-error.h.in: Add new interface. * tests/t-malloc.c: New. * tests/Makefile.am (TESTS): Add new test. -- Note that this function is different from the glibc function because it has an extra parameter which allows to clear the new elements. A realloc after a calloc with forgotten memset after it is a common source of error, thus we introduce this slightly different function. Signed-off-by: Werner Koch <[email protected]>
* core: Fix allocation bug introduced with last commit.Werner Koch2020-03-031-1/+3
| | | | | | | | | | * src/argparse.c (initialize): Increase number of extra slots. -- I should really buy the valgrind authors a beer. Fixes-commit: db95feab16e32309a4bfb382827c495c2c49920c Signed-off-by: Werner Koch <[email protected]>
* core: New internal option --dump-option-table for argparser.Werner Koch2020-03-021-3/+85
| | | | | | | | | | | | * src/argparse.c (initialize): Add new internal option. (arg_parse): Implement that option. (dump_option_table): New. (show_help): Remove exit and let the caller call my_exit. -- This options allows us to get a copy of the option table. Signed-off-by: Werner Koch <[email protected]>
* core: Replace fputs by es_fputs in argparser.Werner Koch2020-03-021-1/+1
| | | | | | | * src/argparse.c (writestrings): Use that function to match what we are doing in flushstrings. Signed-off-by: Werner Koch <[email protected]>
* core: Allow returning of attributes from gpgrt_argparser.Werner Koch2020-03-022-20/+60
| | | | | | | | | | | | | | | | | | * src/gpg-error.h.in (ARGPARSE_FLAG_WITHATTR): New. (ARGPARSE_ATTR_FORCE): New. (ARGPARSE_ATTR_IGNORE): New. (ARGPARSE_TYPE_MASK): Moved from argparse.c to here. * src/argparse.c: Always use macros for constants. (_gpgrt_argparse): Handle ARGPARSE_FLAG_WITHATTR. (arg_parse): Ditto. * tests/t-argparse.c (main): Add commented test case. -- This is a ABI compatible hack to allow the ignore and force attributes as well as to return which option has been ignored in a user file or on the command line. Signed-off-by: Werner Koch <[email protected]>
* core: Implement meta commands for the argparser.Werner Koch2020-02-271-68/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/argparse.c (opttable_t): Add new flags forced, ignore, and explicit_ignore. (struct _gpgrt_argparse_internal_s): Change flags to bitflags. Add several flags to support meta commands. (initialize): Clear them. (handle_meta_user): Use the new verbose flag. (handle_meta_force): Implement. (handle_meta_ignore): Implement. (handle_meta_echo): Support "-echo". (handle_meta_verbose): New. (handle_metacmd): New meta command verbose. Add always flag and move the detection of unexpected meta commands to here. (_gpgrt_argparse): Make use of the ignore and forced meta commands. (finish_read_sys): New. (_gpgrt_argparser): Support the verbose flag. Call finish_read_sys. (arg_parse): Ignore non-explicit ignored and all forced options. * tests/t-argparse.c (main): Fix printing of the ARGPARSE_CONFFILE case. New option 'M'. * tests/t-argparse.conf, tests/etc/t-argparse.conf: Various changes to test the new meta commands. -- For the command line we print a diagnostic if an ignored or forced options is used. However, we do not ignore options which are only set via [ignore-all]. The rationale for the latter is that an administrator can't be be required to unignore all options used by all modes, of say gpgme. Documentation of the meta commands will for now be added to GnuPG. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <[email protected]>
* indent: Fix indentation in an argparse.c functionWerner Koch2020-02-271-85/+85
| | | | * src/argparse.c (arg_parse): Fix it here.