r14173: change smb interface structures to always use
[jelmer/samba4-debian.git] / source / ntvfs / print / vfs_print.c
index f56b9065018f3d89155e6be10cfb0d35e11b107e..eb17ef9c63bc4294638c0b76a454f8d5f1cab470 100644 (file)
 */
 
 #include "includes.h"
+#include "libcli/raw/ioctl.h"
+#include "smb_server/smb_server.h"
+#include "ntvfs/ntvfs.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)
+static NTSTATUS print_connect(struct ntvfs_module_context *ntvfs,
+                             struct ntvfs_request *req, const char *sharename)
 {
+       struct smbsrv_tcon *tcon = req->tcon;
+
+       tcon->fs_type = talloc_strdup(tcon, "NTFS");
+       NT_STATUS_HAVE_NO_MEMORY(tcon->fs_type);
+
+       tcon->dev_type = talloc_strdup(tcon, "LPT1:");
+       NT_STATUS_HAVE_NO_MEMORY(tcon->dev_type);
+
        return NT_STATUS_OK;
 }
 
 /*
   disconnect from a share
 */
-static NTSTATUS print_disconnect(struct tcon_context *conn)
+static NTSTATUS print_disconnect(struct ntvfs_module_context *ntvfs)
 {
        return NT_STATUS_OK;
 }
@@ -45,7 +57,9 @@ static NTSTATUS print_disconnect(struct tcon_context *conn)
 /*
   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)
+static NTSTATUS print_unlink(struct ntvfs_module_context *ntvfs,
+                            struct ntvfs_request *req,
+                            union smb_unlink *unl)
 {
        return NT_STATUS_ACCESS_DENIED;
 }
@@ -54,7 +68,8 @@ static NTSTATUS print_unlink(struct request_context *req, struct smb_unlink *unl
 /*
   ioctl - used for job query
 */
-static NTSTATUS print_ioctl(struct request_context *req, union smb_ioctl *io)
+static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs,
+                           struct ntvfs_request *req, union smb_ioctl *io)
 {
        char *p;
 
@@ -64,14 +79,14 @@ static NTSTATUS print_ioctl(struct request_context *req, union smb_ioctl *io)
 
        if (io->ioctl.in.request == IOCTL_QUERY_JOB_INFO) {
                /* a request for the print job id of an open print job */
-               io->ioctl.out.blob = data_blob_talloc(req->mem_ctx, NULL, 32);
+               io->ioctl.out.blob = data_blob_talloc(req, NULL, 32);
 
                data_blob_clear(&io->ioctl.out.blob);
 
-               p = io->ioctl.out.blob.data;
+               p = (char *)io->ioctl.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);
+               push_string(p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII);
+               push_string(p+18, lp_servicename(req->tcon->service), 13, STR_TERMINATE|STR_ASCII);
                return NT_STATUS_OK;
        }
 
@@ -101,7 +116,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 = register_backend("ntvfs", &ops);
+       ret = ntvfs_register(&ops);
 
        if (!NT_STATUS_IS_OK(ret)) {
                DEBUG(0,("Failed to register PRINT backend!\n"));