This commit was generated by cvs2svn to compensate for changes in r30,
[gd/samba-autobuild/.git] / source4 / ntvfs / ipc / vfs_ipc.c
1 /* 
2    Unix SMB/CIFS implementation.
3    default IPC$ NTVFS backend
4    Copyright (C) Andrew Tridgell 2003
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 /*
21   this implements the IPC$ backend, called by the NTVFS subsystem to
22   handle requests on IPC$ shares
23 */
24
25
26 #include "includes.h"
27
28 /*
29   connect to a share - always works 
30 */
31 static NTSTATUS ipc_connect(struct request_context *req, const char *sharename)
32 {
33         struct tcon_context *conn = req->conn;
34
35         conn->fs_type = talloc_strdup(conn->mem_ctx, "IPC");
36         conn->dev_type = talloc_strdup(conn->mem_ctx, "IPC");
37
38         return NT_STATUS_OK;
39 }
40
41 /*
42   disconnect from a share
43 */
44 static NTSTATUS ipc_disconnect(struct tcon_context *tcon)
45 {
46         return NT_STATUS_OK;
47 }
48
49 /*
50   delete a file
51 */
52 static NTSTATUS ipc_unlink(struct request_context *req, struct smb_unlink *unl)
53 {
54         return NT_STATUS_ACCESS_DENIED;
55 }
56
57
58 /*
59   ioctl interface - we don't do any
60 */
61 static NTSTATUS ipc_ioctl(struct request_context *req, struct smb_ioctl *io)
62 {
63         return NT_STATUS_ACCESS_DENIED;
64 }
65
66 /*
67   check if a directory exists
68 */
69 static NTSTATUS ipc_chkpath(struct request_context *req, struct smb_chkpath *cp)
70 {
71         return NT_STATUS_ACCESS_DENIED;
72 }
73
74 /*
75   return info on a pathname
76 */
77 static NTSTATUS ipc_qpathinfo(struct request_context *req, union smb_fileinfo *info)
78 {
79         return NT_STATUS_ACCESS_DENIED;
80 }
81
82 /*
83   set info on a pathname
84 */
85 static NTSTATUS ipc_setpathinfo(struct request_context *req, union smb_setfileinfo *st)
86 {
87         return NT_STATUS_ACCESS_DENIED;
88 }
89
90 /*
91   open a file
92 */
93 static NTSTATUS ipc_open(struct request_context *req, union smb_open *oi)
94 {
95         return NT_STATUS_ACCESS_DENIED;
96 }
97
98 /*
99   create a directory
100 */
101 static NTSTATUS ipc_mkdir(struct request_context *req, union smb_mkdir *md)
102 {
103         return NT_STATUS_ACCESS_DENIED;
104 }
105
106 /*
107   remove a directory
108 */
109 static NTSTATUS ipc_rmdir(struct request_context *req, struct smb_rmdir *rd)
110 {
111         return NT_STATUS_ACCESS_DENIED;
112 }
113
114 /*
115   rename a set of files
116 */
117 static NTSTATUS ipc_rename(struct request_context *req, struct smb_rename *ren)
118 {
119         return NT_STATUS_ACCESS_DENIED;
120 }
121
122 /*
123   copy a set of files
124 */
125 static NTSTATUS ipc_copy(struct request_context *req, struct smb_copy *cp)
126 {
127         return NT_STATUS_ACCESS_DENIED;
128 }
129
130 /*
131   read from a file
132 */
133 static NTSTATUS ipc_read(struct request_context *req, union smb_read *rd)
134 {
135         return NT_STATUS_ACCESS_DENIED;
136 }
137
138 /*
139   write to a file
140 */
141 static NTSTATUS ipc_write(struct request_context *req, union smb_write *wr)
142 {
143         return NT_STATUS_ACCESS_DENIED;
144 }
145
146 /*
147   seek in a file
148 */
149 static NTSTATUS ipc_seek(struct request_context *req, struct smb_seek *io)
150 {
151         return NT_STATUS_ACCESS_DENIED;
152 }
153
154 /*
155   flush a file
156 */
157 static NTSTATUS ipc_flush(struct request_context *req, struct smb_flush *io)
158 {
159         return NT_STATUS_ACCESS_DENIED;
160 }
161
162 /*
163   close a file
164 */
165 static NTSTATUS ipc_close(struct request_context *req, union smb_close *io)
166 {
167         return NT_STATUS_ACCESS_DENIED;
168 }
169
170 /*
171   exit - closing files?
172 */
173 static NTSTATUS ipc_exit(struct request_context *req)
174 {
175         return NT_STATUS_ACCESS_DENIED;
176 }
177
178 /*
179   lock a byte range
180 */
181 static NTSTATUS ipc_lock(struct request_context *req, union smb_lock *lck)
182 {
183         return NT_STATUS_ACCESS_DENIED;
184 }
185
186 /*
187   set info on a open file
188 */
189 static NTSTATUS ipc_setfileinfo(struct request_context *req, union smb_setfileinfo *info)
190 {
191         return NT_STATUS_ACCESS_DENIED;
192 }
193
194 /*
195   query info on a open file
196 */
197 static NTSTATUS ipc_qfileinfo(struct request_context *req, union smb_fileinfo *info)
198 {
199         return NT_STATUS_ACCESS_DENIED;
200 }
201
202
203 /*
204   return filesystem info
205 */
206 static NTSTATUS ipc_fsinfo(struct request_context *req, union smb_fsinfo *fs)
207 {
208         return NT_STATUS_ACCESS_DENIED;
209 }
210
211 /*
212   return print queue info
213 */
214 static NTSTATUS ipc_lpq(struct request_context *req, union smb_lpq *lpq)
215 {
216         return NT_STATUS_ACCESS_DENIED;
217 }
218
219 /* 
220    list files in a directory matching a wildcard pattern
221 */
222 NTSTATUS ipc_search_first(struct request_context *req, union smb_search_first *io,
223                           void *search_private, 
224                           BOOL (*callback)(void *, union smb_search_data *))
225 {
226         return NT_STATUS_ACCESS_DENIED;
227 }
228
229 /* 
230    continue listing files in a directory 
231 */
232 NTSTATUS ipc_search_next(struct request_context *req, union smb_search_next *io,
233                          void *search_private, 
234                          BOOL (*callback)(void *, union smb_search_data *))
235 {
236         return NT_STATUS_ACCESS_DENIED;
237 }
238
239 /* 
240    end listing files in a directory 
241 */
242 NTSTATUS ipc_search_close(struct request_context *req, union smb_search_close *io)
243 {
244         return NT_STATUS_ACCESS_DENIED;
245 }
246
247
248 /*
249   initialialise the IPC backend, registering ourselves with the ntvfs subsystem
250  */
251 BOOL ipc_vfs_init(void)
252 {
253         BOOL ret;
254         struct ntvfs_ops ops;
255
256         ZERO_STRUCT(ops);
257         
258         /* fill in all the operations */
259         ops.connect = ipc_connect;
260         ops.disconnect = ipc_disconnect;
261         ops.unlink = ipc_unlink;
262         ops.chkpath = ipc_chkpath;
263         ops.qpathinfo = ipc_qpathinfo;
264         ops.setpathinfo = ipc_setpathinfo;
265         ops.open = ipc_open;
266         ops.mkdir = ipc_mkdir;
267         ops.rmdir = ipc_rmdir;
268         ops.rename = ipc_rename;
269         ops.copy = ipc_copy;
270         ops.ioctl = ipc_ioctl;
271         ops.read = ipc_read;
272         ops.write = ipc_write;
273         ops.seek = ipc_seek;
274         ops.flush = ipc_flush;  
275         ops.close = ipc_close;
276         ops.exit = ipc_exit;
277         ops.lock = ipc_lock;
278         ops.setfileinfo = ipc_setfileinfo;
279         ops.qfileinfo = ipc_qfileinfo;
280         ops.fsinfo = ipc_fsinfo;
281         ops.lpq = ipc_lpq;
282         ops.search_first = ipc_search_first;
283         ops.search_next = ipc_search_next;
284         ops.search_close = ipc_search_close;
285
286         /* register ourselves with the NTVFS subsystem. */
287         ret = ntvfs_register("ipc", NTVFS_IPC, &ops);
288
289         if (!ret) {
290                 DEBUG(0,("Failed to register IPC backend!\n"));
291                 return False;
292         }
293
294         return True;
295 }