summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into gniibe/t6236gniibe/t6236NIIBE Yutaka2022-11-070-0/+0
|\
| * 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>
* | Use higher-layer assuan_transact for fdpassing.NIIBE Yutaka2022-11-072-79/+5
| | | | | | | | Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | Merge branch 'master' into gniibe/t6236NIIBE Yutaka2022-11-074-18/+27
|\ \ | |/
| * 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>
* | Merge branch 'master' into gniibe/t6236NIIBE Yutaka2022-11-072-37/+8
|\ \ | |/
| * 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>
* | Merge branch 'master' into gniibe/t6236NIIBE Yutaka2022-11-044-5/+9
|\ \ | |/
| * 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>
* | fdpassing using pipe works on Windows.NIIBE Yutaka2022-10-284-24/+46
| | | | | | | | | | | | ./fdpassing.exe --with-exec --debug --verbose Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | testing fdpassing.NIIBE Yutaka2022-10-274-14/+11
| | | | | | | | Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | experiment: New SENDFD command to implement sendfd feature.NIIBE Yutaka2022-10-202-0/+56
| | | | | | | | | | | | | | | | | | | | * src/assuan-handler.c (w32_handler_sendfd): New. * src/system-w32.c (w32_fdpass_send): Use assuan_transact. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | experiment: Reliably send/recv fd passing, part 5/N.NIIBE Yutaka2022-10-141-21/+23
| | | | | | | | | | | | | | | | | | | | * src/system-w32.c (FDPASS_MSG_SIZE): New. (__assuan_read): Read fixed size of fdpass_msg. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | experiment: Implement receving fd for Windows, part 4/N.NIIBE Yutaka2022-10-143-34/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/assuan-defs.h (w32_fdpass_recv): New. * src/assuan-socket-server.c (assuan_init_socket_server): Use it. * src/system-w32.c (get_file_handle): New. (w32_fdpass_send): Implement. (process_fdpass_msg): Implement. (w32_fdpass_recv): New. (__assuan_read): De-multiplex the sendfd message and normal message. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | Remove debug printf.NIIBE Yutaka2022-10-141-6/+1
| | | | | | | | Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | Set ctx->pid even with TCP connection, useful for Windows.NIIBE Yutaka2022-10-133-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | * src/assuan-listen.c (assuan_accept): Use PID to notify client. * src/assuan-socket-connect.c (_assuan_connect_finalize): Parse the initial message to extract remote PID. * src/client.c (_assuan_client_finish): Only call waitpid when it's not socket. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | Merge branch 'master' into gniibe/t6236NIIBE Yutaka2022-10-132-30/+3
|\ \ | |/
| * 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>
* | experiment: Add fdpassing-socket test for Windows, part 3/N.NIIBE Yutaka2022-10-122-2/+361
| | | | | | | | | | | | | | | | | | * tests/fdpassing-socket.c: New. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | experiment: sendfd/recvfd on Windows, part 2/N.NIIBE Yutaka2022-10-123-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | * src/assuan-defs.h (w32_fdpass_send): New. * src/assuan-socket-connect.c (_assuan_connect_finalize) [HAVE_W32_SYSTEM]: Use w32_fdpass_send. * src/system-w32.c (w32_fdpass_send): New. -- GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* | experiment: sendfd/recvfd on Windows, part 1/N.NIIBE Yutaka2022-10-121-2/+42
|/ | | | | | | | | | * src/system-w32.c (process_fdpass_msg): New (not yet implemented). (__assuan_read): Handle fdpassing message with MSG_OOB. -- GnuPG-bug-id: 6236 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>
* Add assuan_sock_accept function.NIIBE Yutaka2022-04-083-0/+35
| | | | | | | | | | | * src/assuan-socket.c (_assuan_sock_accept): New. (assuan_sock_accept): New. * src/assuan.h.in (assuan_sock_accept): New. -- GnuPG-bug-id: 5925 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Store a flag if it's socket or not in Assuan CTX.NIIBE Yutaka2022-04-065-34/+16
| | | | | | | | | | | | | | * src/assuan-defs.h (struct assuan_context_s): Add is_socket flag. * src/assuan-socket.c (assuan_sock_init): Set the flag. * src/assuan-socket-connect.c (_assuan_connect_finalize): Likewise. * src/assuan-socket-server.c (assuan_init_socket_server): Likewise. * src/system-w32.c (__assuan_close): Use the flag. (is_socket): Remove. (__assuan_read, __assuan_write): Use the flag. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix API break.NIIBE Yutaka2022-04-053-10/+20
| | | | | | | | | | | | | * src/posix-fd-t.inc.h (assuan_fd_from_posix_fd): Revert. * src/w32-fd-t.inc.h (assuan_fd_from_posix_fd): Revert. * src/system-w32.c (assuan_fd_from_posix_fd): Revert. -- Note that assuan_fd_from_posix_fd is exposed inline function. Fixes-commit: 28a40a298661877e1bbeb3eb9ac58a85bdd85b02 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Remove unused putc_unlocked.c.NIIBE Yutaka2022-04-052-32/+0
| | | | | | | | | * src/putc_unlocked.c: Remove. * configure.ac: Remove putc_unlocked replace. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Take advantage of gpgrt_get_syscall_clamp function.NIIBE Yutaka2022-04-056-22/+182
| | | | | | | | | | | | | | | | | | | | | | | * src/assuan-defs.h (_assuan_pre_syscall, _assuan_post_syscall): New. * src/assuan.c (_assuan_pre_syscall, _assuan_post_syscall): New. (pre_syscall_func, post_syscall_func): New. (_assuan_syscall_func_initialized): New. (assuan_new_ext): Call gpgrt_get_syscall_clamp to get clamp functions. * src/system-posix.c (_assuan_system_hooks): Use version 0. * src/system-w32.c (_assuan_system_hooks): Likewise. * src/system.c (_assuan_usleep): Call clamp functions if no hooks. (_assuan_close, _assuan_close_inheritable, _assuan_read): Likewise. (_assuan_write, _assuan_recvmsg, _assuan_sendmsg): Likewise. (_assuan_waitpid, _assuan_connect): Likewise. (_assuan_pipe): Call __assuan_pipe directly if no hooks. (_assuan_spawn): Call __assuan_spawn directly if no hooks. (_assuan_socketpair): Call __assuan_socketpair directly if no hooks. (_assuan_socket): Call __assuan_socket directly if no hooks. -- GnuPG-bug-id: 5914 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Fix listing m4 files.NIIBE Yutaka2022-04-051-1/+1
| | | | | | | | | * m4/Makefile.am (EXTRA_DIST): Add ax_cc_for_build.m4 and gpg-error.m4. Remove sys_socket_h.m4. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Fix assuan_socket_connect_fd to be usable.NIIBE Yutaka2022-04-045-27/+16
| | | | | | | | | | | | | | | | | | | | | | * src/assuan.h.in (assuan_socket_connect_fd): Second arg assuan_fd_t. * src/assuan-socket-connect.c (assuan_socket_connect_fd): Second arg should be an object of type SOCKET. * src/posix-fd-t.inc.h (assuan_fd_from_posix_fd): Remove. * src/w32-fd-t.inc.h (assuan_fd_from_posix_fd): Move to... * src/system-w32.c (assuan_fd_from_posix_fd): ... here. -- On Windows, when an application has an already-connected socket, it must be an object of type SOCKET. In this case, it is wrong to use _get_osfhandle. This does not constitute any ABI/API change for POSIX system. This is an API change for Windows, as assuan_fd_t on Windows is pointer type, but it's a fix from non-correctly-usable API. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* build: Better cross build support.NIIBE Yutaka2022-04-013-18/+82
| | | | | | | | | | * configure.ac: Use AX_CC_FOR_BUILD. * src/Makefile.am: Use EXEEXT_FOR_BUILD. * m4/ax_cc_for_build.m4: New from libgpg-error. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Fix internal socket API to be consistent for SOCKET.NIIBE Yutaka2022-03-315-34/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/assuan-defs.h (_assuan_socket): Return value has type assuan_fd_t. (_assuan_connect): Second argument has type assuan_fd_t. [HAVE_W64_SYSTEM] (SOCKET2HANDLE): Revert the change before. * src/assuan-socket.c (_assuan_sock_new): No type coercion for _assuan_socket. (socks5_connect): No type coercion for _assuan_connect. (_assuan_sock_connect): Likewise. * src/assuan.h.in (struct assuan_system_hooks): Fix method signature of socket for return value type and of connect for the second argument. (__assuan_socket): Return value has type assuan_fd_t. (__assuan_connect): Second argument has type assuan_fd_t. (ASSUAN_SYSTEM_NPTH_IMPL): Fix for _assuan_npth_connect for its second argument. * src/system-w32.c (__assuan_socket): Return value has type assuan_fd_t. Use SOCKET2HANDLE for type coercion for socket. Use INVALID_SOCKET. (__assuan_connect): Second argument has type assuan_fd_t. Use HANDLE2SOCKET for type coercion for sock. * src/system.c (_assuan_socket): Return value has type assuan_fd_t. (_assuan_connect): Second argument has type assuan_fd_t. -- Note that this change does *NOT* constitute any ABI change, no API change, either. It is fix for internal consistency for socket. The change of SOCKET2HANDLE in the past for HAVE_W64_SYSTEM was done, because of internal use of 'int' which represents the type for socket. Instead of fixing that part of code for 'int', I touched another part to silence warnings. That's not correct fix, but a work around. This time, with the changes, whole parts are now consisitent. Fixes-commit: 6c736325c028647dc3283bf723e2e28199e7f45b Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>