Have ntvfs_connect() accept union smb_tcon *tcon instead of char* sharename
authorSam Liddicott <sam@liddicott.com>
Thu, 14 May 2009 07:58:50 +0000 (08:58 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 20 May 2009 11:32:27 +0000 (13:32 +0200)
This change brings ntvfs_connect into compliance with other ntvfs functions
which take an ntvfs module, an ntvfs request and an smb io union.

It now becomes the responsibility of ntvfs modules to examine
tcon->generic.level themselves and derive the share name and any other
options
directly; e.g.

const char *sharename;

switch (tcon->generic.level) {
case RAW_TCON_TCON:
sharename = tcon->tcon.in.service;
break;
case RAW_TCON_TCONX:
sharename = tcon->tconx.in.path;
break;
case RAW_TCON_SMB2:
default:
return NT_STATUS_INVALID_LEVEL;
}

if (strncmp(sharename, "\\\\", 2) == 0) {
char *p = strchr(sharename+2, '\\');
if (p) {
sharename = p + 1;
}
}

service.c smbsrv_tcon_backend() is called before ntvfs_connect and fills in
some of the tcon->..out values.
For the case of RAW_TCON_TCONX, it filles out tcon->tconx.out.tid and
tcon->tconx.out.options

For the case of RAW_TCON_TCON it fills out tcon->tcon.out.tid and
tcon->tcon.out.max_xmit

Thus the ntvfs_connect function for vfs modules may override these values
if desired, but are not required to.

ntvfs_connect functions are required to fill in the tcon->tconx.out.*_type
fields, for RAW_TCON_TCONX, perhaps something like:

if (tcon->generic.level == RAW_TCON_TCONX) {
tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
}

Signed-off-by: Sam Liddicott <sam@liddicott.com>
(I fixed the ntvfs_connect() in the smb_server/smb2/
 and the RAW_TCON_SMB2 switch case in the modules)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 files changed:
source4/ntvfs/cifs/vfs_cifs.c
source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c
source4/ntvfs/ipc/vfs_ipc.c
source4/ntvfs/nbench/vfs_nbench.c
source4/ntvfs/ntvfs.h
source4/ntvfs/ntvfs_interface.c
source4/ntvfs/posix/vfs_posix.c
source4/ntvfs/print/vfs_print.c
source4/ntvfs/simple/vfs_simple.c
source4/ntvfs/smb2/vfs_smb2.c
source4/ntvfs/unixuid/vfs_unixuid.c
source4/smb_server/smb/reply.c
source4/smb_server/smb/service.c
source4/smb_server/smb2/tcon.c

index be9096b01f727c7f9c037d936b6f000e5f2c0569..1cb6a46615a0f3b779b913074e4ca675b23c3d7a 100644 (file)
@@ -136,7 +136,8 @@ static bool oplock_handler(struct smbcli_transport *transport, uint16_t tid, uin
   connect to a share - used when a tree_connect operation comes in.
 */
 static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, 
-                            struct ntvfs_request *req, const char *sharename)
+                            struct ntvfs_request *req,
+                            union smb_tcon *tcon)
 {
        NTSTATUS status;
        struct cvfs_private *p;
@@ -147,6 +148,28 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
 
        struct cli_credentials *credentials;
        bool machine_account;
+       const char* sharename;
+
+       switch (tcon->generic.level) {
+       case RAW_TCON_TCON:
+               sharename = tcon->tcon.in.service;
+               break;
+       case RAW_TCON_TCONX:
+               sharename = tcon->tconx.in.path;
+               break;
+       case RAW_TCON_SMB2:
+               sharename = tcon->smb2.in.path;
+               break;
+       default:
+               return NT_STATUS_INVALID_LEVEL;
+       }
+
+       if (strncmp(sharename, "\\\\", 2) == 0) {
+               char *p = strchr(sharename+2, '\\');
+               if (p) {
+                       sharename = p + 1;
+               }
+       }
 
        /* Here we need to determine which server to connect to.
         * For now we use parametric options, type cifs.
@@ -242,6 +265,11 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        /* we need to receive oplock break requests from the server */
        smbcli_oplock_handler(p->transport, oplock_handler, p);
 
index 02fe9f226431f7825e0a361c99912c87b36e8db7..7b7c17a9be1a1e5019e77a8f91aa9c478a6050c8 100644 (file)
   that comes later)
 */
 static NTSTATUS cifspsx_connect(struct ntvfs_module_context *ntvfs,
-                            struct ntvfs_request *req, const char *sharename)
+                               struct ntvfs_request *req,
+                               union smb_tcon* tcon)
 {
        struct stat st;
        struct cifspsx_private *p;
        struct share_config *scfg = ntvfs->ctx->config;
+       const char *sharename;
+
+       switch (tcon->generic.level) {
+       case RAW_TCON_TCON:
+               sharename = tcon->tcon.in.service;
+               break;
+       case RAW_TCON_TCONX:
+               sharename = tcon->tconx.in.path;
+               break;
+       case RAW_TCON_SMB2:
+               sharename = tcon->smb2.in.path;
+               break;
+       default:
+               return NT_STATUS_INVALID_LEVEL;
+       }
+
+       if (strncmp(sharename, "\\\\", 2) == 0) {
+               char *p = strchr(sharename+2, '\\');
+               if (p) {
+                       sharename = p + 1;
+               }
+       }
 
        p = talloc(ntvfs, struct cifspsx_private);
        NT_STATUS_HAVE_NO_MEMORY(p);
@@ -74,6 +97,11 @@ static NTSTATUS cifspsx_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        ntvfs->private_data = p;
 
        DEBUG(0,("WARNING: ntvfs cifs posix: connect to share [%s] with ROOT privileges!!!\n",sharename));
index 2f05a86dfab882e90e43f626d5277b0197465d7c..20b00f24e3b42db817a7a9c72f6ca68ba5d287ab 100644 (file)
@@ -88,10 +88,33 @@ static struct pipe_state *pipe_state_find_key(struct ipc_private *ipriv, struct
   connect to a share - always works 
 */
 static NTSTATUS ipc_connect(struct ntvfs_module_context *ntvfs,
-                           struct ntvfs_request *req, const char *sharename)
+                           struct ntvfs_request *req,
+                           union smb_tcon* tcon)
 {
        NTSTATUS status;
        struct ipc_private *ipriv;
+       const char *sharename;
+
+       switch (tcon->generic.level) {
+       case RAW_TCON_TCON:
+               sharename = tcon->tcon.in.service;
+               break;
+       case RAW_TCON_TCONX:
+               sharename = tcon->tconx.in.path;
+               break;
+       case RAW_TCON_SMB2:
+               sharename = tcon->smb2.in.path;
+               break;
+       default:
+               return NT_STATUS_INVALID_LEVEL;
+       }
+
+       if (strncmp(sharename, "\\\\", 2) == 0) {
+               char *p = strchr(sharename+2, '\\');
+               if (p) {
+                       sharename = p + 1;
+               }
+       }
 
        ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "IPC");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->fs_type);
