libcli: move ioctl function field defs to smb_constants
[rusty/samba.git] / source4 / ntvfs / print / vfs_print.c
index 1aa38a59c29ac8e06cfb6df2d93c54f8436d4c06..6019e44132525b1af2c5ab91ea3a87148bec0e5a 100644 (file)
@@ -5,7 +5,7 @@
 
    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
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
    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.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 /*
   this implements the print backend, called by the NTVFS subsystem to
 */
 
 #include "includes.h"
-#include "libcli/raw/ioctl.h"
+#include "../libcli/smb/smb_constants.h"
 #include "ntvfs/ntvfs.h"
+#include "param/param.h"
+
+NTSTATUS ntvfs_print_init(void);
 
 /*
   connect to a share - used when a tree_connect operation comes
@@ -32,7 +34,7 @@
   is available
 */
 static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
-                             struct ntvfs_request *req, const char *sharename)
+                             struct ntvfs_request *req, union smb_tcon* tcon)
 {
        ntvfs->ctx->fs_type = talloc_strdup(ntvfs->ctx, "NTFS");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->fs_type);
@@ -40,6 +42,11 @@ static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
        ntvfs->ctx->dev_type = talloc_strdup(ntvfs->ctx, "LPT1:");
        NT_STATUS_HAVE_NO_MEMORY(ntvfs->ctx->dev_type);
 
+       if (tcon->generic.level == RAW_TCON_TCONX) {
+               tcon->tconx.out.fs_type = ntvfs->ctx->fs_type;
+               tcon->tconx.out.dev_type = ntvfs->ctx->dev_type;
+       }
+
        return NT_STATUS_OK;
 }
 
@@ -75,7 +82,6 @@ static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
        }
 
        if (io->ioctl.in.request == IOCTL_QUERY_JOB_INFO) {
-               int snum = ntvfs->ctx->config.snum;
 
                /* a request for the print job id of an open print job */
                io->ioctl.out.blob = data_blob_talloc(req, NULL, 32);
@@ -84,8 +90,8 @@ static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
 
                p = (char *)io->ioctl.out.blob.data;
                SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */);
-               push_string(p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII);
-               push_string(p+18, lp_servicename(snum), 13, STR_TERMINATE|STR_ASCII);
+               push_string(p+2, lpcfg_netbios_name(ntvfs->ctx->lp_ctx), 15, STR_TERMINATE|STR_ASCII);
+               push_string(p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII);
                return NT_STATUS_OK;
        }
 
@@ -100,6 +106,7 @@ NTSTATUS ntvfs_print_init(void)
 {
        NTSTATUS ret;
        struct ntvfs_ops ops;
+       NTVFS_CURRENT_CRITICAL_SIZES(vers);
 
        ZERO_STRUCT(ops);
 
@@ -115,7 +122,7 @@ NTSTATUS ntvfs_print_init(void)
 
        /* register ourselves with the NTVFS subsystem. We register under the name 'default'
           as we wish to be the default backend */
-       ret = ntvfs_register(&ops);
+       ret = ntvfs_register(&ops, &vers);
 
        if (!NT_STATUS_IS_OK(ret)) {
                DEBUG(0,("Failed to register PRINT backend!\n"));