r1280: rename struct request_context to smbsrv_request
[garming/samba-autobuild/.git] / source4 / ntvfs / posix / vfs_posix.c
1 /* 
2    Unix SMB/CIFS implementation.
3    POSIX NTVFS backend
4    Copyright (C) Andrew Tridgell 2003
5    Copyright (C) Stefan (metze) Metzmacher 2004
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21 /*
22   this implements most of the POSIX NTVFS backend
23   This is the default backend
24 */
25
26 #include "include/includes.h"
27
28 /*
29   connect to a share - used when a tree_connect operation comes
30   in. For a disk based backend we needs to ensure that the base
31   directory exists (tho it doesn't need to be accessible by the user,
32   that comes later)
33 */
34 static NTSTATUS pvfs_connect(struct smbsrv_request *req, const char *sharename)
35 {
36         DEBUG(0,   ("Connection to share [%s] ACCESS DENIED!\n", sharename));
37         DEBUGADD(0,("This is because your using the 'ntvfs handler = default'.\n"));
38         DEBUGADD(0,("This backend is not functional at the moment.\n"));
39         DEBUGADD(0,("Please use one of the following backends:\n"));
40         DEBUGADD(0,("cifs - a proxy to another cifs-server\n"));
41         DEBUGADD(0,("simple - a very, very simple posix backend\n"));
42         DEBUGADD(0,("         all file acess is done as user 'root'\n"));
43         DEBUGADD(0,("         Please don't use this a sensitive data!!!\n"));
44
45         return NT_STATUS_ACCESS_DENIED;
46 }
47
48 /*
49   disconnect from a share
50 */
51 static NTSTATUS pvfs_disconnect(struct tcon_context *tcon)
52 {
53         return NT_STATUS_OK;
54 }
55
56 /*
57   initialialise the POSIX disk backend, registering ourselves with the ntvfs subsystem
58  */
59 NTSTATUS ntvfs_posix_init(void)
60 {
61         NTSTATUS ret;
62         struct ntvfs_ops ops;
63
64         ZERO_STRUCT(ops);
65
66         ops.name = "default";
67         ops.type = NTVFS_DISK;
68         
69         /* fill in all the operations */
70         ops.connect = pvfs_connect;
71         ops.disconnect = pvfs_disconnect;
72
73         /* register ourselves with the NTVFS subsystem. We register under the name 'default'
74            as we wish to be the default backend */
75         ret = register_backend("ntvfs", &ops);
76
77         if (!NT_STATUS_IS_OK(ret)) {
78                 DEBUG(0,("Failed to register POSIX backend!\n"));
79         }
80
81         return ret;
82 }