s3-smbd: Migrated to new spoolss functions for printing.
authorSimo Sorce <ssorce@redhat.com>
Tue, 4 May 2010 08:28:48 +0000 (04:28 -0400)
committerSimo Sorce <idra@samba.org>
Tue, 27 Jul 2010 14:27:13 +0000 (10:27 -0400)
Signed-off-by: Jim McDonough <jmcd@samba.org>
source3/include/proto.h
source3/modules/onefs_open.c
source3/printing/printspoolss.c
source3/smbd/close.c
source3/smbd/fileio.c
source3/smbd/open.c
source3/smbd/reply.c
source3/smbd/smb2_create.c

index df512e50ed9c0b910766e11fc7dcf943f19f4f74..a98274bcadcb4712de0909c1de0a3880450eed4c 100644 (file)
@@ -4724,14 +4724,6 @@ void notify_printer_byname( const char *printername, uint32 change, const char *
 void pcap_cache_reload(void);
 bool pcap_printername_ok(const char *printername);
 
-/* The following definitions come from printing/printfsp.c  */
-
-NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
-                       const char *fname,
-                       uint16_t current_vuid, files_struct *fsp);
-void print_fsp_end(files_struct *fsp, enum file_close_type close_type);
-SMB_OFF_T printfile_offset(files_struct *fsp, SMB_OFF_T offset);
-
 /* The following definitions come from printing/printing.c  */
 
 uint16 pjobid_to_rap(const char* sharename, uint32 jobid);
index ac3c5b2024c7360580c7a6795dbffe3c1144b20d..c2f29790443e43a5f069296d51131e30211c39da 100644 (file)
@@ -483,8 +483,8 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
                DEBUG(10, ("onefs_open_file_ntcreate: printer open fname=%s\n",
                           smb_fname_str_dbg(smb_fname)));
 
-               return print_fsp_open(req, conn, smb_fname->base_name,
-                                     req->vuid, fsp);
+               return print_spool_open(fsp, smb_fname->base_name,
+                                       req->vuid);
        }
 
        if (!parent_dirname(talloc_tos(), smb_fname->base_name, &parent_dir,
index 939b627029aa72b0f57b81a19b390cf41d7de0f4..e97b397cb0634efc8820c505c1f98d9331d92850 100644 (file)
@@ -210,7 +210,8 @@ done:
        return status;
 }
 
-int print_spool_write(files_struct *fsp, const char *data, uint32_t size,
+int print_spool_write(files_struct *fsp,
+                     const char *data, uint32_t size,
                      SMB_OFF_T offset, uint32_t *written)
 {
        SMB_STRUCT_STAT st;
index 24992fd0ec35bafa97d6ea92a8e95a1c7ac8e145..fb0e20647e2676cc168d37950b52fab75576a6ff 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "printing.h"
 #include "librpc/gen_ndr/messaging.h"
 #include "smbd/globals.h"
 
@@ -604,7 +605,8 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
        status = ntstatus_keeperror(status, tmp);
 
        if (fsp->print_file) {
-               print_fsp_end(fsp, close_type);
+               /* FIXME: return spool errors */
+               print_spool_end(fsp, close_type);
                file_free(req, fsp);
                return NT_STATUS_OK;
        }
index f9fcc1be507352b81dfb61e4c394f0c13ee24f89..e5a288822ecd52021a924b7d0b4ee13ab8329cb2 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "printing.h"
 #include "smbd/globals.h"
 
 static bool setup_write_cache(files_struct *, SMB_OFF_T);
@@ -291,20 +292,15 @@ ssize_t write_file(struct smb_request *req,
        int write_path = -1;
 
        if (fsp->print_file) {
-               uint32 jobid;
+               uint32_t t;
+               int ret;
 
-               if (!rap_to_pjobid(fsp->print_file->rap_jobid, NULL, &jobid)) {
-                       DEBUG(3, ("write_file: "
-                                  "Unable to map RAP jobid %u to jobid.\n",
-                                 (unsigned int)fsp->print_file->rap_jobid));
-                       errno = EBADF;
+               ret = print_spool_write(fsp, data, n, pos, &t);
+               if (ret) {
+                       errno = ret;
                        return -1;
                }
-
-               /* support seeks for print files bigger than 4G */
-               pos = printfile_offset(fsp, pos);
-
-               return print_job_write(SNUM(fsp->conn), jobid, data, pos, n);
+               return t;
        }
 
        if (!fsp->can_write) {
index f1c32e0585ba62254169d1106c6573ef09dc7711..55ea8960de928791b665e9444424acac838eb4dd 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "printing.h"
 #include "smbd/globals.h"
 #include "librpc/gen_ndr/messaging.h"
 #include "../librpc/gen_ndr/ndr_security.h"
@@ -1526,8 +1527,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
                        return NT_STATUS_INTERNAL_ERROR;
                }
 
-               return print_fsp_open(req, conn, smb_fname->base_name,
-                                     req->vuid, fsp);
+               return print_spool_open(fsp, smb_fname->base_name,
+                                       req->vuid);
        }
 
        if (!parent_dirname(talloc_tos(), smb_fname->base_name, &parent_dir,
index 9b2c1e04dad1bb903b28e2cc774148387044805d..dc7082964fcb2093d9112e72d3e5b0bd7ff4d1c9 100644 (file)
@@ -25,6 +25,7 @@
 */
 
 #include "includes.h"
+#include "printing.h"
 #include "smbd/globals.h"
 
 /****************************************************************************
@@ -5053,7 +5054,7 @@ void reply_printopen(struct smb_request *req)
        }
 
        /* Open for exclusive use, write only. */
-       status = print_fsp_open(req, conn, NULL, req->vuid, fsp);
+       status = print_spool_open(fsp, NULL, req->vuid);
 
        if (!NT_STATUS_IS_OK(status)) {
                file_free(req, fsp);
index 47a85f8cf36e5a0b75e599e8d87819bbd98088a0..71e97a4040cbfa073ce33b0a2c9836dbaa7e57d6 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "printing.h"
 #include "smbd/globals.h"
 #include "../libcli/smb/smb_common.h"
 #include "../librpc/gen_ndr/ndr_security.h"
@@ -486,11 +487,8 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                        return tevent_req_post(req, ev);
                }
 
-               status = print_fsp_open(smb1req,
-                                       smb1req->conn,
-                                       in_name,
-                                       smb1req->vuid,
-                                       result);
+               status = print_spool_open(result, in_name,
+                                         smb1req->vuid);
                if (!NT_STATUS_IS_OK(status)) {
                        file_free(smb1req, result);
                        tevent_req_nterror(req, status);