| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure.ac (AC_FUNC_FORK): No use.
* src/gpg-error.h.in (@define:gpgrt_process_t@): New.
(@define:pid_t@): Remove.
(gpgrt_spawn_process, gpgrt_spawn_process_fd): Use gpgrt_process_t.
(gpgrt_wait_process, gpgrt_wait_processes): Likewise.
(gpgrt_kill_process, gpgrt_release_process): Likewise.
* src/gpgrt-int.h (_gpgrt_spawn_process): Likewise.
(_gpgrt_spawn_process_fd): Likewise.
(_gpgrt_wait_process, _gpgrt_wait_processes): Likewise.
(_gpgrt_kill_process, _gpgrt_release_process): Likewise.
* src/mkheader.c (write_special): Handle @define:gpgrt_process_t@.
Remove handling of @define:pid_t@.
* src/spawn-posix.c (_gpgrt_spawn_process): Use gpgrt_process_t.
(_gpgrt_spawn_process_fd): Likewise.
(_gpgrt_wait_process, _gpgrt_wait_processes): Likewise.
(_gpgrt_kill_process, _gpgrt_release_process): Likewise.
* src/spawn-w32.c (_gpgrt_spawn_process): Use gpgrt_process_t.
(_gpgrt_spawn_process_fd): Likewise.
(_gpgrt_wait_process, _gpgrt_wait_processes): Likewise.
(_gpgrt_kill_process, _gpgrt_release_process): Likewise.
--
GnuPG-bug-id: 6249
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.def.in (gpgrt_close_all_fds): New.
* src/gpg-error.vers (gpgrt_close_all_fds): New.
* src/gpg-error.h.in (GPGRT_SPAWN_INHERIT_FILE): New.
(gpgrt_spawn_process_fd): SPAWN_CB having return value.
* src/gpgrt-int.h (_gpgrt_spawn_process_fd): SPAWN_CB change.
* src/spawn-posix.c (_gpgrt_close_all_fds): Rename from close_all_fds,
and export it.
(do_exec): Support the case not closing fds.
(_gpgrt_spawn_process_fd): Handle return value of SPAWN_CB to
determine closing all fds or not.
* src/spawn-w32.c (_gpgrt_spawn_process_fd): Run SPAWN_CB.
(_gpgrt_close_all_fds): New.
* src/visibility.c (gpgrt_close_all_fds): New.
* src/visibility.h (gpgrt_close_all_fds): New.
--
Now, we have the API of gpgrt_spawn_process_fd for POSIX and Windows.
Giving portable semantics for spawning a process is difficult, and it
is still difficult for users to writing a function for SPAWN_CB with
portability, but gpgrt_spawn_process_fd gives the feature of spawning
a process.
GnuPG-bug-id: 6249
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
| |
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_spawn_process): Remove PREEXEC argument.
(gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG.
* src/gpgrt-int.h (_gpgrt_spawn_process): Remove PREEXEC argument.
(_gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG.
* src/spawn-posix.c (do_exec): Remove PREEXEC argument.
(_gpgrt_spawn_process): Remove PREEXEC argument.
(_gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG.
(_gpgrt_spawn_process_detached): Follow the change of do_exec.
* src/spawn-w32.c (_gpgrt_spawn_process): Remove PREEXEC argument.
(_gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG.
* src/visibility.c (gpgrt_spawn_process): Remove PREEXEC argument.
(gpgrt_spawn_process_fd): Add AFTER_FORK_CB and AFTER_FORK_CB_ARG.
--
GnuPG-bug-id: 6249
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (GPGRT_SPAWN_KEEP_STDIN): New.
(GPGRT_SPAWN_KEEP_STDOUT, GPGRT_SPAWN_KEEP_STDERR): New.
* src/gpgrt-int.h: Add comment.
* src/spawn-posix.c (do_exec): Add the argument FLAGS.
(_gpgrt_spawn_process): Add FLAGS.
(_gpgrt_spawn_process_fd): Follow the change.
(_gpgrt_spawn_process_detached): Likewise.
* src/spawn-w32.c (_gpgrt_spawn_process): Handle FLAGS.
--
This commit imports GnuPG master commit of:
6d6438a361d25f3b269f702e017f5e39fd1f5c38
GnuPG-bug-id: 6249
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
| |
* src/gpgrt-int.h: Remove extra.
* src/visibility.h: Likewise.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* contrib/*: Remove.
* Makefile.am: Remove contrib.
* autogen.sh: Remove Windows CE support.
* configure.ac (have_w32ce_system): Remove.
* src/Makefile.am [HAVE_W32CE_SYSTEM] (extra_cppflags): Remove.
(gpg_extra_headers): Remove.
(EXTRA_DIST): Remove mkw32errmap.c and w32ce-add.h
(BUILT_SOURCES): Remove mkw32errmap.map.c.
(tmp_files): Remove mkw32errmap.tab.h mkw32errmap.map.c
(CLEANFILES): Likewise.
* src/estream-printf.c [HAVE_W32CE_SYSTEM]: Remove.
* src/estream.c [HAVE_W32CE_SYSTEM]: Remove.
* src/gpg-error.def.in [HAVE_W32CE_SYSTEM]: Remove.
* src/gpgrt-int.h: Fix comment.
* src/init.c [HAVE_W32CE_SYSTEM]: Remove.
* src/init.h [HAVE_W32CE_SYSTEM]: Remove.
* src/mkheader.c: Remove Windows CE support.
* src/mkw32errmap.c, src/w32ce-add.h: Remove.
* src/spawn-posix.c [HAVE_W32CE_SYSTEM]: Remove.
* src/spawn-w32.c [HAVE_W32CE_SYSTEM]: Remove.
* src/sysutils.c [HAVE_W32CE_SYSTEM]: Remove.
* src/w32-estream.c [HAVE_W32CE_SYSTEM]: Remove.
* src/w32-reg.c [HAVE_W32CE_SYSTEM]: Remove.
* tests/Makefile.am [HAVE_W32CE_SYSTEM]: Remove.
--
GnuPG-bug-id: 5912
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/mkheader.c (write_special): Support @SOCKET_t@ substitution.
* src/gpgrt-int.h (gpgrt_stream_backend_kind_t): Add BACKEND_SOCK.
* src/gpg-error.h.in (struct _gpgrt_syshd): Use @SOCKET_t@.
* src/estream.c [HAVE_W32_SYSTEM] (estream_cookie_sock_t): New.
[HAVE_W32_SYSTEM] (func_sock_create, func_sock_read): New.
[HAVE_W32_SYSTEM] (func_sock_write, func_sock_seek): New.
[HAVE_W32_SYSTEM] (func_sock_destroy, func_sock_ioctl): New.
[HAVE_W32_SYSTEM] (estream_functions_sock, do_sockopen): New.
[HAVE_W32_SYSTEM] (do_sysopen): Call do_sockopen.
--
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.
|
|
|
|
|
|
|
|
|
|
| |
* src/w32-reg.c (_gpgrt_w32_reg_query_string): Allow abbreviated root
names.
(_gpgrt_w32_reg_get_string): New.
--
This should eventually be made public. Noet that we have a copy in
gnupg.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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/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 <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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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/gpgrt-int.h (struct _gpgrt_b64state): Use unsigned for bit flags.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
| |
* src/gpgrt-int.h (BUFFER_BLOCK_SIZE) [W32]: Increase from 512 to 8k.
* src/w32-estream.c (READBUF_SIZE, WRITEBUF_SIZE): Increase from 4k to
8k.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
| |
* src/gpgrt-int.h (_gpgrt_functions_w32_pollable): Declare with extern
so that strict toolchains don't get confused.
--
GnuPG-bug-id: 4356
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>
|
|
|
|
|
|
|
|
| |
* src/gpgrt-int.h: First undef snprintf.
--
GnuPG-bug-id: 4285
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 (gpgrt_ftruncate, es_ftruncate): New.
* src/gpg-error.def.in, src/gpg-error.vers: Add gpgrt_ftruncate.
* src/visibility.c (gpgrt_ftruncate): new.
* src/gpgrt-int.h (COOKIE_IOCTL_TRUNCATE): New.
* src/estream.c (func_mem_ioctl): Support new internal IOCTL.
(_gpgrt_ftruncate): New.
--
Right now the ftruncate works only on memory streams. Can easily be
added to other stream times.
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/b64enc.c: Change to fit into libgpg-error.
* src/Makefile.am: Add b64enc.c
* src/b64dec.c: Use xtrymalloc etc. Always use gpg_err_code_t.
(_gpgrt_b64dec_start): Set decoder flag
(_gpgrt_b64dec_finish): Check for conflict.
(_gpgrt_b64state): Move to ...
* src/gpgrt-int.h: here. Add new fields.
* src/visibility.c (gpgrt_b64enc_start): New.
(gpgrt_b64enc_write): New.
(gpgrt_b64enc_finish): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add new functions.
* src/gpg-error.h.in: Ditto.
* src/visibility.h: Ditto.
* tests/t-b64dec.c: Remove.
* tests/t-b64.c: New.
* tests/Makefile.am (TESTS): Replace t-b64dec by t-b64.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_usage): New.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_argparse): New.
(gpgrt_strusage): New.
(gpgrt_set_strusage): New.
(gpgrt_set_usage_outfnc): New.
(gpgrt_set_fixed_string_mapper): New.
* src/gpg-error.def.in, src/gpg-error.vers: Add new functions.
* src/gpg-error.h.in: Add ARGPARSE macros from the former argparse.h.
(gpgrt_argparse_t): New.
(gpgrt_opt_t): New.
* configure.ac (AH_BOTTOM): Request argparse macros.
* src/Makefile.am (libgpg_error_la_SOURCES): Add argparse.c.
* src/argparse.h: Remove.
* src/argparse.c: Revamp to fit into libgpg-error.
(_gpgrt_argparse): New.
(_gpgrt_usage): Rename from usage.
(_gpgrt_strusage): Rename from strusage. Define two new levels and
templates for three common licenses.
(_gpgrt_set_strusage): Rename from set_strusage.
(_gpgrt_set_usage_outfnc): New.
(_gpgrt_set_fixed_string_mapper): New.
* tests/t-argparse.c: New.
--
These functions are in use by GnuPG and other software for 20 years
and it makes sense to have them always available instead of copying
and maintaing the source in several projects. Note that there are
minor changes in the API compared to GnuPG.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/estream.c (_gpgrt_set_syscall_clamp)
(_gpgrt_get_syscall_clamp): Move to ...
* src/syscall-clamp.c: new file.
(_gpgrt_pre_syscall, _gpgrt_post_syscall): New.
* src/Makefile.am (libgpg_error_la_SOURCES): Add that file.
* src/estream.c: Replace the syscall wrapper with the new functions.
* src/posix-lock.c: Ditto.
* src/w32-lock.c: Ditto.
* src/posix-thread.c: Ditto.
* src/w32-thread.c: Ditto.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (GPGRT_SPAWN_NONBLOCK): New const.
(GPGRT_SPAWN_RUN_ASFW): New const.
(GPGRT_SPAWN_DETACHED): New const.
(gpgrt_make_pipe): New function.
(gpgrt_create_pipe): New macro.
(gpgrt_create_inbound_pipe): New macro.
(gpgrt_create_outbound_pipe): New macro.
(gpgrt_spawn_process): New function.
(gpgrt_spawn_process_fd): New function.
(gpgrt_spawn_process_detached): New function.
(gpgrt_wait_process): New function.
(gpgrt_wait_processes): New function.
(gpgrt_kill_process): New function.
(gpgrt_release_process): New function.
* src/gpg-error.def.in, src/gpg-error.vers: Add new functions.
* src/visibility.c, src/visibility.h: Add wrappers for new functions.
* src/spawn-posix.c: Rework to better fit the use in gpgrt. Rename
all public function with a _gpgrt prefix.
* src/spawn-w32.c: Ditto.
* src/gpgrt-int.h: Likewise.
* src/Makefile.am (arch_sources): Add spawn-posix.c and spawn-w32.c.
* src/w32-add.h: Add pid_t typedef as a temporary hack.
* configure.ac: Check for signal.h and getrlimit.
(AC_FUNC_FORK): New.
--
This does build but porting the tests and further changes are
required. Don't assume that the API for the new fucntions is stable.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/spawn-posix.c: New. Taken from GnuPG's exechelp-posix.c.
* src/spawn-w32.c: New. Taken from GnuPG's exechelp-w32.c.
* src/gpgrt-int.h: Include prototypes from GnuPG's exechelp.h.
--
The original files were under (LGPL-3.0+ OR GPL-2.0+) and have
entirely been written by g10 Code employees. Being the responsible
person at g10 Code, I endorse the license change to LGPL-2.1.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_sentenv, gpgrt_mkdir, gpgrt_chdir): Change
return type to gpg_err_code_t.
* src/sysutils.c (_gpgrt_setenv): Implement that.
(_gpgrt_mkdir): Ditto.
(_gpgrt_chdir): Ditto.
* gpgscm/ffi.c (do_setenv, do_mkdir): Adjust for this change.
--
The functions are already a bit different and thus it is useful to let
them return a gpg-error style error code and don't let the user
implement that for each call.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_mkdir, gpgrt_chdir, gpgrt_getcwd): New.
* src/visibility.c, src/visibility.h: Add wrappers.
* src/gpg-error.vers, src/gpg-error.def.in: Add them.
* src/sysutils.c (modestr_to_mode): New.
(_gpgrt_mkdir, _gpgrt_chdir, _gpgrt_getcwd): New.
* m4/gnupg-misc.m4: New.
* m4/Makefile.am (EXTRA_DIST): Add new M4 file.
* configure.ac: Call new GNUPG_FUNC_MKDIR_TAKES_ONE_ARG.
(AC_CHECK_FUNCS): Add stat.
--
The code has been taken from GnuPG. _gpgrt_mkdir was originally
written by me as gnupg_mkdir and here relicensed to LGPLv2.1+.
_gpgrt_getcwd was originally written by in 2007 and also here
relicensed to LGPLv2.1. The new M4 macro was also written by me for
use in in GnuPG; it has been taken from GnUPG's acinclude.m4, moved to
its own file here, and relicensed to FSFULLR.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpg-error.h.in (gpgrt_getenv, gpgrt_setenv): New.
(gpgrt_unsetenv): New macro.
* src/gpg-error.vers, src/gpg-error.def.in: Add them.
* src/visibility.c (gpgrt_getenv, gpgrt_setenv): New.
* src/visibility.h: Add them.
* src/sysutils.c: Include string.h and on Windows windows.h.
(_gpgrt_getenv): New.
(_gpgrt_setenv): New.
--
These functions are wrappers to cope with Windows problems. The code
is similar to what we have in GnuPG but not identical.
Requires better testing.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/w32-reg.c: New.
* src/w32-add.h: Add gpgrt_w32_reg_query_string.
* src/visibility.c (gpgrt_w32_reg_query_string): New wrapper.
* src/gpg-error.def.in: Add gpgrt_w32_reg_query_string.
* configure.ac (ac_check_funcs): Add stpcpy.
* src/Makefile.am (arch_sources): Add w32-reg.c
(socklibs): New.
(libgpg_error_la_LIBADD): Add socklibs.
* src/gpgrt-int.h (xfree, xtrymalloc, xtrycalloc)
(xtryrealloc): New internal macros.
(_gpgrt_stpcpy, stpcpy): New replacement fucntion and macro.
* src/logging.c (_gpgrt_logv_internal): Use new registry query
function and add standard registry key.
--
This also fixes the build failure on Widnwos for logging.c.
The code for gpgrt_w32_reg_query_string has been taken from the
function read_w32_registry_string in w32-utils.c in the GPGME package.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_strdup): New API fucntion.
(gpgrt_strconcat): New API fucntion.
* src/visibility.h: Add corresponding macros.
* src/gpg-error.def.in: Add them.
* src/gpg-error.vers: Add them.
* src/gpgrt-int.h (DIM): New macro.
* src/init.c (_gpgrt_strdup): New.
(_gpgrt_strconcat_core): New.
(_gpgrt_strconcat): New.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_realloc): New API function.
(gpgrt_malloc): New API function.
(gpgrt_calloc): New API function.
* src/visibility.h: Add corresponding macros.
* src/gpg-error.def.in: Add them.
* src/gpg-error.vers: Add them.
* src/init.c (_gpgrt_calloc): New.
* src/gpg-error.h.in: Add prototypes.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_get_errorcount): New API.
(gpgrt_inc_errorcount): New API.
(gpgrt_log_set_sink): New API.
(gpgrt_log_set_socket_dir_cb): New API.
(gpgrt_log_set_pid_suffix_cb): New API.
(gpgrt_log_set_prefix): New API.
(gpgrt_log_get_prefix): New API.
(gpgrt_log_test_fd): New API.
(gpgrt_log_get_fd): New API.
(gpgrt_log_get_stream): New API.
(gpgrt_log): New API.
(gpgrt_logv): New API.
(gpgrt_logv_prefix): New API.
(gpgrt_log_string): New API.
(gpgrt_log_info): New API.
(gpgrt_log_error): New API.
(gpgrt_log_fatal): New API.
(gpgrt_log_bug): New API.
(gpgrt_log_debug): New API.
(gpgrt_log_debug_string): New API.
(gpgrt_log_printf): New API.
(gpgrt_log_flush): New API.
(gpgrt_log_printhex): New API.
(gpgrt_log_clock): New API.
(_gpgrt_log_assert): New function for the ABI.
* src/visibility.h: Add corresponding macros.
* src/gpg-error.def.in: Add new functions.
* src/gpg-error.vers: Add new functions.
* src/gpg-error.h.in (GPGRT_LOG_WITH_PREFIX): New constant.
(GPGRT_LOG_WITH_TIME): New constant.
(GPGRT_LOG_WITH_PID): New constant.
(GPGRT_LOG_RUN_DETACHED): New constant.
(GPGRT_LOG_NO_REGISTRY): New constant.
(GPGRT_LOG_BEGIN): New enum value.
(GPGRT_LOG_CONT): New enum value.
(GPGRT_LOG_INFO): New enum value.
(GPGRT_LOG_WARN): New enum value.
(GPGRT_LOG_ERROR): New enum value.
(GPGRT_LOG_FATAL): New enum value.
(GPGRT_LOG_BUG): New enum value.
(GPGRT_LOG_DEBUG): New enum value.
(log_get_errorcount, log_inc_errorcount, log_set_file, log_set_fd)
(log_set_stream, log_set_socket_dir_cb, log_set_pid_suffix_cb)
(log_set_prefix, log_get_prefix, log_test_fd, log_get_fd)
(log_get_stream, log_log, log_logv, log_logv_prefix, log_string)
(log_bug, log_fatal, log_error, log_info, log_debug, log_debug_string)
(log_printf, log_printhex, log_clock)
(log_flush) [GPGRT_ENABLE_LOG_MACROS]: New wrapper macros.
(gpgrt_assert): New macro.
* src/gpgrt-int.h: Add prototypes for logging.c.
(gpgrt_assert): Redefine for internal use.
* src/logging.h: Remove.
* src/logging.c: Include gpgrt-int.h instead of the stuff from GnuPG.
Use _gpgrt malloc funcsions and the internal versions of the estream
functions. Rename all public fucntions with a _gpgrt_ prefix.
(print_prefix): Return the printed length.
(_gpgrt_logv_internal): Ditto.
(_gpgrt_log_printhex): Change order of args and turn into a printf
like function.
(_gpgrt_logv_printhex): New. Take the core of the former
log_printhex.
(_gpgrt_log_clock): Turn into a printf like functions.
(_gpgrt_logv_clock): New. Take the core of the former log_clock.
--
This logging API is a slightly modified version of what we are using
in GnuPG.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure.ac: Add option --enable-log-clock.
* configure.ac: Add option --enable-werror.
* src/sysutils.c: New.
* src/Makefile.am (libgpg_error_la_SOURCES): Add sysutils.c
* src/gpgrt-int.h: Add internal i18n macros and hacks to make working
with sockets easier.
(es_stdin, es_stdout, es_stderr): New internal macros.
(snprintf): New macro.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/gpgrt-int.h (trace_errno): Add new parameter. Adjust all users.
* src/init.c (trace_fp, trace_with_errno, trace_missing_lf)
(trace_prefix_done): New vars.
(_gpgrt_internal_trace_begin): Add arg WITH_ERRNO. Open a trace file
on first use. Init new vars.
(print_internal_trace_prefix): New.
* src/estream.c, src/w32-estream.c: Improve tracing.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/init.c (trace_save_errno, trace_arg_module)
(trace_arg_file, trace_arg_line): New module vars.
(do_internal_trace): New.
(_gpgrt_internal_trace_printf): New.
(_gpgrt_internal_trace): New.
(_gpgrt_internal_trace_errno): New.
(_gpgrt_internal_trace_end): New.
* src/gpgrt-int.h (trace): New macro.
(trace_errno): New macro.
(trace_start): New macro.
(trace_append): New macro.
(trace_finish): New macro.
--
We want to be abale to use libgpg-error also with pre-c99 compilers
and thus we can use the __VA_ARGS__ but resort to the common macro
trick.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/estream.c (_gpgrt_es_init): Rename to _gpgrt_estream_init.
(es_fill): Rename to fill_stream.
(es_fflush): Rename to flush_stream.
(es_deinitialize): Rename to deinit_stream_obj.
(es_create): Rename to create_stream
(es_read_nbf): Rename to do_read_nbf.
(es_read_lbf): Rename to do_read_lbf.
(es_read_fbf): Rename to do_read_fbf.
(es_peek): Rename to peek_stream.
(es_skip): Rename to skip_stream.
(es_print): Rename to do_print_stream.
--
The use of the "es_" was confusing. Avoid that.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* NEWS: Add interface changes.
* src/Makefile.am (libgpg_error_la_SOURCES): Add b64dec.c.
* src/b64dec.c: New. Taken from gpgme. Prefix function names with
_gpgrt_. Change API a bit, not exposing the structure.
* src/gpg-error.def.in: Export Base64 functions.
* src/gpg-error.vers: Likewise.
* src/visibility.c, src/visibility.h: Likewise.
* src/gpg-error.h.in: Add Base64 struct and functions.
* src/gpgrt-int.h: Add Base64 internal functions.
* tests/Makefile.am (TESTS): Add t-b64dec.
* tests/t-b64dec.c: New.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
|
|
|
|
|
|
|
|
|
|
| |
--
A trailing comma in an enum is not groked by all compilers.
Binary operation should have their own parentheses to make it clear
that a binary operator was meant.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/Makefile.am (arch_sources): Add new file.
* src/estream.c (O_NONBLOCK): Move to 'gpgrt-int.h'.
(BUFFER_BLOCK_SIZE): Likewise.
(BUFFER_UNREAD_SIZE): Likewise.
(struct notify_list_s, notify_list_t): Likewise.
(struct _gpgrt_stream_internal, estream_internal_t): Likewise.
(X_POLLABLE): New macro.
(parse_mode): Parse keyword 'pollable', emulate O_NONBLOCK using the
same mechanism on Windows.
(_gpgrt_poll): Use the new '_gpgrt_w32_poll' on Windows.
* src/gpgrt-int.h (_gpgrt_functions_w32_pollable): New declaration.
(_gpgrt_w32_pollable_create): New prototype.
(_gpgrt_w32_poll): Likewise.
* src/w32-estream.c: New file. This code is adapted from GPGME.
* tests/t-poll.c (create_pipe): Create pollable streams.
GnuPG-bug-id: 2731
Signed-off-by: Justus Winter <justus@g10code.com>
|
|
|
|
|
|
|
|
|
| |
* src/estream.c (struct _gpgrt_stream_internal): Add 'kind'.
(init_stream_obj): New parameter 'kind', initialize field.
(es_create): New parameter 'kind'. Update all callers.
* src/gpgrt-int.h (gpgrt_stream_backend_kind_t): New type.
Signed-off-by: Justus Winter <justus@g10code.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/estream.c (cookie_ioctl_function_t): Move to 'gpgrt-int.h',
along with the macros for the IOCTL numbers.
(estream_functions_mem): Use the new type and add the ioctl function.
(estream_functions_fd): Likewise.
(estream_functions_w32): Likewise.
(estream_functions_fp): Likewise.
(init_stream_object): Use the new type, and also initialize
'func_ioctl'.
(es_create): Use the new type.
(_gpgrt_fopen): Adapt.
(_gpgrt_mopen): Likewise.
(_gpgrt_fopenmem): Likewise.
(_gpgrt_fopencookie): Likewise.
(_gpgrt_fdopen): Likewise.
(_gpgrt_fpopen): Likewise.
(do_w32open): Likewise.
* src/gpgrt-int.h (struct cookie_io_functions_s): New type.
Signed-off-by: Justus Winter <justus@g10code.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/visibility.c (gpgrt_get_syscall_clamp): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add function.
* src/gpg-error.h.in: Ditto.
* src/estream.c (_gpgrt_get_syscall_clamp): New.
--
This function can be used by other libraries to set their own system
clamp functions.
Signed-off-by: Werner Koch <wk@gnupg.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--
* use https for bug reporting
* in comments and docs, use https to refer to:
- www.gnu.org
- creativecommons.org
- translationproject.org
- mail.gnome.org
- www.perl.org
- www.ctan.org
- www.cl.cam.ac.uk
- www.ntg.nl
- cygwin.com
- www.ethnologue.com
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure.ac (AC_CHECK_HEADERS): Add sys/select.h and sys/time.h.
* src/estream.c: Include both header if available.
(COOKIE_IOCTL_NONBLOCK): New.
(struct estream_cookie_fd): Add field nonblock.
(func_fd_create): Set nonblock from MODEFLAGS.
(es_func_fd_ioctl): New.
(parse_mode): Add modeflag "nonblock".
(es_fill): Map EWOULDBLOCK to EAGAIN. Do not set error indicator for
EAGAIN.
(es_flush, es_seek, es_write_nbf): Map EWOULDBLOCK to EAGAIN.
(do_fdopen): Call COOKIE_IOCTL_NONBLOCK.
(_gpgrt_set_nonblock): New.
(_gpgrt_get_nonblock): New.
(_gpgrt_poll): New.
* src/gpg-error.h.in (struct _gpgrt_poll_s): New.
(gpgrt_poll_t, es_poll_t): New.
(es_set_nonblock, es_get_nonblock, es_poll): New.
* src/gpg-error.vers, src/gpg-error.def.in: Add gpgrt_set_nonblock,
gpgrt_get_nonblock, and gpgrt_poll.
* src/visibility.c (gpgrt_set_nonblock, gpgrt_get_nonblock): New.
(gpgrt_poll): New.
* tests/t-common.h (DIM): New.
* tests/t-poll.c: New.
* tests/Makefile.am (TESTS): Add t-poll.
(t_poll_LDADD): New.
--
The poll interface uses select(2) internally because that is more
portable than poll(2).
Signed-off-by: Werner Koch <wk@gnupg.org>
|