From: Volker Lendecke Date: Thu, 4 Jun 2020 13:16:26 +0000 (+0200) Subject: pylibsmb: Use cli_qfileinfo_basic_send() in py_smb_filesize() X-Git-Tag: ldb-2.2.0~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee40012f6edd0eee0bf2c5f318dc8cebb75eb5df;p=thirdparty%2Fsamba.git pylibsmb: Use cli_qfileinfo_basic_send() in py_smb_filesize() This now does all protocols asynchronously Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index df324da7a3d..3fcc3424a57 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -883,27 +883,15 @@ static NTSTATUS py_smb_filesize(struct py_cli_state *self, uint16_t fnum, off_t *size) { NTSTATUS status; + struct tevent_req *req = NULL; - if (self->is_smb1) { - uint8_t *rdata = NULL; - struct tevent_req *req = NULL; - - req = cli_qfileinfo_send(NULL, self->ev, self->cli, fnum, - SMB_QUERY_FILE_ALL_INFO, 68, - CLI_BUFFER_SIZE); - if (!py_tevent_req_wait_exc(self, req)) { - return NT_STATUS_INTERNAL_ERROR; - } - status = cli_qfileinfo_recv(req, NULL, NULL, &rdata, NULL); - if (NT_STATUS_IS_OK(status)) { - *size = IVAL2_TO_SMB_BIG_UINT(rdata, 48); - } - TALLOC_FREE(req); - TALLOC_FREE(rdata); - } else { - status = cli_qfileinfo_basic(self->cli, fnum, NULL, size, - NULL, NULL, NULL, NULL, NULL); + req = cli_qfileinfo_basic_send(NULL, self->ev, self->cli, fnum); + if (!py_tevent_req_wait_exc(self, req)) { + return NT_STATUS_INTERNAL_ERROR; } + status = cli_qfileinfo_basic_recv( + req, NULL, size, NULL, NULL, NULL, NULL, NULL); + TALLOC_FREE(req); return status; }