diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-05-21 12:13:45 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-05-21 12:13:45 +1000 |
commit | fdec7fdaf5d4150e14311d9b3bb2da7358a407ff (patch) | |
tree | 5fbeb5de11214711f780e69c5e9ad1210c2e861e /source4/libcli/smb2/request.c | |
parent | 2f773ff347ec2828f94f4980a3aedbde37009737 (diff) | |
parent | 6d4424cd45333c3029b0272528485dd2b3f8e620 (diff) | |
download | samba-fdec7fdaf5d4150e14311d9b3bb2da7358a407ff.tar.gz samba-fdec7fdaf5d4150e14311d9b3bb2da7358a407ff.tar.bz2 samba-fdec7fdaf5d4150e14311d9b3bb2da7358a407ff.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
(This used to be commit 7594f79db6a0e8a46e2863829e5e050b03dfaec1)
Diffstat (limited to 'source4/libcli/smb2/request.c')
-rw-r--r-- | source4/libcli/smb2/request.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c index f52b0ceef2..64d427f889 100644 --- a/source4/libcli/smb2/request.c +++ b/source4/libcli/smb2/request.c @@ -43,6 +43,18 @@ void smb2_setup_bufinfo(struct smb2_request *req) } } + +/* destroy a request structure */ +static int smb2_request_destructor(struct smb2_request *req) +{ + if (req->transport) { + /* remove it from the list of pending requests (a null op if + its not in the list) */ + DLIST_REMOVE(req->transport->pending_recv, req); + } + return 0; +} + /* initialise a smb2 request */ @@ -122,6 +134,8 @@ struct smb2_request *smb2_request_init(struct smb2_transport *transport, uint16_ SCVAL(req->out.dynamic, 0, 0); } + talloc_set_destructor(req, smb2_request_destructor); + return req; } @@ -154,18 +168,13 @@ NTSTATUS smb2_request_destroy(struct smb2_request *req) _send() call fails completely */ if (!req) return NT_STATUS_UNSUCCESSFUL; - if (req->transport) { - /* remove it from the list of pending requests (a null op if - its not in the list) */ - DLIST_REMOVE(req->transport->pending_recv, req); - } - if (req->state == SMB2_REQUEST_ERROR && NT_STATUS_IS_OK(req->status)) { - req->status = NT_STATUS_INTERNAL_ERROR; + status = NT_STATUS_INTERNAL_ERROR; + } else { + status = req->status; } - status = req->status; talloc_free(req); return status; } |