svn commit: samba r17020 - in branches/SAMBA_4_0/source: libcli/raw libcli/smb2 torture/basic torture/raw

metze at samba.org metze at samba.org
Thu Jul 13 17:37:45 GMT 2006


Author: metze
Date: 2006-07-13 17:37:45 +0000 (Thu, 13 Jul 2006)
New Revision: 17020

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

Log:
pass the real error to the failing requests

metze
Modified:
   branches/SAMBA_4_0/source/libcli/raw/clitransport.c
   branches/SAMBA_4_0/source/libcli/smb2/transport.c
   branches/SAMBA_4_0/source/torture/basic/delete.c
   branches/SAMBA_4_0/source/torture/raw/notify.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/raw/clitransport.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2006-07-13 17:17:27 UTC (rev 17019)
+++ branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2006-07-13 17:37:45 UTC (rev 17020)
@@ -52,7 +52,7 @@
  */
 static int transport_destructor(struct smbcli_transport *transport)
 {
-	smbcli_transport_dead(transport);
+	smbcli_transport_dead(transport, NT_STATUS_LOCAL_DISCONNECT);
 	return 0;
 }
 
@@ -63,7 +63,7 @@
 static void smbcli_transport_error(void *private, NTSTATUS status)
 {
 	struct smbcli_transport *transport = talloc_get_type(private, struct smbcli_transport);
-	smbcli_transport_dead(transport);
+	smbcli_transport_dead(transport, status);
 }
 
 static NTSTATUS smbcli_transport_finish_recv(void *private, DATA_BLOB blob);
@@ -130,15 +130,19 @@
 /*
   mark the transport as dead
 */
-void smbcli_transport_dead(struct smbcli_transport *transport)
+void smbcli_transport_dead(struct smbcli_transport *transport, NTSTATUS status)
 {
 	smbcli_sock_dead(transport->socket);
 
+	if (NT_STATUS_EQUAL(NT_STATUS_UNSUCCESSFUL, status)) {
+		status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
+	}
+
 	/* kill all pending receives */
 	while (transport->pending_recv) {
 		struct smbcli_request *req = transport->pending_recv;
 		req->state = SMBCLI_REQUEST_ERROR;
-		req->status = NT_STATUS_NET_WRITE_FAULT;
+		req->status = status;
 		DLIST_REMOVE(transport->pending_recv, req);
 		if (req->async.fn) {
 			req->async.fn(req);

Modified: branches/SAMBA_4_0/source/libcli/smb2/transport.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/smb2/transport.c	2006-07-13 17:17:27 UTC (rev 17019)
+++ branches/SAMBA_4_0/source/libcli/smb2/transport.c	2006-07-13 17:37:45 UTC (rev 17020)
@@ -53,7 +53,7 @@
  */
 static int transport_destructor(struct smb2_transport *transport)
 {
-	smb2_transport_dead(transport);
+	smb2_transport_dead(transport, NT_STATUS_LOCAL_DISCONNECT);
 	return 0;
 }
 
@@ -65,7 +65,7 @@
 {
 	struct smb2_transport *transport = talloc_get_type(private, 
 							   struct smb2_transport);
-	smb2_transport_dead(transport);
+	smb2_transport_dead(transport, status);
 }
 
 static NTSTATUS smb2_transport_finish_recv(void *private, DATA_BLOB blob);
@@ -120,15 +120,19 @@
 /*
   mark the transport as dead
 */
-void smb2_transport_dead(struct smb2_transport *transport)
+void smb2_transport_dead(struct smb2_transport *transport, NTSTATUS status)
 {
 	smbcli_sock_dead(transport->socket);
 
+	if (NT_STATUS_EQUAL(NT_STATUS_UNSUCCESSFUL, status)) {
+		status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
+	}
+
 	/* kill all pending receives */
 	while (transport->pending_recv) {
 		struct smb2_request *req = transport->pending_recv;
 		req->state = SMB2_REQUEST_ERROR;
-		req->status = NT_STATUS_NET_WRITE_FAULT;
+		req->status = status;
 		DLIST_REMOVE(transport->pending_recv, req);
 		if (req->async.fn) {
 			req->async.fn(req);

Modified: branches/SAMBA_4_0/source/torture/basic/delete.c
===================================================================
--- branches/SAMBA_4_0/source/torture/basic/delete.c	2006-07-13 17:17:27 UTC (rev 17019)
+++ branches/SAMBA_4_0/source/torture/basic/delete.c	2006-07-13 17:37:45 UTC (rev 17020)
@@ -1592,7 +1592,7 @@
 	correct &= check_delete_on_close(cli1, fnum1, fname, True, __location__);
 
 	/* Now yank the rug from under cli1. */
-	smbcli_transport_dead(cli1->transport);
+	smbcli_transport_dead(cli1->transport, NT_STATUS_LOCAL_DISCONNECT);
 
 	fnum1 = -1;
 

Modified: branches/SAMBA_4_0/source/torture/raw/notify.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/notify.c	2006-07-13 17:17:27 UTC (rev 17019)
+++ branches/SAMBA_4_0/source/torture/raw/notify.c	2006-07-13 17:37:45 UTC (rev 17020)
@@ -842,7 +842,7 @@
 static void tcp_dis_handler(struct smbcli_transport *t, void *p)
 {
 	struct smbcli_state *cli = p;
-	smbcli_transport_dead(cli->transport);
+	smbcli_transport_dead(cli->transport, NT_STATUS_LOCAL_DISCONNECT);
 	cli->transport = NULL;
 	cli->tree = NULL;
 }
@@ -898,7 +898,7 @@
 	smbcli_transport_idle_handler(cli->transport, tcp_dis_handler, 250, cli);
 
 	status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
-	CHECK_STATUS(status, NT_STATUS_NET_WRITE_FAULT);
+	CHECK_STATUS(status, NT_STATUS_LOCAL_DISCONNECT);
 
 done:
 	torture_close_connection(cli);



More information about the samba-cvs mailing list