Page MenuHome GnuPG

libassuan: Support sendfd/recvfd (possibly by new API) on Windows
Closed, ResolvedPublic

Description

On Windows, assuan_sendfd/assuan_recvfd is not supported.

It would be good to support this feature (even if it's not that useful), so that the code base of GnuPG can be more coherent/clean (portability wise), minimizing exceptions.

Lack of UNIX domain socket's FD passing feature, we need to find two solutions for:
(1) Sharing file object (opened by sending end, used by receiving end) between different processes
(2) Multiplexing sending/receiving FD and normal message

  • For sharing file HANDLE, we could use DuplicateHandle (possibly by receiving end), by sending end's notifying its HANDLE (and process HANDLE) to receiving end.
  • We could use MSG_OOB for the notification of above, for TCP socket.

Event Timeline

By 1/N...5/N, it works. And it shows the API needs clarification and possible modification/fixes; As written in the comment of system-w32.c, fd == POSIX fd semantics is good, which asks API/ABI break.

The implementation uses MSG_OOB to multiplex sendfd message and normal message, to emulate UNIX domain fd passing feature.
But this is not absolutely needed, because actual credential handling by system is done before sending HANDLE on Windows (the sendfd message is simple text of HANDLE).

For Windows, we could extend std_cmd_table to add, say, windows_sendfd command to receive HANDLE representation in text.
This would be better, because it also can work under pipe connection, as well as socket.

Merged PIPE connection part into master.

gniibe changed the task status from Open to Testing.Nov 7 2022, 6:11 AM