s3-smb: Remove the obsolete signal type cast.
[Samba/nascimento.git] / source4 / ntvfs / print / vfs_print.c
blob0530e04f6dfefa23bd1ee037aecf6ba68dc0c365
1 /*
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 3 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, see <http://www.gnu.org/licenses/>.
20 this implements the print backend, called by the NTVFS subsystem to
21 handle requests on printing shares
24 #include "includes.h"
25 #include "libcli/raw/ioctl.h"
26 #include "ntvfs/ntvfs.h"
27 #include "param/param.h"
30 connect to a share - used when a tree_connect operation comes
31 in. For printing shares this should check that the spool directory
32 is available
34 static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
35 struct ntvfs_request *req, union smb_tcon* tcon)
37 ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
38 NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->fs_type);
40 ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "LPT1:");
41 NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
43 if (tcon->generic.level == RAW_TCON_TCONX) {
44 tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
45 tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
48 return NT_STATUS_OK;
52 disconnect from a share
54 static NTSTATUS print_disconnect(struct ntvfs_module_context *ntvfs)
56 return NT_STATUS_OK;
60 lots of operations are not allowed on printing shares - mostly return NT_STATUS_ACCESS_DENIED
62 static NTSTATUS print_unlink(struct ntvfs_module_context *ntvfs,
63 struct ntvfs_request *req,
64 union smb_unlink *unl)
66 return NT_STATUS_ACCESS_DENIED;
71 ioctl - used for job query
73 static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
74 struct ntvfs_request *req, union smb_ioctl *io)
76 char *p;
78 if (io->generic.level != RAW_IOCTL_IOCTL) {
79 return NT_STATUS_NOT_IMPLEMENTED;
82 if (io->ioctl.in.request == IOCTL_QUERY_JOB_INFO) {
84 /* a request for the print job id of an open print job */
85 io->ioctl.out.blob = data_blob_talloc(req, NULL, 32);
87 data_blob_clear(&io->ioctl.out.blob);
89 p = (char *)io->ioctl.out.blob.data;
90 SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
91 push_string(p+2, lp_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
92 push_string(p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
93 return NT_STATUS_OK;
96 return NT_STATUS_INVALID_PARAMETER;
101 initialialise the print backend, registering ourselves with the ntvfs subsystem
103 NTSTATUS ntvfs_print_init(void)
105 NTSTATUS ret;
106 struct ntvfs_ops ops;
107 NTVFS_CURRENT_CRITICAL_SIZES(vers);
109 ZERO_STRUCT(ops);
111 /* fill in the name and type */
112 ops.name = "default";
113 ops.type = NTVFS_PRINT;
115 /* fill in all the operations */
116 ops.connect = print_connect;
117 ops.disconnect = print_disconnect;
118 ops.unlink = print_unlink;
119 ops.ioctl = print_ioctl;
121 /* register ourselves with the NTVFS subsystem. We register under the name 'default'
122 as we wish to be the default backend */
123 ret = ntvfs_register(&ops, &vers);
125 if (!NT_STATUS_IS_OK(ret)) {
126 DEBUG(0,("Failed to register PRINT backend!\n"));
129 return ret;