| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
--
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* configure.ac (INSTALL_GPG_ERROR_CONFIG): New.
* src/Makefile.am (bin_SCRIPTS, noinst_SCRIPTS): Conditionalize.
--
GnuPG-bug-id: 5683
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
| |
--
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/sysutils.c (any8bitchar): Remove.
(_gpgrt_fname_to_wchar): New.
(_gpgrt_mkdir): Use instead of plain utf8 conversion.
(_gpgrt_access): Reimplement using GetFileAttributesW so that long
files names are supported.
* src/estream.c (_gpgrt_w32_get_last_err_code): New.
(func_file_create_w32): New.
(_gpgrt_fopen): Handle the "sysopen" mode flag. Support mapping of
/dev/null.
(_gpgrt_freopen): Support mapping of /dev/null.
* src/w32-gettext.c (load_domain): Allow long file names.
* src/visibility.c (gpgrt_free_wchar): Make function public.
(gpgrt_fname_to_wchar): Ditto.
(gpgrt_utf8_to_wchar): Ditto.
(gpgrt_wchar_to_utf8): Ditto.
* src/w32-add.h (gpgrt_free_wchar): New prototype.
(gpgrt_fname_to_wchar): Ditto.
(gpgrt_utf8_to_wchar): Ditto.
(gpgrt_wchar_to_utf8): Ditto.
* src/gpg-error.def.in: Add them here too.
|
|
|
|
| |
--
|
|
|
|
| |
* configure.ac: Bump LT version to C32/A32/R2.
|
|
|
|
| |
--
|
| |
|
|
|
|
| |
--
|
| |
|
|
|
|
| |
* src/err-sources.h.in (GPG_ERR_SOURCE_TPM2D): New.
|
|
|
|
|
|
|
| |
--
The new inline function gpg_err_code_from_sqlite was missing in the
NEWS file.
|
|
|
|
| |
--
|
| |
|
|
|
|
| |
--
|
|
|
|
| |
* configure.ac: Bump LT version to C31/A31/R0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
| |
--
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 <wk@gnupg.org>
|
|
|
|
| |
--
|
| |
|
|
|
|
|
|
|
| |
* src/argparse.c (show_help): Do not print empty sections between
headers.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (ARGPARSE_INVALID_META): New
(ARGPARSE_UNKNOWN_META, ARGPARSE_UNEXPECTED_META): New.
* src/argparse.c (struct _gpgrt_argparse_internal_s): Add flag
insysconfig.
(initialize): Init flag. Add error strings.
(_gpgrt_argparser): Set that flag.
(_gpgrt_argparse): Add parsing of meta commands.
* tests/etc/t-argparse.conf: Add some test cases.
* tests/t-argparse.conf: Ditto.
* tests/t-argparse.c (main): Die only after printing all warnings.
--
Noe that this is just the framework to add meta commands to the global
config file. We also need to get away from fixes test config files
and create them on the fly to that we are able to test also errors.
GnuPG-bug-id: 4788
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (ARGPARSE_FLAG_USERVERS): New.
* src/argparse.c: Include unistd.h.
(try_versioned_conffile): New.
(_gpgrt_argparser): Use it.
--
This is neded to bring the versioned config files back to gpg.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (ARGPARSE_PERMISSION_ERROR): New.
* src/argparse.c (initialize): Add code to print this error.
--
We need this option to reject certain config files if we detect a
permission problem.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gpg-error.h.in (GPGRT_CONFDIR_USER, GPGRT_CONFDIR_SYS): New consts.
(ARGPARSE_FLAG_SYS, ARGPARSE_FLAG_USER, ARGPARSE_FLAG_VERBOSE)
(ARGPARSE_NO_CONFFILE, ARGPARSE_CONFFILE, ARGPARSE_OPT_CONFFILE): New
consts.
(ARGPARSE_conffile, ARGPARSE_noconffile): New macros.
(gpgrt_set_confdir): New func.
(gpgrt_argparser): New func.
* src/argparse.c (confdir): New var.
(enum argparser_states): New.
(struct _gpgrt_argparse_internal_s): Add a couple of new fields.
(initialize): Init them.
(any_opt_conffile): New.
(_gpgrt_argparser): New.
(_gpgrt_set_confdir): New.
* src/visibility.c (gpgrt_argparser): New.
(gpgrt_set_confdir): New.
* src/gpg-error.def.in, src/gpg-error.vers: Add those functions.
* tests/t-argparse.c (main): Reworked.
* tests/etc/t-argparse.conf: New file.
* tests/t-argparse.conf: New file.
--
gpgrt_argparser is a high level version of gpgrt_argparse. It handles
reading of configuration files internally and allows allows for a
global configuration file. The design is so that it minimizes the
work to replace the existing option parsing in gpg and friends by this
one and to allow global configuration files for them.
This is the just the basic code which should allow replacement of the
parsers. A forthcoming patch will implement flags for options given
in the global config file.
GnuPG-bug-id: 4788
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_fnameconcat): New.
(gpgrt_absfnameconcat): New.
* src/visibility.c (gpgrt_fnameconcat, gpgrt_absfnameconcat): New.
* src/stringutils.c: New file.
(_gpgrt_vfnameconcat): New.
(_gpgrt_fnameconcat, _gpgrt_absfnameconcat): New.
* src/gpg-error.def.in: Add new functions.
* src/gpg-error.vers: Ditto.
* src/sysutils.c: Include pwd.h.
(_gpgrt_getpwdir): New.
* configure.ac: Test for pwd.h, getpwnam, getpwuid, and their _r
variants.
* src/Makefile.am (libgpg_error_la_SOURCES): Add new file.
* tests/t-stringutils.c: New.
* tests/t-common.h (xmalloc, xstrdup, xfree): New.
(die): Kludge to avoid compiler warnings.
--
The new functions are based on the code of make_filename from GnuPG.
They have been written by me ages ago with only minor modifications by
David Shaw. I re-license them from LGPL-3.0+ OR GPL-2.0+ to
LGPL-2.1-or-later.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
| |
--
|
| |
|
|
|
|
|
|
|
| |
* src/err-codes.h.in: Add GPG_ERR_SQL_ codes.
* src/gpg-error.h.in (gpg_err_code_from_sqlite): New.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
| |
--
|
|
|
|
|
|
| |
* configure.ac: Bump LT version to C27/A27/R0.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
| |
--
In particular for PIV cards ithe use of BAD_PIN sounds worong, thus
we now use dedicated codes.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
| |
--
|
|
|
|
|
|
|
|
|
|
|
|
| |
--
Because gpgrt-config is not anymore generated from gpgrt-config.in and
a stale (generated) gpgrt-config was hanging around in the build
directory the make distcheck target didn't caught this situation and
we accidently distributed the old gpgrt-config from the build
directory.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
| |
--
|
|
|
|
|
|
| |
* configure.ac: Bump LT version to C26/A26/R0.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/init.c (emergency_cleanup_list): New gloabl var.
(_gpgrt_add_emergency_cleanup): New.
(_gpgrt_abort): New. Repalce all calls to abort by this. Also replace
all assert by either log_assert or a stderr output followed by a
_gpgrt_abort.
(run_emergency_cleanup): New.
* src/visibility.c (gpgrt_add_emergency_cleanup): New public API.
(gpgrt_abort): New public API.
--
Libgcrypt uses its own assert function which makes sure to terminate
the secure memory. This is safe as log as an assert is triggered
internally in Libgcrypt. GnuPG runs emergency cleanup handlers right
before log_fatal etc to tell Libgcrypt to terminate the secure memory.
With the move of the logging function to gpgrt in gnupg 2.3 this did
not anymore. Thus we now provide a mechanism in gpgrt to do right
that. Eventually Libgcrypt can also make use of this.
What this does not handle are calls to abort or failed asserts in
external libraries or in libc. We can't do anything about it in a
library because a library may not setup signal handlers.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
| |
--
|
|
|
|
|
|
|
| |
* configure.ac: Set LT version to C25/A25/R0.
GnuPG-bug-id: 4205
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_string_filter_t): New type.
(gpgrt_fprintf_sf, gpgrt_fprintf_sf_unlocked): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add them.
* src/visibility.c (gpgrt_fprintf_sf): New.
(gpgrt_fprintf_sf_unlocked): New.
* src/estream-printf.c (pr_string): Add and use args sf, sfvalue and
string_no.
(do_format): Add args sf and sfvalue. Keep a string format counter.
(_gpgrt_estream_format): Add args sf and sfvalue. Change all callers
to provide NULL for them.
* src/estream.c (_gpgrt_vfprintf_unlocked, _gpgrt_vfprintf): Add sf
and sfvalue and adjust all callers.
(do_print_stream): Ditto.
* tests/t-printf.c (stream_to_string): New.
(struct sfstate_s): New.
(string_filter): New.
(check_fprintf_sf): New.
(main): Call new test.
--
The actual reason to implement these functions is to enhance the
internal logging function with a filter to sanitized strings so that
control values or other things can be quoted.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in: New API gpgrt_cmp_version.
* src/visibility.c (gpgrt_cmp_version): New wrapper.
* src/version.c (parse_version_string): Revamped.
(do_cmp_version): New.
(_gpgrt_cmp_version): New.
(_gpg_error_check_version): Re-implemented using the new func.
* tests/t-version.c: Include t-common.h.
(t_gpgrt_cmp_version): New test.
(main): Run new test. Change test for new version number to require a
2 level number.
--
We have implementations of very similar functions in all out libs.
Thus it makes sense to provide a generic version. This version is
actually derived from the ftp-indexer.c we use for the gnupg
website (see the gnupg-doc repo).
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
| |
--
|