@@ -99,6 +122,11 @@ static NTSTATUS ipc_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "IPC");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        /* prepare the private state for this connection */
        ipriv = talloc(ntvfs, struct ipc_private);
        NT_STATUS_HAVE_NO_MEMORY(ipriv);
index 7ba2e7c649cfd9efb5ff6cef8da948024d4010ab..2500140762ba3963fd4db984a44dcc250706d178 100644 (file)
@@ -111,7 +111,8 @@ static char *nbench_ntvfs_handle_string(struct ntvfs_request *req, struct ntvfs_
   connect to a share - used when a tree_connect operation comes in.
 */
 static NTSTATUS nbench_connect(struct ntvfs_module_context *ntvfs,
-                              struct ntvfs_request *req, const char *sharename)
+                              struct ntvfs_request *req,
+                              union smb_tcon* con)
 {
        struct nbench_private *nprivates;
        NTSTATUS status;
@@ -133,7 +134,7 @@ static NTSTATUS nbench_connect(struct ntvfs_module_context *ntvfs,
 
        ntvfs->private_data = nprivates;
 
-       status = ntvfs_next_connect(ntvfs, req, sharename);
+       status = ntvfs_next_connect(ntvfs, req, con);
 
        return status;
 }
index b62595967fb8a098348ef5147b07b32d6521a54d..5e9c6577372cb33a12a0f1175b84ac38a4721e79 100644 (file)
@@ -49,7 +49,7 @@ struct ntvfs_ops {
        /* initial setup */
        NTSTATUS (*connect)(struct ntvfs_module_context *ntvfs,
                            struct ntvfs_request *req,
-                           const char *sharename);
+                           union smb_tcon *tcon);
        NTSTATUS (*disconnect)(struct ntvfs_module_context *ntvfs);
 
        /* async_setup - called when a backend is processing a async request */
index 6d3fe55c06f032f05cc017100d839b0288788224..808bd97e61c902a005bb41cd54bc64a314b0cfe1 100644 (file)
 #include "ntvfs/ntvfs.h"
 
 /* connect/disconnect */
-NTSTATUS ntvfs_connect(struct ntvfs_request *req, const char *sharename)
+NTSTATUS ntvfs_connect(struct ntvfs_request *req, union smb_tcon *tcon)
 {
        struct ntvfs_module_context *ntvfs = req->ctx->modules;
        if (!ntvfs->ops->connect) {
                return NT_STATUS_NOT_IMPLEMENTED;
        }
-       return ntvfs->ops->connect(ntvfs, req, sharename);
+       return ntvfs->ops->connect(ntvfs, req, tcon);
 }
 
 NTSTATUS ntvfs_disconnect(struct ntvfs_context *ntvfs_ctx)
@@ -335,12 +335,13 @@ NTSTATUS ntvfs_cancel(struct ntvfs_request *req)
 
 /* initial setup */
 NTSTATUS ntvfs_next_connect(struct ntvfs_module_context *ntvfs, 
-                                    struct ntvfs_request *req, const char *sharename)
+                                    struct ntvfs_request *req,
+                                    union smb_tcon *tcon)
 {
        if (!ntvfs->next || !ntvfs->next->ops->connect) {
                return NT_STATUS_NOT_IMPLEMENTED;
        }
-       return ntvfs->next->ops->connect(ntvfs->next, req, sharename);
+       return ntvfs->next->ops->connect(ntvfs->next, req, tcon);
 }
 
 NTSTATUS ntvfs_next_disconnect(struct ntvfs_module_context *ntvfs)
