diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-10-14 16:42:55 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-11-27 14:39:10 +0100 |
commit | 9393e28df59954414313bfae70ffb796d3e332fe (patch) | |
tree | 7d6bd2b55aea68cc6bb9c430e11a3c8a67851dd1 /source3 | |
parent | 22ee3b472da68e3f1d202ace44e2adaca51211c0 (diff) | |
download | samba-9393e28df59954414313bfae70ffb796d3e332fe.tar.gz samba-9393e28df59954414313bfae70ffb796d3e332fe.tar.xz samba-9393e28df59954414313bfae70ffb796d3e332fe.zip |
s3:smb2_server: fix drain_socket error handling
smbd_smb2_request_error_ex() should return NTSTATUS and the caller
will terminate the connection.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/smb2_server.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 1bebee10731..19faeeaabc6 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -2644,10 +2644,24 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req, if (unread_bytes) { /* Recvfile error. Drain incoming socket. */ - size_t ret = drain_socket(req->sconn->sock, unread_bytes); + size_t ret; + + errno = 0; + ret = drain_socket(req->sconn->sock, unread_bytes); if (ret != unread_bytes) { - smbd_server_connection_terminate(req->sconn, - "Failed to drain SMB2 socket\n"); + NTSTATUS error; + + if (errno == 0) { + error = NT_STATUS_IO_DEVICE_ERROR; + } else { + error = map_nt_error_from_unix_common(errno); + } + + DEBUG(2, ("Failed to drain %u bytes from SMB2 socket: " + "ret[%u] errno[%d] => %s\n", + (unsigned)unread_bytes, + (unsigned)ret, errno, nt_errstr(error))); + return error; } } |