2 Unix SMB/CIFS implementation.
3 default print NTVFS backend
4 Copyright (C) Andrew Tridgell 2003
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.
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.
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.
21 this implements the print backend, called by the NTVFS subsystem to
22 handle requests on printing shares
28 connect to a share - used when a tree_connect operation comes
29 in. For printing shares this should check that the spool directory
32 static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
33 struct smbsrv_request *req, const char *sharename)
39 disconnect from a share
41 static NTSTATUS print_disconnect(struct ntvfs_module_context *ntvfs,
42 struct smbsrv_tcon *tcon)
48 lots of operations are not allowed on printing shares - mostly return NT_STATUS_ACCESS_DENIED
50 static NTSTATUS print_unlink(struct ntvfs_module_context *ntvfs,
51 struct smbsrv_request *req, struct smb_unlink *unl)
53 return NT_STATUS_ACCESS_DENIED;
58 ioctl - used for job query
60 static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
61 struct smbsrv_request *req, union smb_ioctl *io)
65 if (io->generic.level != RAW_IOCTL_IOCTL) {
66 return NT_STATUS_NOT_IMPLEMENTED;
69 if (io->ioctl.in.request == IOCTL_QUERY_JOB_INFO) {
70 /* a request for the print job id of an open print job */
71 io->ioctl.out.blob = data_blob_talloc(req, NULL, 32);
73 data_blob_clear(&io->ioctl.out.blob);
75 p = io->ioctl.out.blob.data;
76 SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
77 push_string(p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII);
78 push_string(p+18, lp_servicename(req->tcon->service), 13, STR_TERMINATE|STR_ASCII);
82 return NT_STATUS_INVALID_PARAMETER;
87 initialialise the print backend, registering ourselves with the ntvfs subsystem
89 NTSTATUS ntvfs_print_init(void)
96 /* fill in the name and type */
98 ops.type = NTVFS_PRINT;
100 /* fill in all the operations */
101 ops.connect = print_connect;
102 ops.disconnect = print_disconnect;
103 ops.unlink = print_unlink;
104 ops.ioctl = print_ioctl;
106 /* register ourselves with the NTVFS subsystem. We register under the name 'default'
107 as we wish to be the default backend */
108 ret = register_backend("ntvfs", &ops);
110 if (!NT_STATUS_IS_OK(ret)) {
111 DEBUG(0,("Failed to register PRINT backend!\n"));