]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/smb: Ensure we call tevent_req_nterror() on failure
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 22 Aug 2022 03:50:02 +0000 (15:50 +1200)
committerStefan Metzmacher <metze@samba.org>
Mon, 22 Aug 2022 08:02:36 +0000 (08:02 +0000)
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>
libcli/smb/smbXcli_base.c

index d2f55966c3a26d85e5b55cb91c655ec7c99c6be6..11d13b574a76377be5089f0d7ae14dc7684977f1 100644 (file)
@@ -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;
        }