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

simo idra at samba.org
Sun Nov 11 14:51:20 GMT 2007


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.

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

Please check properly, and address the potential segfault.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Senior Software Engineer at Red Hat Inc. <ssorce at redhat.com>



More information about the samba-technical mailing list