s3:libsmb: Add try_posixinfo to SMBSRV struct. Only enable for SMB1 with UNIX for...
authorAndreas Schneider <asn@samba.org>
Mon, 25 Nov 2019 10:06:57 +0000 (11:06 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 19 Dec 2019 14:20:42 +0000 (14:20 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14101

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/libsmb_internal.h
source3/libsmb/libsmb_server.c

index bfb3e064297e157360a79c5544986ddb629dea44..7283bba2e7550d0deda017753107ba332d3c41da 100644 (file)
@@ -76,6 +76,7 @@ typedef struct DOS_ATTR_DESC {
 struct _SMBCSRV {
        struct cli_state *cli;
        dev_t dev;
+       bool try_posixinfo;
        bool no_pathinfo;
        bool no_pathinfo2;
        bool no_pathinfo3;
index 0067df48cac7bffd866e94d14787eafd47ef68b5..d4f71d8c8b70fe88655e33d37ca7845934175d28 100644 (file)
@@ -657,6 +657,15 @@ SMBC_server_internal(TALLOC_CTX *ctx,
        ZERO_STRUCTP(srv);
        DLIST_ADD(srv->cli, c);
        srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share));
+       srv->try_posixinfo = false;
+       /*
+        * Until SMB2 POSIX is done, only
+        * try POSIX stat on SMB1 with POSIX capabilities.
+        */
+       if ((smbXcli_conn_protocol(c->conn) < PROTOCOL_SMB2_02) &&
+           (smb1cli_conn_capabilities(c->conn) & CAP_UNIX)) {
+               srv->try_posixinfo = true;
+       }
         srv->no_pathinfo = False;
         srv->no_pathinfo2 = False;
        srv->no_pathinfo3 = False;