[SCM] Samba Shared Repository - branch v3-6-test updated

Volker Lendecke vlendec at samba.org
Mon Apr 25 02:58:17 MDT 2011


The branch, v3-6-test has been updated
       via  6be972b s3: Add a 10-second timeout for the 445 or netbios connection to a DC (cherry picked from commit 23a6af46c84cd9b738af403d80c5187d858eac03)
      from  045895d s3: Fix Coverity ID 2047, UNUSED_VALUE

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 6be972bd5b55c29f3a3a1ebcbee654a2ece020b6
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Apr 17 20:16:07 2011 +0200

    s3: Add a 10-second timeout for the 445 or netbios connection to a DC
    (cherry picked from commit 23a6af46c84cd9b738af403d80c5187d858eac03)

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

Summary of changes:
 source3/include/proto.h                    |    3 ++-
 source3/libsmb/smbsock_connect.c           |   13 ++++++++++++-
 source3/torture/test_smbsock_any_connect.c |    2 +-
 source3/winbindd/winbindd_cm.c             |    4 ++--
 4 files changed, 17 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6b315d3..8819fd2 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2926,7 +2926,7 @@ NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
 			 const char *called_name, int called_type,
 			 const char *calling_name, int calling_type,
-			 int *pfd, uint16_t *ret_port);
+			 int *pfd, uint16_t *ret_port, int sec_timeout);
 
 struct tevent_req *smbsock_any_connect_send(TALLOC_CTX *mem_ctx,
 					    struct tevent_context *ev,
@@ -2945,6 +2945,7 @@ NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
 			     int *calling_types,
 			     size_t num_addrs,
 			     uint16_t port,
+			     int sec_timeout,
 			     int *pfd, size_t *chosen_index,
 			     uint16_t *chosen_port);
 
diff --git a/source3/libsmb/smbsock_connect.c b/source3/libsmb/smbsock_connect.c
index fd8626f..9dc2f68 100644
--- a/source3/libsmb/smbsock_connect.c
+++ b/source3/libsmb/smbsock_connect.c
@@ -368,7 +368,7 @@ NTSTATUS smbsock_connect_recv(struct tevent_req *req, int *sock,
 NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
 			 const char *called_name, int called_type,
 			 const char *calling_name, int calling_type,
-			 int *pfd, uint16_t *ret_port)
+			 int *pfd, uint16_t *ret_port, int sec_timeout)
 {
 	TALLOC_CTX *frame = talloc_stackframe();
 	struct event_context *ev;
@@ -385,6 +385,11 @@ NTSTATUS smbsock_connect(const struct sockaddr_storage *addr, uint16_t port,
 	if (req == NULL) {
 		goto fail;
 	}
+	if ((sec_timeout != 0) &&
+	    !tevent_req_set_endtime(
+		    req, ev, timeval_current_ofs(sec_timeout, 0))) {
+		goto fail;
+	}
 	if (!tevent_req_poll_ntstatus(req, ev, &status)) {
 		goto fail;
 	}
@@ -610,6 +615,7 @@ NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
 			     int *calling_types,
 			     size_t num_addrs,
 			     uint16_t port,
+			     int sec_timeout,
 			     int *pfd, size_t *chosen_index,
 			     uint16_t *chosen_port)
 {
@@ -629,6 +635,11 @@ NTSTATUS smbsock_any_connect(const struct sockaddr_storage *addrs,
 	if (req == NULL) {
 		goto fail;
 	}
+	if ((sec_timeout != 0) &&
+	    !tevent_req_set_endtime(
+		    req, ev, timeval_current_ofs(sec_timeout, 0))) {
+		goto fail;
+	}
 	if (!tevent_req_poll_ntstatus(req, ev, &status)) {
 		goto fail;
 	}
diff --git a/source3/torture/test_smbsock_any_connect.c b/source3/torture/test_smbsock_any_connect.c
index 28a9981..a964e0f 100644
--- a/source3/torture/test_smbsock_any_connect.c
+++ b/source3/torture/test_smbsock_any_connect.c
@@ -35,7 +35,7 @@ bool run_smb_any_connect(int dummy)
 	interpret_string_addr(&addrs[4], "192.168.99.9", 0);
 
 	status = smbsock_any_connect(addrs, NULL, NULL, NULL, NULL,
-				     ARRAY_SIZE(addrs), 0,
+				     ARRAY_SIZE(addrs), 0, 0,
 				     &fd, &chosen_index, &port);
 
 	d_printf("smbsock_any_connect returned %s (fd %d)\n",
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 1473d33..abb51a9 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1375,7 +1375,7 @@ static bool find_new_dc(TALLOC_CTX *mem_ctx,
 		return False;
 
 	status = smbsock_any_connect(addrs, dcnames, NULL, NULL, NULL,
-				     num_addrs, 0, fd, &fd_index, NULL);
+				     num_addrs, 0, 10, fd, &fd_index, NULL);
 	if (!NT_STATUS_IS_OK(status)) {
 		for (i=0; i<num_dcs; i++) {
 			char ab[INET6_ADDRSTRLEN];
@@ -1571,7 +1571,7 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
 
 			status = smbsock_connect(&domain->dcaddr, 0,
 						 NULL, -1, NULL, -1,
-						 &fd, NULL);
+						 &fd, NULL, 10);
 			if (!NT_STATUS_IS_OK(status)) {
 				fd = -1;
 			}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list