index 29ef701deebd846c9f3c01f4692026848ba1682f..5134c0a6088f52347e36accaf4069f347d98a5c5 100644 (file)
@@ -168,12 +168,35 @@ static int pvfs_state_destructor(struct pvfs_state *pvfs)
   that comes later)
 */
 static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
-                            struct ntvfs_request *req, const char *sharename)
+                            struct ntvfs_request *req,
+                            union smb_tcon* tcon)
 {
        struct pvfs_state *pvfs;
        struct stat st;
        char *base_directory;
        NTSTATUS status;
+       const char *sharename;
+
+       switch (tcon->generic.level) {
+       case RAW_TCON_TCON:
+               sharename = tcon->tcon.in.service;
+               break;
+       case RAW_TCON_TCONX:
+               sharename = tcon->tconx.in.path;
+               break;
+       case RAW_TCON_SMB2:
+               sharename = tcon->smb2.in.path;
+               break;
+       default:
+               return NT_STATUS_INVALID_LEVEL;
+       }
+
+       if (strncmp(sharename, "\\\\", 2) == 0) {
+               char *p = strchr(sharename+2, '\\');
+               if (p) {
+                       sharename = p + 1;
+               }
+       }
 
        /*
         * TODO: call this from ntvfs_posix_init()
@@ -209,6 +232,11 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        ntvfs->private_data = pvfs;
 
        pvfs->brl_context = brl_init(pvfs, 
index 540e51a43b779a3ed6ecb12d3e1829497f3807b9..0530e04f6dfefa23bd1ee037aecf6ba68dc0c365 100644 (file)
@@ -32,7 +32,7 @@
   is available
 */
 static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
-                             struct ntvfs_request *req, const char *sharename)
+                             struct ntvfs_request *req, union smb_tcon* tcon)
 {
        ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->fs_type);
@@ -40,6 +40,11 @@ static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "LPT1:");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        return NT_STATUS_OK;
 }
 
index bf0afcec0a8e1fd6b3584e766abdc97fab4316f5..aabaa3c47f7852961ddf89afd353a1d139e417b5 100644 (file)
   that comes later)
 */
 static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
