diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-08-13 01:53:07 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-08-13 01:53:07 +0000 |
commit | ef2e26c91b80556af033d3335e55f5dfa6fff31d (patch) | |
tree | faa21bfd7e7b5247250b47c7891dc1a5ebee6be9 /source4/ntvfs/print | |
download | samba-ef2e26c91b80556af033d3335e55f5dfa6fff31d.tar.gz samba-ef2e26c91b80556af033d3335e55f5dfa6fff31d.tar.xz samba-ef2e26c91b80556af033d3335e55f5dfa6fff31d.zip |
first public release of samba4 code
(This used to be commit b0510b5428b3461aeb9bbe3cc95f62fc73e2b97f)
Diffstat (limited to 'source4/ntvfs/print')
-rw-r--r-- | source4/ntvfs/print/README | 3 | ||||
-rw-r--r-- | source4/ntvfs/print/vfs_print.c | 104 |
2 files changed, 107 insertions, 0 deletions
diff --git a/source4/ntvfs/print/README b/source4/ntvfs/print/README new file mode 100644 index 00000000000..441c82dddd7 --- /dev/null +++ b/source4/ntvfs/print/README @@ -0,0 +1,3 @@ +This is the print NTVFS backend for Samba. NTVFS operations that are +made on print shares are directed here by default. Most directory +operations and many file operations are not supported on print shares. diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c new file mode 100644 index 00000000000..2563f0ad9c7 --- /dev/null +++ b/source4/ntvfs/print/vfs_print.c @@ -0,0 +1,104 @@ +/* + Unix SMB/CIFS implementation. + default print NTVFS backend + Copyright (C) Andrew Tridgell 2003 + + 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 the print backend, called by the NTVFS subsystem to + handle requests on printing shares +*/ + +#include "includes.h" + +/* + connect to a share - used when a tree_connect operation comes + in. For printing shares this should check that the spool directory + is available +*/ +static NTSTATUS print_connect(struct request_context *req, const char *sharename) +{ + return NT_STATUS_OK; +} + +/* + disconnect from a share +*/ +static NTSTATUS print_disconnect(struct tcon_context *conn) +{ + return NT_STATUS_OK; +} + +/* + lots of operations are not allowed on printing shares - mostly return NT_STATUS_ACCESS_DENIED +*/ +static NTSTATUS print_unlink(struct request_context *req, struct smb_unlink *unl) +{ + return NT_STATUS_ACCESS_DENIED; +} + + +/* + ioctl - used for job query +*/ +static NTSTATUS print_ioctl(struct request_context *req, struct smb_ioctl *io) +{ + char *p; + + if (io->in.request == IOCTL_QUERY_JOB_INFO) { + /* a request for the print job id of an open print job */ + io->out.blob = data_blob_talloc(req->mem_ctx, NULL, 32); + + memset(io->out.blob.data, 0, io->out.blob.length); + + p = io->out.blob.data; + SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */); + push_string(NULL, p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII); + push_string(NULL, p+18, lp_servicename(req->conn->service), 13, STR_TERMINATE|STR_ASCII); + return NT_STATUS_OK; + } + + return NT_STATUS_INVALID_PARAMETER; +} + + +/* + initialialise the print backend, registering ourselves with the ntvfs subsystem + */ +BOOL print_vfs_init(void) +{ + BOOL ret; + struct ntvfs_ops ops; + + ZERO_STRUCT(ops); + + /* fill in all the operations */ + ops.connect = print_connect; + ops.disconnect = print_disconnect; + ops.unlink = print_unlink; + ops.ioctl = print_ioctl; + + /* register ourselves with the NTVFS subsystem. We register under the name 'default' + as we wish to be the default backend */ + ret = ntvfs_register("default", NTVFS_PRINT, &ops); + + if (!ret) { + DEBUG(0,("Failed to register PRINT backend!\n")); + return False; + } + + return True; +} |