diff options
Diffstat (limited to 'source4/ntvfs/smb2')
-rw-r--r-- | source4/ntvfs/smb2/vfs_smb2.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source4/ntvfs/smb2/vfs_smb2.c b/source4/ntvfs/smb2/vfs_smb2.c index d1e194f638..6fc0d42b02 100644 --- a/source4/ntvfs/smb2/vfs_smb2.c +++ b/source4/ntvfs/smb2/vfs_smb2.c @@ -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); |