svn commit: samba r25922 - in branches/SAMBA_4_0/source/smbd: .

Andrew Bartlett abartlet at samba.org
Sun Nov 11 22:16:24 GMT 2007


On Sun, 2007-11-11 at 09:51 -0500, simo wrote:
> On Sat, 2007-11-10 at 05:48 +0000, abartlet at samba.org wrote:
> > Author: abartlet
> > Date: 2007-11-10 05:48:38 +0000 (Sat, 10 Nov 2007)
> > New Revision: 25922
> > 
> > WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25922
> > 
> > Log:
> > Make it easier to bind to a unix domain socket, without messing with
> > ports...
> > 
> > Andrew Bartlett
> > 
> > Modified:
> >    branches/SAMBA_4_0/source/smbd/service_stream.c
> > 
> > 
> > Changeset:
> > Modified: branches/SAMBA_4_0/source/smbd/service_stream.c
> > ===================================================================
> > --- branches/SAMBA_4_0/source/smbd/service_stream.c	2007-11-10 05:31:26 UTC (rev 25921)
> > +++ branches/SAMBA_4_0/source/smbd/service_stream.c	2007-11-10 05:48:38 UTC (rev 25922)
> > @@ -266,7 +266,15 @@
> >  
> >  	/* TODO: set socket ACL's here when they're implemented */
> >  
> > -	if (*port == 0) {
> > +	if (!port) {
> > +		socket_address = socket_address_from_strings(stream_socket, 
> > +							     stream_socket->sock->backend_name,
> > +							     sock_addr, 0);
> > +		NT_STATUS_HAVE_NO_MEMORY(socket_address);
> > +		status = socket_listen(stream_socket->sock, socket_address, SERVER_LISTEN_BACKLOG, 0);
> > +		talloc_free(socket_address);
> > +
> > +	} else if (*port == 0) {
> >  		for (i=SERVER_TCP_LOW_PORT;i<= SERVER_TCP_HIGH_PORT;i++) {
> >  			socket_address = socket_address_from_strings(stream_socket, 
> > 								     stream_socket->sock->backend_name,
> 
> Shouldn't you double check that family is "unix" in this case?
> If it is something else you just bind to the first port available.

That actually seems like reasonable semantics. 

> Also if port == NULL, and you get an error the following DEBUG statement will segfault.

I'll look into it. 

Andrew Bartlett

-- 
Andrew Bartlett
http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Red Hat Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20071112/d2555a52/attachment.bin


More information about the samba-technical mailing list