1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-24 10:50:22 +03:00

s3-smbd: Migrated to new spoolss functions for printing.

Signed-off-by: Jim McDonough <jmcd@samba.org>
This commit is contained in:
Simo Sorce 2010-05-04 04:28:48 -04:00 committed by Simo Sorce
parent 660506d359
commit 849cc65654
8 changed files with 22 additions and 31 deletions

View 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);

View 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,

View 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;

View 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;
}

View 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) {

View 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,

View 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);

View 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);