svn commit: samba r13317 - in branches/SAMBA_4_0/source: lib/messaging libnet

tridge at samba.org tridge at samba.org
Mon Feb 6 04:42:35 GMT 2006


Andrew,

 > Don't a stream socket imply that we can just listen on a file descriptor
 > for the reply?  That's certainly my understanding of how winbindd works.

ok, now I get what you are on about. Sorry for being so slow on the
uptake!

This isn't really a STREAM/DGRAM problem. In the IP world, datagram
sockets (UDP) will auto-assign ephemeral port numbers, but unix domain
sockets don't do that. If you do a recvfrom() on a AF_UNIX datagram
socket from a client that has not done a bind then you get back
AF_UNSPEC for the family and nothing in the sun_path field.

So the random() hack is a workaround, effectively doing the work on
unix domain datagram sockets that would be done by the kernel for UDP
sockets. It isn't very robust either, as you could easily get a
collision.

We could fix the robustness, but I don't think that changing to stream
sockets is the right approach. That would mean that the code paths for
smbtorture<->smbd and smbd<->smbd would be very different (as the
client only case will need to do all the de-streaming work of worrying
about partial reads etc). That means our test code will not be really
testing the normal mode of operation.

Even if we used datagram mode for smbtorture and stream mode only for
things like the net command I don't think it would be worth doing as
something like messaging_client_init() hides the details of creating
that temporary socket anyway. I don't think its ugly enough to change
the code that much!

Cheers, Tridge


More information about the samba-technical mailing list