summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* doc: Update documentation for the method spawn and waitpid.HEADmasterNIIBE Yutaka2023-05-171-2/+2
| | | | Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: File handle passing to server is now supported.NIIBE Yutaka2023-05-172-6/+14
| | | | | | | | | * configure.ac: Fix for MinGW. * src/assuan-buffer.c (assuan_sendfd): Fix runtime check. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Don't use ASSUAN_INVALID_PID for assuan_pid_t value.NIIBE Yutaka2023-05-172-3/+3
| | | | | | | | | * src/assuan.c (assuan_new_ext): Use -1. * src/client.c (_assuan_client_finish): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Cleaner semantics for PID and Process handle.NIIBE Yutaka2023-05-1715-36/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/assuan-defs.h (struct assuan_context_s): Introduce SERVER_PROC member. Clarify the use of PROCESS_ID and PID. Introduce assuan_pid_t for internal use of process id or handle. * src/assuan.h.in: Follow the change. * src/assuan.c (assuan_new_ext): Likewise. * src/client.c (_assuan_client_finish): Likewise. * src/assuan-pipe-connect.c (pipe_connect): Likewise. * src/server.c (_assuan_server_finish): Likewise. * src/system-posix.c: Likewise. * src/system-w32.c: Likewise. * src/system.c: Likewise. * src/assuan-pipe-server.c (assuan_init_pipe_server) [HAVE_W32_SYSTEM]: Exclude the use of _assuan_pipe_connect_pid. * src/assuan-socket-server.c (accept_connection_bottom) [HAVE_W32_SYSTEM]: Exclude the use of the member peercred.pid. * src/assuan-socket.c (_assuan_sock_check_nonce): Support Cygwin Unix domain emulation for having valid client process ID. * src/context.c (assuan_get_pid): Clarify the use cases. * src/posix-types.inc.h, src/w32-types.inc.h: Introduce assuan_pid_t. -- GnuPG-bug-id: 6487 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix comments.NIIBE Yutaka2023-05-172-2/+2
| | | | | | -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix wrong return type for functions.NIIBE Yutaka2023-05-161-6/+6
| | | | | | | * src/system.c (_assuan_recvmsg, _assuan_sendmsg): Fix to int. (_assuan_waitpid): Fix to pid_t. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* tests: Use -no-fast-install LDFLAGS for Windows.NIIBE Yutaka2023-05-121-0/+4
| | | | | | | | * tests/Makefile.am [HAVE_W32_SYSTEM] (AM_LDFLAGS): Conditionalize. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Deprecate ASSUAN_SYSTEM_NPTH.NIIBE Yutaka2023-05-112-2/+11
| | | | | | | | | | | * src/assuan.h.in: Introduce new configuration with ASSUAN_REALLY_REQUIRE_OLD_WAY_OF_SYSTEM_NPTH. -- Existing use cases just works with ASSUAN_SYSTEM_NPTH=NULL. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Allow NULL for system_hooks.NIIBE Yutaka2023-05-111-0/+3
| | | | | | * src/system.c (_assuan_system_hooks_copy): Do nothing with SRC=NULL. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix the previous commit.NIIBE Yutaka2023-05-111-0/+2
| | | | | | | * src/assuan.c (_assuan_pre_syscall): Call the pre_syscall_func function after get it. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix calling gpgrt_get_syscall_clamp.NIIBE Yutaka2023-05-111-6/+5
| | | | | | | | | * src/assuan.c (assuan_new_ext): Move gpgrt_get_syscall_clamp to... (_assuan_pre_syscall): ... here. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* tests: Fix for POSIX machine.NIIBE Yutaka2023-05-111-0/+2
| | | | | | | | * modified tests/pipeconnect.c (cmd_cat): Ifdef-out W32. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Fix test header file for 64-bit Windows.NIIBE Yutaka2023-05-101-1/+7
| | | | | | | | * tests/common.h: Add for HAVE_W64_SYSTEM. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Fix pipeconnect test program for Windows.NIIBE Yutaka2023-05-101-3/+22
| | | | | | | | * tests/pipeconnect.c: Fix for input_fd and output_fd. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Minor fixes for ifdef/endif for W32 and W64.NIIBE Yutaka2023-05-103-3/+3
| | | | | | | | | | * src/assuan-defs.h: Fix. * src/assuan-pipe-connect.c: Likewise. * src/assuan-socket-connect.c: Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Fix the semantics of sending FD, it's Windows HANDLE.NIIBE Yutaka2023-05-103-29/+33
| | | | | | | | | | | | * src/assuan-handler.c (w32_handler_sendfd): It's Windows HANDLE. * src/system-w32.c (get_file_handle, w32_fdpass_send): Likewise. * tests/fdpassing.c (cmd_echo): Received FD is Windows HANDLE. (client): Use Windows HANDLE for assuan_sendfd. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Implement timeout in assuan_sock_connect_byname.NIIBE Yutaka2023-05-083-24/+52
| | | | | | | | | | | | | * src/assuan-socket.c (socks5_connect): Add new argument TIMEOUT in milliseconds. (_assuan_sock_connect): Follow the change. (_assuan_sock_connect_byname): Fourth argument is now TIMEOUT. (assuan_sock_connect_byname): Likewise. -- GnuPG-bug-id: 3302 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Update gpg-error.m4.NIIBE Yutaka2023-04-051-23/+36
| | | | | | | | * m4/gpg-error.m4: Update from libgpg-error master. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Fix assuan_socket_connect.NIIBE Yutaka2023-01-041-1/+2
| | | | | | | | | | | | | * src/assuan-socket-connect.c (_assuan_connect_finalize): Don't set flags.is_socket here, since it's too late. (assuan_socket_connect_fd): Set flags.is_socket. (assuan_socket_connect): Set flags.is_socket, before _assuan_sock_new. -- GnuPG-bug-id: 6324 Fixes-commit: c93eb901e58d5b31294c2d452659b5150d95ec59 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix make dist targetAndre Heinecke2022-11-181-1/+1
| | | | * tests/Makefile.am (EXTRA_DIST): Add fdpassing-socket.sh
* w32: Fix confusion between process ID and process HANDLE.NIIBE Yutaka2022-11-154-12/+12
| | | | | | | | | | | | | | | * src/assuan-defs.h (struct assuan_context_s): Rename to process_id. * src/assuan-pipe-connect.c (initial_handshake): Fix variable name and access to the member field. * src/assuan-socket-connect.c (_assuan_connect_finalize): Likewise. * src/system-w32.c (get_file_handle): Likewise. (w32_fdpass_send): Likewise. -- Fixes-commit: ba84b780df973ba7ca7f7c51fbd1b6d1a69b8c01 GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* doc: Update the description about pkg-config.NIIBE Yutaka2022-11-151-12/+14
| | | | | | -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Have PROCESS_HANDLE in struct assuan_context_s.NIIBE Yutaka2022-11-094-10/+17
| | | | | | | | | | | | | | | | | | * src/assuan-defs.h (struct assuan_context_s): Add process_handle field. It's "int" instead of DWORD, because of getpid function. * src/assuan-pipe-connect.c (initial_handshake): Set ->process_handle, not override ->pid. * src/assuan-socket-connect.c (assuan_connect_finalize): Likewise. * src/system-w32.c (w32_fdpass_send): Use ->process_handle. -- In the client code, ctx->pid (by the function assuan_get_pid) may be used to watch the finish of server process. Thus, it should not be overridden. See: gnupg/agent/call-daemon.c. GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* tests: Use common code for Windows.NIIBE Yutaka2022-11-091-8/+2
| | | | | | | | * tests/fdpassing.c (main): Get program name from ARGV. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* tests: Add fdpassing-socket.sh script.NIIBE Yutaka2022-11-084-64/+208
| | | | | | | | | | | | | | | * tests/Makefile.am (TESTS_ENVIRONMENT): Export EXEEXT. (test_programs): New. Run pipeconnect for Windows, too. (check_SCRIPTS): New. (TESTS): Now, it's test_programs and check_SCRIPTS. (noinst_PROGRAMS): Not including check_SCRIPTS. (tests/fdpassing-socket.sh): New, to test socket connection. * tests/fdpassing.c: Include socket connection test. * tests/pipeconnect.c: Fix for Windows. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Support fd passing through socket.NIIBE Yutaka2022-11-072-1/+29
| | | | | | | | | | | | * src/assuan-socket-connect.c (_assuan_connect_finalize): Use w32_fdpass_send. Get peer's PID from the initial connection. * src/assuan-socket-server.c (assuan_init_socket_server): Use w32_fdpass_recv. -- GnuPG-bug-id: GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Support fd passing through pipe.NIIBE Yutaka2022-11-074-18/+58
| | | | | | | | | | | | | | | | * src/assuan-pipe-connect.c (initial_handshake): Get peer's PID from the initial interaction. * src/assuan-pipe-server.c (assuan_init_pipe_server): Handle the case of FILEDES == NULL on Windows. * tests/Makefile.am [HAVE_W32_SYSTEM] (TESTS): Add fdpassing. * tests/fdpassing.c: Remove including sys/socket.h and sys/wait.h. (cmd_echo): Output to stder, as stdout is /dev/null. (main): Support Windows. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Show the pid of listening process in the hello line.NIIBE Yutaka2022-11-071-1/+1
| | | | | | | | | | | | | | | | | * src/assuan-listen.c (assuan_accept): Use getpid instead of assuan_get_pid. -- This changes the initial interaction. Before the change, the PID of peer was shown from listening process (but not used at all, in the code). That is, it was the PID of connecting process. After the change, the PID of listening process is shown, which can be used by connecting process. GnuPG-bug-id: 6236 Fixes-commit: a00b1ede5403f1e38534cc3b232739f20b8567e9 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Support sendfd/recvfd through pipe connection.NIIBE Yutaka2022-11-044-8/+91
| | | | | | | | | | | | | | | | | * src/assuan-defs.h (w32_fdpass_send, w32_fdpass_recv): New. * src/assuan-pipe-connect.c [HAVE_W32_SYSTEM] (pipe_connect): Set w32_fdpass_send. [!HAVE_W32_SYSTEM] (assuan_pipe_connect): Use socketpair_connect. * src/assuan-pipe-server.c [HAVE_W32_SYSTEM] (assuan_init_pipe_server): Set w32_fdpass_recv. * src/system-w32.c (get_file_handle): New. (w32_fdpass_send): New, using "SENDFD" internal command. (w32_fdpass_recv): New, using the result of "SENDFD" internal command. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Add SENDFD internal command.NIIBE Yutaka2022-11-041-0/+48
| | | | | | | | | | * src/assuan-handler.c (w32_handler_sendfd): New. (std_cmd_table): Add the "SENDFD" command. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* client: Only call _assuan_waitpid when it's not socket.NIIBE Yutaka2022-11-041-1/+2
| | | | | | | | | * src/client.c (_assuan_client_finish): Check if it's socket. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Prefer gpgrt-config when available.NIIBE Yutaka2022-11-011-2/+2
| | | | | | | | | | | | | * src/libassuan.m4: Overriding the decision by --with-libassuan-prefix, use gpgrt-config libassuan when gpgrt-config is available. -- This may offer better migration. GnuPG-bug-id: 5034 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Fix make distAndre Heinecke2022-10-251-1/+1
| | | | | | | | * src/Makefile.am (parts_of_assuan_h): Readd w32-includes.h -- This was accidentally removed. Fixes-commit: df6aec566ce450e4e0702e4784569642f2bc6703
* Fix an explanation for socket on Windows.NIIBE Yutaka2022-10-241-1/+1
| | | | | | -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Update gpg-error.m4.NIIBE Yutaka2022-10-241-1/+5
| | | | | | | | * m4/gpg-error.m4: Update from libgpg-error 1.46. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Remove WindowsCE support from mkheader.NIIBE Yutaka2022-10-122-30/+3
| | | | | | | | | | | | * src/assuan.h.in (@include:sys/types.h@, @include:unistd.h@): Simply include <sys/types.h> and <unistd.h>. (@include:w32ce-add@): Remove. * src/mkheader.c (write_special): Remove mingw32ce support. -- GnuPG-bug-id: 6170 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Silence compiler warnings.NIIBE Yutaka2022-09-081-2/+2
| | | | | | | | | * src/assuan-socket.c (assuan_sock_init): It's no args. (assuan_sock_deinit): Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Drop WindowsCE support.NIIBE Yutaka2022-08-3127-5288/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * contrib/*: Remove. * Makefile.am (EXTRA_DIST): Don't include contrib/. * configure.ac (HAVE_W32CE_SYSTEM): Remove. * src/gpgcedev.c: Remove. * src/gpgcedev.def: Remove. * src/gpgcemgr.c: Remove. * src/system-w32ce.c: Remove. * src/w32ce-add.h: Remove. * src/w32ce-fd-t.inc.h: Remove. * src/Makefile.am (EXTRA_DIST, parts_of_assuan_h, common_sources): Fix. * src/assuan-buffer.c [HAVE_W32CE_SYSTEM]: No conditionalize. * src/setenv.c [HAVE_W32CE_SYSTEM]: Likewise. * src/assuan-defs.h [HAVE_W32CE_SYSTEM]: Remove dependent part. * src/assuan-error.c [HAVE_W32CE_SYSTEM]: Likewise. * src/assuan-handler.c [HAVE_W32CE_SYSTEM]: Likewise. * src/assuan-socket.c [HAVE_W32CE_SYSTEM]: Likewise. * src/system.c [HAVE_W32CE_SYSTEM]: Likewise. * src/sysutils.c [HAVE_W32CE_SYSTEM]: Likewise. * tests/Makefile.am (EXTRA_DIST): Fix. (w32cetools): Remove. * tests/common.h [HAVE_W32CE_SYSTEM]: Remove dependent part. * tests/pipeconnect.c [HAVE_W32CE_SYSTEM]: Likewise. * tests/ce-createpipe.c: Remove. * tests/ce-server.c: Remove. -- GnuPG-bug-id: 6170 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Update config.guess, config.sub, and config.rpath.NIIBE Yutaka2022-07-193-1965/+2324
| | | | | | | | | | | * build-aux/config.guess: Update from upstream. * build-aux/config.sub: Ditto. * build-aux/config.rpath: Update from gettext 0.21. -- GnuPG-bug-id: 6078 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Update gpg-error.m4.NIIBE Yutaka2022-06-281-1/+2
| | | | | | | | * m4/gpg-error.m4: Update from libgpg-error. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix the previous commit.NIIBE Yutaka2022-06-201-1/+1
| | | | | | -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Don't access NULL by wipememory.NIIBE Yutaka2022-06-201-1/+1
| | | | | | | | | | | * src/assuan-inquire.c (assuan_inquire): Check mb->buf. -- There is a case where mb->buf may be cleared already by get_membuf. Fixes-commit: d812e28af637144d078005887cb7519d7a2d0c58 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* tests: Remove dead codeJakub Jelen2022-06-081-1/+1
| | | | | | | | * tests/socks5.c (main): Unsigned value is always larger than 0 -- GnuPG-bug-id: 6018 Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* config: Remove 18 years unused variableJakub Jelen2022-06-081-1/+0
| | | | | | | | | Its use was removed in 2004 in 9096d0adb448330b5b197579bd57d942635d7021 * src/libassuan-config.in: Remove unused variable -- Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* tests: Avoid leaking file descriptors on errorsJakub Jelen2022-06-081-0/+1
| | | | | | | * tests/fdpassing.c (client): Close fp on error -- Signed-off-by: Jakub Jelen <jjelen@redhat.com>
* client: Handle inquiry from server with CONFIDENTIAL.NIIBE Yutaka2022-05-253-2/+16
| | | | | | | | | | | | | | * src/assuan-defs.h (struct assuan_context_s): Add new flags, in_inq_cb and confidential_inquiry. * src/client.c (assuan_transact): Use the new flags to wipe the outbound buffer for inquiry when CONFIDENTIAL. * src/context.c (assuan_set_flag): When ASSUAN_CONFIDENTIAL is set in inquire callback, set the confidential_inquiry flag. -- GnuPG-bug-id: 5977 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* struct assuan_context_s: Move boolean fields to flags.NIIBE Yutaka2022-05-256-40/+39
| | | | | | | | | | | | | | | * src/assuan-defs.h (struct assuan_context_s): Move is_server, in_inquire, in_process_next, process_complete, in_command into flags. * src/assuan-buffer.c: Follow the change. * src/assuan-handler.c: Likewise. * src/assuan-inquire.c: Likewise. * src/assuan-pipe-server.c: Likewise. * src/assuan-socket-server.c: Likewise. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* client: Wipe the inbound buffer when CONFIDENTIAL.NIIBE Yutaka2022-05-251-0/+2
| | | | | | | | | * src/client.c (assuan_transact): Wipe the buffer. -- GnuPG-bug-id: 5977 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* server,client: Wipe the outbound buffer when CONFIDENTIAL.NIIBE Yutaka2022-05-251-0/+2
| | | | | | | | | * src/assuan-buffer.c (assuan_send_data): Wipe the buffer. -- GnuPG-bug-id: 5977 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* server: Wipe out the memory used by assuan_inquire if CONFIDENTIAL.NIIBE Yutaka2022-05-251-1/+7
| | | | | | | | | | * src/assuan-inquire.c (assuan_inquire): Wipe the memory and inbound buffer. -- GnuPG-bug-id: 5977 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>