diff options
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/raw/clitransport.c | 12 | ||||
-rw-r--r-- | source4/libcli/smb2/transport.c | 12 |
2 files changed, 16 insertions, 8 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); |