s3/utils: smbcacls failed to detect DIRECTORIES using SMB2 (windows only)
commit3a5cf43fca3b3e2b0ccf9b4ce2be4968aa7baa80
authorNoel Power <noel.power@suse.com>
Thu, 20 Jul 2017 12:01:50 +0000 (20 13:01 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 1 Aug 2017 06:12:19 +0000 (1 08:12 +0200)
tree510cef5750329ef3ec78eeec43502aa0f97fb505
parentfd96410de65a588bc8db5917ea8b865718c40f6c
s3/utils: smbcacls failed to detect DIRECTORIES using SMB2 (windows only)

uint16_t get_fileinfo(...) returns file attributes, this function
called

     cli_qfileinfo_basic(cli, fnum, &mode, NULL, NULL, NULL,
                     NULL, NULL, NULL);

which was failing with NT_STATUS_ACCESS_DENIED errors when fnum above
was obtained via (when using protocol > SMB). Note: This only seems to be
an issue when run against a windows server, with smbd SMB1 & SMB2 work fine.

    status = cli_ntcreate(cli, filename, 0, CREATE_ACCESS_READ,
                  0, FILE_SHARE_READ|FILE_SHARE_WRITE,
                  FILE_OPEN, 0x0, 0x0, &fnum, NULL);

The failing cli_qfileinfo_basic call above is unnecessary as we can already
obtain the required information from the cli_ntcreate call

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12937

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
(cherry picked from commit c57dcafb150823b00fd873046e65a966a8488fa8)
source3/utils/smbcacls.c