summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2019-01-11 14:25:32 +1300
committerJeremy Allison <jra@samba.org>2019-01-17 01:40:30 +0100
commit0304b08de5ba1b4a6e08568a559c52f7d9e943d3 (patch)
treec37d2dfd1ad149a9e5720ba70c44b9162f388c76 /source3/libsmb
parent345746ea5f4cca2620421ac0c8a649a596f5c19d (diff)
downloadsamba-0304b08de5ba1b4a6e08568a559c52f7d9e943d3.tar.gz
s3:pylibsmb: Add FILE_READ_ATTRIBUTES access to .loadfile() API
Add FILE_READ_ATTRIBUTES when opening the file handle, as we need to read the file's size. The .loadfile() API can end up calling cli_qfileinfo_basic() to get the file size. This can end up doing a 'FILE_ALL_INFORMATION' SMBv2 request underneath, which the MS-SMB2 spec (section 3.3.5.20.1 Handling SMB2_0_INFO_FILE) says the file handle must have FILE_READ_ATTRIBUTES access granted. I noticed this problem when running .loadfile() against the NTVFS server. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/pylibsmb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index ee1d91b90ed..b4903a9b8c5 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -928,7 +928,8 @@ static PyObject *py_smb_loadfile(struct py_cli_state *self, PyObject *args,
/* get a read file handle */
req = cli_ntcreate_send(NULL, self->ev, self->cli, filename, 0,
- FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+ FILE_READ_DATA | FILE_READ_ATTRIBUTES,
+ FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ, FILE_OPEN, 0,
SMB2_IMPERSONATION_IMPERSONATION, 0);
if (!py_tevent_req_wait_exc(self, req)) {