summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h8
-rw-r--r--source3/modules/onefs_open.c4
-rw-r--r--source3/printing/printspoolss.c3
-rw-r--r--source3/smbd/close.c4
-rw-r--r--source3/smbd/fileio.c18
-rw-r--r--source3/smbd/open.c5
-rw-r--r--source3/smbd/reply.c3
-rw-r--r--source3/smbd/smb2_create.c8
8 files changed, 22 insertions, 31 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index df512e50ed..a98274bcad 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -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);
diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c
index ac3c5b2024..c2f2979044 100644
--- a/source3/modules/onefs_open.c
+++ b/source3/modules/onefs_open.c
@@ -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,
diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c
index 939b627029..e97b397cb0 100644
--- a/source3/printing/printspoolss.c
+++ b/source3/printing/printspoolss.c
@@ -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;
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 24992fd0ec..fb0e20647e 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -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;
}
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index f9fcc1be50..e5a288822e 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -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) {
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index f1c32e0585..55ea8960de 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -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,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 9b2c1e04da..dc7082964f 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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);
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 47a85f8cf3..71e97a4040 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -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);