diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-08 05:39:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:34 -0500 |
commit | 893c62d38388b20c52cf3c45069d836c46f42bd3 (patch) | |
tree | b11304934190db80fd453089a88ff18ec4728bba /source4/ntvfs/posix/vfs_posix.c | |
parent | 8293df91bcec574fb4a2b290cc11dd83353264ae (diff) | |
download | samba-893c62d38388b20c52cf3c45069d836c46f42bd3.tar.gz samba-893c62d38388b20c52cf3c45069d836c46f42bd3.tar.bz2 samba-893c62d38388b20c52cf3c45069d836c46f42bd3.zip |
r2249: got rid of some more mem_ctx elements in structures
(This used to be commit 21ef338cbbe96acc8594ffc550ef60c6a40fb951)
Diffstat (limited to 'source4/ntvfs/posix/vfs_posix.c')
-rw-r--r-- | source4/ntvfs/posix/vfs_posix.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 93cfbd74a9..8269f9bba7 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -1,8 +1,9 @@ /* Unix SMB/CIFS implementation. + POSIX NTVFS backend - Copyright (C) Andrew Tridgell 2003 - Copyright (C) Stefan (metze) Metzmacher 2004 + + Copyright (C) Andrew Tridgell 2004 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +25,8 @@ */ #include "include/includes.h" +#include "vfs_posix.h" + /* connect to a share - used when a tree_connect operation comes @@ -33,16 +36,31 @@ */ static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename) { - DEBUG(0, ("Connection to share [%s] ACCESS DENIED!\n", sharename)); - DEBUGADD(0,("This is because your using the 'ntvfs handler = default'.\n")); - DEBUGADD(0,("This backend is not functional at the moment.\n")); - DEBUGADD(0,("Please use one of the following backends:\n")); - DEBUGADD(0,("cifs - a proxy to another cifs-server\n")); - DEBUGADD(0,("simple - a very, very simple posix backend\n")); - DEBUGADD(0,(" all file acess is done as user 'root'\n")); - DEBUGADD(0,(" Please don't use this a sensitive data!!!\n")); - - return NT_STATUS_DEVICE_CONFIGURATION_ERROR; + struct smbsrv_tcon *tcon = req->tcon; + struct pvfs_state *pvfs; + struct stat st; + + DEBUG(0,("WARNING: the posix vfs handler is incomplete - you probably want \"ntvfs handler = simple\"\n")); + + pvfs = talloc_named(tcon, sizeof(struct pvfs_state), "pvfs_connect(%s)", sharename); + if (pvfs == NULL) { + return NT_STATUS_NO_MEMORY; + } + + pvfs->base_directory = talloc_strdup(pvfs, lp_pathname(tcon->service)); + + /* the directory must exist. Note that we deliberately don't + check that it is readable */ + if (stat(pvfs->base_directory, &st) != 0 || !S_ISDIR(st.st_mode)) { + DEBUG(0,("pvfs_connect: '%s' is not a directory, when connecting to [%s]\n", + pvfs->base_directory, sharename)); + return NT_STATUS_BAD_NETWORK_NAME; + } + + tcon->fs_type = talloc_strdup(tcon, "NTFS"); + tcon->dev_type = talloc_strdup(tcon, "A:"); + + return NT_STATUS_OK; } /* |