-                            struct ntvfs_request *req, const char *sharename)
+                            struct ntvfs_request *req,
+                            union smb_tcon* tcon)
 {
        struct stat st;
        struct svfs_private *p;
        struct share_config *scfg = ntvfs->ctx->config;
+       const char *sharename;
+
+       switch (tcon->generic.level) {
+       case RAW_TCON_TCON:
+               sharename = tcon->tcon.in.service;
+               break;
+       case RAW_TCON_TCONX:
+               sharename = tcon->tconx.in.path;
+               break;
+       case RAW_TCON_SMB2:
+               sharename = tcon->smb2.in.path;
+               break;
+       default:
+               return NT_STATUS_INVALID_LEVEL;
+       }
+
+       if (strncmp(sharename, "\\\\", 2) == 0) {
+               char *p = strchr(sharename+2, '\\');
+               if (p) {
+                       sharename = p + 1;
+               }
+       }
 
        p = talloc(ntvfs, struct svfs_private);
        NT_STATUS_HAVE_NO_MEMORY(p);
@@ -73,6 +96,11 @@ static NTSTATUS svfs_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        ntvfs->private_data = p;
 
        return NT_STATUS_OK;
index d1e194f6386d1ed25846c0c2308948cc971e586c..6fc0d42b025bf27b46fe7b63233390b44233b096 100644 (file)
@@ -154,11 +154,12 @@ static NTSTATUS smb2_get_roothandle(struct smb2_tree *tree, struct smb2_handle *
   connect to a share - used when a tree_connect operation comes in.
 */
 static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, 
-                            struct ntvfs_request *req, const char *sharename)
+                            struct ntvfs_request *req,
+                            union smb_tcon* tcon)
 {
        NTSTATUS status;
        struct cvfs_private *p;
-       const char *host, *user, *pass, *domain, *remote_share;
+       const char *host, *user, *pass, *domain, *remote_share, *sharename;
        struct composite_context *creq;
        struct share_config *scfg = ntvfs->ctx->config;
        struct smb2_tree *tree;
@@ -166,6 +167,27 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        bool machine_account;
        struct smbcli_options options;
 
+       switch (tcon->generic.level) {
+       case RAW_TCON_TCON:
+               sharename = tcon->tcon.in.service;
+               break;
+       case RAW_TCON_TCONX:
+               sharename = tcon->tconx.in.path;
+               break;
+       case RAW_TCON_SMB2:
+               sharename = tcon->smb2.in.path;
+               break;
+       default:
+               return NT_STATUS_INVALID_LEVEL;
+       }
+
+       if (strncmp(sharename, "\\\\", 2) == 0) {
+               char *p = strchr(sharename+2, '\\');
+               if (p) {
+                       sharename = p + 1;
+               }
+       }
+
        /* Here we need to determine which server to connect to.
         * For now we use parametric options, type cifs.
         * Later we will use security=server and auth_server.c.
@@ -251,6 +273,11 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "A:");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        /* we need to receive oplock break requests from the server */
        /* TODO: enable oplocks 
        smbcli_oplock_handler(p->transport, oplock_handler, p);
index 062fa41889f589ac3925ff93e9297348a2c4bef6..3ef341d61ad64798b319ac9d985e06d7475666fe 100644 (file)
@@ -293,7 +293,7 @@ static NTSTATUS unixuid_setup_security(struct ntvfs_module_context *ntvfs,
   connect to a share - used when a tree_connect operation comes in.
 */
 static NTSTATUS unixuid_connect(struct ntvfs_module_context *ntvfs,
-                               struct ntvfs_request *req, const char *sharename)
+                               struct ntvfs_request *req, union smb_tcon *tcon)
 {
        struct unixuid_private *priv;
        NTSTATUS status;
@@ -321,7 +321,7 @@ static NTSTATUS unixuid_connect(struct ntvfs_module_context *ntvfs,
        /* we don't use PASS_THRU_REQ here, as the connect operation runs with 
           root privileges. This allows the backends to setup any database
           links they might need during the connect. */
-       status = ntvfs_next_connect(ntvfs, req, sharename);
+       status = ntvfs_next_connect(ntvfs, req, tcon);
 
        return status;
 }
index 1b309a0c1feb732d08eb399f89ccc6dce10852c0..ec7b6783fd437eb559c26b8598ded370262ad427 100644 (file)
@@ -53,16 +53,6 @@ static void reply_tcon_send(struct ntvfs_request *ntvfs)
 
        SMBSRV_CHECK_ASYNC_STATUS(con, union smb_tcon);
 
-       if (con->generic.level == RAW_TCON_TCON) {
-               con->tcon.out.max_xmit = req->smb_conn->negotiate.max_recv;
-               con->tcon.out.tid = req->tcon->tid;
-       } else {
-               /* TODO: take a look at tconx.in.flags! */
-               con->tconx.out.tid = req->tcon->tid;
-               con->tconx.out.dev_type = talloc_strdup(req, req->tcon->ntvfs->dev_type);
-               con->tconx.out.fs_type = talloc_strdup(req, req->tcon->ntvfs->fs_type);
-       }
-
        /* construct reply */
        smbsrv_setup_reply(req, 2, 0);
 
@@ -109,7 +99,7 @@ void smbsrv_reply_tcon(struct smbsrv_request *req)
        SMBSRV_SETUP_NTVFS_REQUEST(reply_tcon_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
 
        /* Invoke NTVFS connection hook */
-       SMBSRV_CALL_NTVFS_BACKEND(ntvfs_connect(req->ntvfs, req->tcon->share_name));
+       SMBSRV_CALL_NTVFS_BACKEND(ntvfs_connect(req->ntvfs, con));
 }
 
 
@@ -123,16 +113,6 @@ static void reply_tcon_and_X_send(struct ntvfs_request *ntvfs)
 
        SMBSRV_CHECK_ASYNC_STATUS(con, union smb_tcon);
 
-       if (con->generic.level == RAW_TCON_TCON) {
-               con->tcon.out.max_xmit = req->smb_conn->negotiate.max_recv;
-               con->tcon.out.tid = req->tcon->tid;
-       } else {
-               /* TODO: take a look at tconx.in.flags! */
-               con->tconx.out.tid = req->tcon->tid;
-               con->tconx.out.dev_type = talloc_strdup(req, req->tcon->ntvfs->dev_type);
-               con->tconx.out.fs_type = talloc_strdup(req, req->tcon->ntvfs->fs_type);
-       }
-
        /* construct reply - two variants */
        if (req->smb_conn->negotiate.protocol < PROTOCOL_NT1) {
                smbsrv_setup_reply(req, 2, 0);
@@ -205,7 +185,7 @@ void smbsrv_reply_tcon_and_X(struct smbsrv_request *req)
        SMBSRV_SETUP_NTVFS_REQUEST(reply_tcon_and_X_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
 
        /* Invoke NTVFS connection hook */
-       SMBSRV_CALL_NTVFS_BACKEND(ntvfs_connect(req->ntvfs, req->tcon->share_name));
+       SMBSRV_CALL_NTVFS_BACKEND(ntvfs_connect(req->ntvfs, con));
 }
 
 
index 85d169fc1386b347a3fda596eba5b2447cfc9fe0..5d8d6bbc3230af4bf26c1063b4b53e6219c24fec 100644 (file)
@@ -158,7 +158,7 @@ static NTSTATUS make_connection(struct smbsrv_request *req,
 }
 
 /*
-  backend for tree connect call
+  backend for tree connect call, in preparation for calling ntvfs_connect()
 */
 NTSTATUS smbsrv_tcon_backend(struct smbsrv_request *req, union smb_tcon *con)
 {
@@ -188,6 +188,7 @@ NTSTATUS smbsrv_tcon_backend(struct smbsrv_request *req, union smb_tcon *con)
                return status;
        }
 
+       con->tconx.out.tid = req->tcon->tid;
        con->tconx.out.options = SMB_SUPPORT_SEARCH_BITS | (share_int_option(req->tcon->ntvfs->config, SHARE_CSC_POLICY, SHARE_CSC_POLICY_DEFAULT) << 2);
        if (share_bool_option(req->tcon->ntvfs->config, SHARE_MSDFS_ROOT, SHARE_MSDFS_ROOT_DEFAULT) && lp_host_msdfs(req->smb_conn->lp_ctx)) {
                con->tconx.out.options |= SMB_SHARE_IN_DFS;
index be64013bb252597b8bd644b925f68fd3e81bcaed..843a8dac8d400bd69792104620b3c04183cd7ad5 100644 (file)
@@ -335,13 +335,6 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
                goto failed;
        }
 
-       /* Invoke NTVFS connection hook */
-       status = ntvfs_connect(req->ntvfs, scfg->name);
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(0,("smb2srv_tcon_backend: NTVFS ntvfs_connect() failed!\n"));
-               goto failed;
-       }
-
        io->smb2.out.share_type   = (unsigned)type; /* 1 - DISK, 2 - Print, 3 - IPC */
        io->smb2.out.reserved     = 0;
        io->smb2.out.flags        = 0x00000000;
@@ -350,6 +343,13 @@ static NTSTATUS smb2srv_tcon_backend(struct smb2srv_request *req, union smb_tcon
 
        io->smb2.out.tid        = tcon->tid;
 
+       /* Invoke NTVFS connection hook */
+       status = ntvfs_connect(req->ntvfs, io);
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(0,("smb2srv_tcon_backend: NTVFS ntvfs_connect() failed!\n"));
+               goto failed;
+       }
+
        return NT_STATUS_OK;
 
 failed: