svn commit: samba r22090 - in branches/SAMBA_4_0/source/libcli/cldap: .

tridge at samba.org tridge at samba.org
Thu Apr 5 07:37:22 GMT 2007


Author: tridge
Date: 2007-04-05 07:37:21 +0000 (Thu, 05 Apr 2007)
New Revision: 22090

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22090

Log:

fix error handling in cldap client library to cope with bad host names

Modified:
   branches/SAMBA_4_0/source/libcli/cldap/cldap.c
   branches/SAMBA_4_0/source/libcli/cldap/cldap.h


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/cldap/cldap.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/cldap/cldap.c	2007-04-05 07:36:46 UTC (rev 22089)
+++ branches/SAMBA_4_0/source/libcli/cldap/cldap.c	2007-04-05 07:37:21 UTC (rev 22090)
@@ -165,7 +165,8 @@
 		return;
 	}
 
-	req->state = CLDAP_REQUEST_TIMEOUT;
+	req->state = CLDAP_REQUEST_ERROR;
+	req->status = NT_STATUS_IO_TIMEOUT;
 	if (req->async.fn) {
 		req->async.fn(req);
 	}
@@ -186,10 +187,14 @@
 		status = socket_sendto(cldap->sock, &req->encoded, &len,
 				       req->dest);
 		if (NT_STATUS_IS_ERR(status)) {
-			DEBUG(3,("Failed to send cldap request of length %u to %s:%d\n",
+			DEBUG(0,("Failed to send cldap request of length %u to %s:%d\n",
 				 (unsigned)req->encoded.length, req->dest->addr, req->dest->port));
 			DLIST_REMOVE(cldap->send_queue, req);
-			talloc_free(req);
+			req->state = CLDAP_REQUEST_ERROR;
+			req->status = status;
+			if (req->async.fn) {
+				req->async.fn(req);
+			}
 			continue;
 		}
 
@@ -442,9 +447,10 @@
 		}
 	}
 
-	if (req->state == CLDAP_REQUEST_TIMEOUT) {
+	if (req->state == CLDAP_REQUEST_ERROR) {
+		status = req->status;
 		talloc_free(req);
-		return NT_STATUS_IO_TIMEOUT;
+		return status;
 	}
 
 	ldap_msg = talloc(mem_ctx, struct ldap_message);

Modified: branches/SAMBA_4_0/source/libcli/cldap/cldap.h
===================================================================
--- branches/SAMBA_4_0/source/libcli/cldap/cldap.h	2007-04-05 07:36:46 UTC (rev 22089)
+++ branches/SAMBA_4_0/source/libcli/cldap/cldap.h	2007-04-05 07:37:21 UTC (rev 22090)
@@ -28,7 +28,7 @@
 enum cldap_request_state {CLDAP_REQUEST_SEND, 
 			  CLDAP_REQUEST_WAIT, 
 			  CLDAP_REQUEST_DONE,
-			  CLDAP_REQUEST_TIMEOUT};
+			  CLDAP_REQUEST_ERROR};
 
 /*
   a cldap request packet
@@ -39,6 +39,7 @@
 	struct cldap_socket *cldap;
 
 	enum cldap_request_state state;
+	NTSTATUS status;
 
 	/* where to send the request */
 	struct socket_address *dest;



More information about the samba-cvs mailing list