summaryrefslogtreecommitdiff
path: root/source4/ntvfs/cifs_posix_cli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ntvfs/cifs_posix_cli')
-rw-r--r--source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c b/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c
index 02fe9f2264..7b7c17a9be 100644
--- a/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c
+++ b/source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c
@@ -48,11 +48,34 @@
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));