OS/2, eCS & ArcaOS - Technical > Networking

Updated Samba Client

<< < (46/46)

Paul Smedley:
Hey David,
Thanks for testing.I had only tested the server with a linux client.  I just attached and OS/2 client (running on the same machine as the server) and got a hang <sigh>

Is your OS/2 client running on the same box or a separate client?

I guess the 'good' news here  is that the hang isn't due to GCC 14...

Edit:  I had some additional changes that seem to be the cause of the hang here... I've reverted those changes, and I can no longer reproduce the hang ...

Does it make any difference if you start smbd.exe and nmbd.exe directory - not via sscc?

David McKenna:
Paul,

My client is on a different computer from the Server.  Starting smbd and nmbd from command prompts doesn't seem to help - still get 'access denied' message on client when trying to browse and ends up with a hang on the server.

Regards,

Paul Smedley:
Can try try and capture server logs?

remove \mptn\etc\samba\logs\*
start smbd with 'smdb -d 10'
generate hang
zip \mptn\etc\samba\logs\* and email to me

Paul Smedley:

--- Quote from: Paul Smedley on August 11, 2024, 11:57:17 am ---Now that gcc is sorta under control, hoping to have time this week to investigate the pipe issue with samba server...

Areas for investigation:
https://github.com/psmedley/samba-os2/blob/samba-os2-4.19.x/source3/lib/util_sock.c#L930
https://github.com/psmedley/samba-os2/blob/samba-os2-4.19.x/source3/rpc_client/local_np.c#L32
https://github.com/psmedley/samba-os2/blob/samba-os2-4.19.x/source3/rpc_client/cli_pipe.c#L2951

--- End quote ---

OK so it's been a year - I've had a bit going on health wise.... but I *really* want to nut this out...

I did point Google Gemini to the changes that were necessary in https://github.com/psmedley/samba-os2/blob/samba-os2-4.19.x/lib/messaging/messages_dgm.c and asked it specifically to highlight similar issues that could image samba-dcerpcd, it has come up with the following:

--- Quote ---samba-dcerpcd acts as a multiplexer that listens on sockets for RPC services and dynamically spawns worker daemons (such as rpcd_spoolss or rpcd_lsad) to handle connections. Given the OS/2 limitations identified in your messages_dgm.c workarounds, this process spawning and IPC architecture will hit several specific friction points.

1. socketpair() and File Descriptor Inheritance
To establish the main IPC channel between itself and the spawned rpcd_* worker, samba-dcerpcd relies heavily on socketpair(AF_UNIX, SOCK_STREAM, 0). On OS/2, the fork() and exec() emulation (via kLIBC) often fails to seamlessly inherit connected socket descriptors across the process boundary. You must ensure that the FD_CLOEXEC flag is properly cleared immediately before the OS/2 spawn() call. If kLIBC still drops the socketpair connection during the spawn, you may need to patch the subprocess routines (in source3/rpc_server/rpc_host.c or lib/tevent/tevent_req.c) to explicitly map or duplicate these sockets into the child process's file descriptor table.

2. The --ready-signal-fd Mechanism
When samba-dcerpcd forks a child, it passes a specific file descriptor integer via a command-line argument, using the format --ready-signal-fd=. The spawned child uses this pipe to write a single byte back to the parent indicating it is fully initialized. If OS/2 aggressively closes file descriptors during process creation, or if the runtime scrambles the fd integer mapping, the worker will attempt to write to a closed pipe and fail, causing the parent samba-dcerpcd to terminate the worker. You will need to trace the OS/2 spawn routine to guarantee this specific file descriptor integer is preserved exactly as passed on the command line.

3. Named Pipe Socket Path Namespace Translation
samba-dcerpcd typically operates as a helper process serving DCERPC over named pipes via the --np-helper argument. Internally, Samba implements these Windows named pipes as AF_UNIX sockets, usually created dynamically in directories like /var/run/samba/ncalrpc/np/. Just like the datagram messaging patches, this arbitrary filesystem binding will fail on OS/2. You must apply the \socket\... namespace translation and the dummy open() file creation logic to the samba-dcerpcd listener initialization routines (look in source3/rpc_server/rpc_ep_setup.c or source3/rpc_server/rpc_sock_helper.c).

4. Tevent Polling on Pipes vs. Sockets
If socketpair() is unsupported or failing, Samba may fall back to standard pipe() calls for IPC between the parent and child. samba-dcerpcd attaches these descriptors to the tevent loop to wait for data asynchronously. If the OS/2 TCP/IP stack or kLIBC select() implementation cannot reliably multiplex standard pipes alongside network sockets (e.g., failing to trigger POLLIN/EWOULDBLOCK correctly), the parent process will hang indefinitely waiting for the child. If OS/2 cannot poll pipes properly, you may need to force the subprocess IPC to use a loopback 127.0.0.1 TCP socket instead of standard pipes.
--- End quote ---

Full chat with Gemini at https://share.gemini.google/ajHHwzKmDG7A - I've also asked it for patches, not all I need to do is work up the motivation to try them out :) My OS/2 box is stuck at 800x600 until I can get home and connect a monitor of HDMI 'faker' to it - this makes things a little 'painful'. (I currently expect to be home on Friday).

Navigation

[0] Message Index

[*] Previous page

Go to full version