diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-07-13 17:37:45 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:10:08 -0500 |
commit | 440d0487a6ad9a39630d7364eb54e46367207d05 (patch) | |
tree | 4f506f2aa759c815a55bf00e7baa566669aa1efe | |
parent | 09b9d831c285d04d0159d2ca2f0a82be214bf701 (diff) | |
download | samba-440d0487a6ad9a39630d7364eb54e46367207d05.tar.gz samba-440d0487a6ad9a39630d7364eb54e46367207d05.tar.bz2 samba-440d0487a6ad9a39630d7364eb54e46367207d05.zip |
r17020: pass the real error to the failing requests
metze
(This used to be commit 49b96ac44a883c020c69df7a12df154dc4faa4d5)
-rw-r--r-- | source4/libcli/raw/clitransport.c | 12 | ||||
-rw-r--r-- | source4/libcli/smb2/transport.c | 12 | ||||
-rw-r--r-- | source4/torture/basic/delete.c | 2 | ||||
-rw-r--r-- | source4/torture/raw/notify.c | 4 |
4 files changed, 19 insertions, 11 deletions
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index fc257b9098..641ad38031 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -52,7 +52,7 @@ static void smbcli_transport_event_handler(struct event_context *ev, */ 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 int transport_destructor(struct smbcli_transport *transport) 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 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock, /* 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); diff --git a/source4/libcli/smb2/transport.c b/source4/libcli/smb2/transport.c index 6f91699704..df3bec8720 100644 --- a/source4/libcli/smb2/transport.c +++ b/source4/libcli/smb2/transport.c @@ -53,7 +53,7 @@ static void smb2_transport_event_handler(struct event_context *ev, */ 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 @@ static void smb2_transport_error(void *private, NTSTATUS status) { 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 @@ struct smb2_transport *smb2_transport_init(struct smbcli_socket *sock, /* 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); diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c index d3f7de201f..445333ca6f 100644 --- a/source4/torture/basic/delete.c +++ b/source4/torture/basic/delete.c @@ -1592,7 +1592,7 @@ static BOOL deltest21(struct smbcli_state **ppcli1, struct smbcli_state **ppcli2 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; diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c index 577f461219..b7bbb774b6 100644 --- a/source4/torture/raw/notify.c +++ b/source4/torture/raw/notify.c @@ -842,7 +842,7 @@ done: 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 @@ static BOOL test_notify_tcp_dis(TALLOC_CTX *mem_ctx) smbcli_transport_idle_handler(cli->transport, tcp_dis_handler, 250, cli); status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify); - CHECK_STATUS(status, NT_STATUS_NET_WRITE_FAULT); + CHECK_STATUS(status, NT_STATUS_LOCAL_DISCONNECT); done: torture_close_connection(cli); |