s4:libcli/smb2: reapply request endtime
authorRalph Boehme <slow@samba.org>
Sun, 28 Oct 2018 01:05:45 +0000 (02:05 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 2 Nov 2018 20:21:13 +0000 (21:21 +0100)
tevent_req_finish() removed a possible request timeout, make sure to
reinstall it. This happened when an interim SMB2 response was received.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/libcli/smb2/transport.c

index 1d08289341bad2506a5f52c41a59b29f476ad579..18cc490be4804e9c1770aab51a53aca59a2de95f 100644 (file)
@@ -293,7 +293,24 @@ static void smb2_request_done(struct tevent_req *subreq)
 
        req->status = smb2cli_req_recv(req->subreq, req, &req->recv_iov, NULL, 0);
        if (NT_STATUS_EQUAL(req->status, STATUS_PENDING)) {
+               struct timeval endtime = smbXcli_req_endtime(subreq);
+               bool ok;
+
                req->cancel.can_cancel = true;
+               if (timeval_is_zero(&endtime)) {
+                       return;
+               }
+
+               ok = tevent_req_set_endtime(
+                       subreq, req->transport->ev, endtime);
+               if (!ok) {
+                       req->status = NT_STATUS_INTERNAL_ERROR;
+                       req->state = SMB2_REQUEST_ERROR;
+                       if (req->async.fn) {
+                               req->async.fn(req);
+                       }
+                       return;
+               }
                return;
        }
        TALLOC_FREE(req->subreq);