[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Mon Aug 29 05:22:02 MDT 2011


The branch, master has been updated
       via  b8c3bfa s3-lib: If we create a pipe socket, don't start to listen.
      from  92b7e3e s3:libsmb: make cli_session_request_send/recv() static

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b8c3bfa55b574633bed10925d35dc23bc9e3853c
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Aug 29 09:49:22 2011 +0200

    s3-lib: If we create a pipe socket, don't start to listen.
    
    The create_pipe_sock() function should only create the socket as the
    name states and not start to listen on it too. We should start to listen
    on in the individual places as we need different backlog values.
    
    Autobuild-User: Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date: Mon Aug 29 13:21:43 CEST 2011 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/util_sock.c         |    6 ------
 source3/libsmb/unexpected.c     |    6 ++++++
 source3/rpc_server/rpc_server.c |   16 ++++++++++++++++
 source3/winbindd/winbindd.c     |    9 +++++++++
 4 files changed, 31 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index ebdd2c7..9ade23c 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1298,12 +1298,6 @@ int create_pipe_sock(const char *socket_dir,
 		goto out_close;
 	}
 
-	if (listen(sock, 5) == -1) {
-		DEBUG(0, ("listen failed on pipe socket %s: %s\n", path,
-			strerror(errno)));
-		goto out_close;
-	}
-
 	SAFE_FREE(path);
 
 	umask(old_umask);
diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c
index 483d325..f537b3d 100644
--- a/source3/libsmb/unexpected.c
+++ b/source3/libsmb/unexpected.c
@@ -72,6 +72,7 @@ NTSTATUS nb_packet_server_create(TALLOC_CTX *mem_ctx,
 	struct nb_packet_server *result;
 	struct tevent_fd *fde;
 	NTSTATUS status;
+	int rc;
 
 	result = talloc_zero(mem_ctx, struct nb_packet_server);
 	if (result == NULL) {
@@ -87,6 +88,11 @@ NTSTATUS nb_packet_server_create(TALLOC_CTX *mem_ctx,
 		status = map_nt_error_from_unix(errno);
 		goto fail;
 	}
+	rc = listen(result->listen_sock, 5);
+	if (rc < 0) {
+		status = map_nt_error_from_unix(errno);
+		goto fail;
+	}
 	talloc_set_destructor(result, nb_packet_server_destructor);
 
 	fde = tevent_add_fd(ev, result, result->listen_sock, TEVENT_FD_READ,
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c
index c995e22..6b95419 100644
--- a/source3/rpc_server/rpc_server.c
+++ b/source3/rpc_server/rpc_server.c
@@ -209,6 +209,7 @@ bool setup_named_pipe_socket(const char *pipe_name,
 {
 	struct dcerpc_ncacn_listen_state *state;
 	struct tevent_fd *fde;
+	int rc;
 
 	state = talloc(ev_ctx, struct dcerpc_ncacn_listen_state);
 	if (!state) {
@@ -225,6 +226,13 @@ bool setup_named_pipe_socket(const char *pipe_name,
 		goto out;
 	}
 
+	rc = listen(state->fd, 5);
+	if (rc < 0) {
+		DEBUG(0, ("Failed to listen on pipe socket %s: %s\n",
+			  pipe_name, strerror(errno)));
+		goto out;
+	}
+
 	state->ev_ctx = ev_ctx;
 	state->msg_ctx = msg_ctx;
 
@@ -852,6 +860,7 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
 {
 	struct dcerpc_ncacn_listen_state *state;
 	struct tevent_fd *fde;
+	int rc;
 
 	state = talloc(ev_ctx, struct dcerpc_ncacn_listen_state);
 	if (state == NULL) {
@@ -878,6 +887,13 @@ bool setup_dcerpc_ncalrpc_socket(struct tevent_context *ev_ctx,
 		goto out;
 	}
 
+	rc = listen(state->fd, 5);
+	if (rc < 0) {
+		DEBUG(0, ("Failed to listen on ncalrpc socket %s: %s\n",
+			  name, strerror(errno)));
+		goto out;
+	}
+
 	state->ev_ctx = ev_ctx;
 	state->msg_ctx = msg_ctx;
 
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index cb9d70c..b33328c 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -957,6 +957,7 @@ static bool winbindd_setup_listeners(void)
 	struct winbindd_listen_state *pub_state = NULL;
 	struct winbindd_listen_state *priv_state = NULL;
 	struct tevent_fd *fde;
+	int rc;
 
 	pub_state = talloc(winbind_event_context(),
 			   struct winbindd_listen_state);
@@ -970,6 +971,10 @@ static bool winbindd_setup_listeners(void)
 	if (pub_state->fd == -1) {
 		goto failed;
 	}
+	rc = listen(pub_state->fd, 5);
+	if (rc < 0) {
+		goto failed;
+	}
 
 	fde = tevent_add_fd(winbind_event_context(), pub_state, pub_state->fd,
 			    TEVENT_FD_READ, winbindd_listen_fde_handler,
@@ -992,6 +997,10 @@ static bool winbindd_setup_listeners(void)
 	if (priv_state->fd == -1) {
 		goto failed;
 	}
+	rc = listen(priv_state->fd, 5);
+	if (rc < 0) {
+		goto failed;
+	}
 
 	fde = tevent_add_fd(winbind_event_context(), priv_state,
 			    priv_state->fd, TEVENT_FD_READ,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list