summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/vfs_posix.c
blob: 93cfbd74a917dcf964d9dc0b939497c476b51ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* 
   Unix SMB/CIFS implementation.
   POSIX NTVFS backend
   Copyright (C) Andrew Tridgell 2003
   Copyright (C) Stefan (metze) Metzmacher 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
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
  this implements most of the POSIX NTVFS backend
  This is the default backend
*/

#include "include/includes.h"

/*
  connect to a share - used when a tree_connect operation comes
  in. For a disk based backend we needs to ensure that the base
  directory exists (tho it doesn't need to be accessible by the user,
  that comes later)
*/
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;
}

/*
  disconnect from a share
*/
static NTSTATUS pvfs_disconnect(struct smbsrv_tcon *tcon)
{
	return NT_STATUS_OK;
}

/*
  initialialise the POSIX disk backend, registering ourselves with the ntvfs subsystem
 */
NTSTATUS ntvfs_posix_init(void)
{
	NTSTATUS ret;
	struct ntvfs_ops ops;

	ZERO_STRUCT(ops);

	ops.name = "default";
	ops.type = NTVFS_DISK;
	
	/* fill in all the operations */
	ops.connect = pvfs_connect;
	ops.disconnect = pvfs_disconnect;

	/* register ourselves with the NTVFS subsystem. We register under the name 'default'
	   as we wish to be the default backend */
	ret = register_backend("ntvfs", &ops);

	if (!NT_STATUS_IS_OK(ret)) {
		DEBUG(0,("Failed to register POSIX backend!\n"));
	}

	return ret;
}