s3: libsmb: Ensure SMB1 cli_qpathinfo2() doesn't return an inode number.
authorJeremy Allison <jra@samba.org>
Thu, 17 Oct 2019 18:39:02 +0000 (11:39 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 4 Nov 2019 07:36:17 +0000 (07:36 +0000)
The info level it uses doesn't return that, previously we
were using the field that is returned as the EA size as
the inode number (which is usually zero, so the code in
libsmbclient would then synthesize an inode number from
a hash of the pathname, which is all it can do for SMB1).

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit d495074ee27a5f528d5156a69800ee58d799b1eb)

source3/libsmb/clirap.c

index e80dfc92a77b0bd2dd6c614e6f05d2f24dda8e1e..b4b40ebdab4e915d01fb89bac1e2da8c325e60fc 100644 (file)
@@ -855,7 +855,15 @@ NTSTATUS cli_qpathinfo2_recv(struct tevent_req *req,
                 *size = IVAL2_TO_SMB_BIG_UINT(state->data,48);
        }
        if (ino) {
-               *ino = IVAL(state->data, 64);
+               /*
+                * SMB1 qpathinfo2 uses SMB_QUERY_FILE_ALL_INFO
+                * which doesn't return an inode number (fileid).
+                * We can't change this to one of the FILE_ID
+                * info levels as only Win2003 and above support
+                * these [MS-SMB: 2.2.2.3.1] and the SMB1 code
+                * needs to support older servers.
+                */
+               *ino = 0;
        }
        return NT_STATUS_OK;
 }