diff options
author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2022-08-22 15:50:02 +1200 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2022-08-23 07:46:18 +0000 |
commit | dee2505716df4b6b08cee42816ed34708e158459 (patch) | |
tree | 230c8a7d363a3626dd2ccbc7b8e56c15b5862a06 /libcli | |
parent | 877287e6b4ec7bdbfadee619dea5ff88cc003192 (diff) | |
download | samba-dee2505716df4b6b08cee42816ed34708e158459.tar.gz |
libcli/smb: Ensure we call tevent_req_nterror() on failure
Commit 3594c3ae202688fd8aae5f7f5e20464cb23feea9 added a NULL check for
'inhdr', but it meant we didn't always call tevent_req_nterror() when we
should.
Now we handle connection errors. We now also set an error status if the
NULL check fails.
I noticed this when an ECONNRESET error from a server refusing SMB1
wasn't handled, and the client subsequently hung in epoll_wait().
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15152
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 40d4912d841e6bcd7cd37810ef101d5f89268ee7)
Diffstat (limited to 'libcli')
-rw-r--r-- | libcli/smb/smbXcli_base.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index d2f55966c3a..11d13b574a7 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -4469,7 +4469,11 @@ static void smbXcli_negprot_smb1_done(struct tevent_req *subreq) NULL, /* pinbuf */ expected, ARRAY_SIZE(expected)); TALLOC_FREE(subreq); - if (inhdr == NULL || tevent_req_nterror(req, status)) { + if (tevent_req_nterror(req, status)) { + return; + } + if (inhdr == NULL) { + tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR); return; } |