The Samba-Bugzilla – Attachment 5536 Details for
Bug 7233
print fails with jobs >4GB from Win7 clients
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am patch for 3.4.x.
0001-Fix-bug-7233-print-fails-with-jobs-4GB-from-Win7-cli.patch (text/plain), 7.38 KB, created by
Jeremy Allison
on 2010-03-24 15:14:24 UTC
(
hide
)
Description:
git-am patch for 3.4.x.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2010-03-24 15:14:24 UTC
Size:
7.38 KB
patch
obsolete
>From f5f9f284739cc744aed396599d5c77fcb9ca88ef Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 24 Mar 2010 13:12:44 -0700 >Subject: [PATCH] Fix bug #7233 - print fails with jobs >4GB from Win7 clients. > >Ensure we always write at end-of-file for older write calls. >Includes 66b7fcc8ef6b43c219dcae43a68d861cf71b80fa and >59545276f2bd6df8ee5e75e96e707fd86ff44350 from master. > >Jeremy. >--- > source3/printing/printing.c | 2 +- > source3/rpc_server/srv_spoolss_nt.c | 6 +- > source3/smbd/reply.c | 75 +++++++++++++++++++++++------------ > 3 files changed, 54 insertions(+), 29 deletions(-) > >diff --git a/source3/printing/printing.c b/source3/printing/printing.c >index 10cd1d7..6ff9bb9 100644 >--- a/source3/printing/printing.c >+++ b/source3/printing/printing.c >@@ -2212,7 +2212,7 @@ pause, or resume print job. User name: %s. Printer name: %s.", > ssize_t print_job_write(int snum, uint32 jobid, const char *buf, SMB_OFF_T pos, size_t size) > { > const char* sharename = lp_const_servicename(snum); >- int return_code; >+ ssize_t return_code; > struct printjob *pjob; > > pjob = print_job_find(sharename, jobid); >diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c >index b134386..bfae2cd 100644 >--- a/source3/rpc_server/srv_spoolss_nt.c >+++ b/source3/rpc_server/srv_spoolss_nt.c >@@ -5606,7 +5606,7 @@ WERROR _spoolss_EndDocPrinter(pipes_struct *p, > WERROR _spoolss_WritePrinter(pipes_struct *p, > struct spoolss_WritePrinter *r) > { >- uint32_t buffer_written; >+ ssize_t buffer_written; > int snum; > Printer_entry *Printer = find_printer_index_by_hnd(p, r->in.handle); > >@@ -5620,11 +5620,11 @@ WERROR _spoolss_WritePrinter(pipes_struct *p, > if (!get_printer_snum(p, r->in.handle, &snum, NULL)) > return WERR_BADFID; > >- buffer_written = (uint32_t)print_job_write(snum, Printer->jobid, >+ buffer_written = print_job_write(snum, Printer->jobid, > (const char *)r->in.data.data, > (SMB_OFF_T)-1, > (size_t)r->in._data_size); >- if (buffer_written == (uint32_t)-1) { >+ if (buffer_written == (ssize_t)-1) { > *r->out.num_written = 0; > if (errno == ENOSPC) > return WERR_NO_SPOOL_SPACE; >diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c >index 23fa3e8..23f3f00 100644 >--- a/source3/smbd/reply.c >+++ b/source3/smbd/reply.c >@@ -3636,6 +3636,11 @@ void reply_writebraw(struct smb_request *req) > startpos = IVAL_TO_SMB_OFF_T(req->vwv+3, 0); > write_through = BITSETW(req->vwv+7,0); > >+ if (fsp->print_file) { >+ /* Print files ignore the offset - use end of file. */ >+ startpos = (SMB_OFF_T)-1; >+ } >+ > /* We have to deal with slightly different formats depending > on whether we are using the core+ or lanman1.0 protocol */ > >@@ -3655,15 +3660,17 @@ void reply_writebraw(struct smb_request *req) > return; > } > >- init_strict_lock_struct(fsp, (uint32)req->smbpid, >- (uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK, >- &lock); >+ if (!fsp->print_file) { >+ init_strict_lock_struct(fsp, (uint32)req->smbpid, >+ (uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK, >+ &lock); > >- if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { >- reply_doserror(req, ERRDOS, ERRlock); >- error_to_writebrawerr(req); >- END_PROFILE(SMBwritebraw); >- return; >+ if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { >+ reply_doserror(req, ERRDOS, ERRlock); >+ error_to_writebrawerr(req); >+ END_PROFILE(SMBwritebraw); >+ return; >+ } > } > > if (numtowrite>0) { >@@ -3741,7 +3748,11 @@ void reply_writebraw(struct smb_request *req) > exit_server_cleanly("secondary writebraw failed"); > } > >- nwritten = write_file(req,fsp,buf+4,startpos+nwritten,numtowrite); >+ if (fsp->print_file) { >+ nwritten = write_file(req,fsp,buf+4,(SMB_OFF_T)-1,numtowrite); >+ } else { >+ nwritten = write_file(req,fsp,buf+4,startpos+nwritten,numtowrite); >+ } > if (nwritten == -1) { > TALLOC_FREE(buf); > reply_unixerror(req, ERRHRD, ERRdiskfull); >@@ -3776,7 +3787,9 @@ void reply_writebraw(struct smb_request *req) > fsp->fnum, (double)startpos, (int)numtowrite, > (int)total_written)); > >- SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); >+ if (!fsp->print_file) { >+ SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); >+ } > > /* We won't return a status if write through is not selected - this > * follows what WfWg does */ >@@ -3800,7 +3813,9 @@ void reply_writebraw(struct smb_request *req) > return; > > strict_unlock: >- SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); >+ if (!fsp->print_file) { >+ SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); >+ } > > END_PROFILE(SMBwritebraw); > return; >@@ -3849,7 +3864,10 @@ void reply_writeunlock(struct smb_request *req) > startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0); > data = (const char *)req->buf + 3; > >- if (numtowrite) { >+ if (fsp->print_file) { >+ /* Print files ignore the offset - use end of file. */ >+ startpos = (SMB_OFF_T)-1; >+ } else if (numtowrite) { > init_strict_lock_struct(fsp, (uint32)req->smbpid, > (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, > &lock); >@@ -3883,7 +3901,7 @@ void reply_writeunlock(struct smb_request *req) > goto strict_unlock; > } > >- if (numtowrite) { >+ if (numtowrite && !fsp->print_file) { > status = do_unlock(smbd_messaging_context(), > fsp, > req->smbpid, >@@ -3905,7 +3923,7 @@ void reply_writeunlock(struct smb_request *req) > fsp->fnum, (int)numtowrite, (int)nwritten)); > > strict_unlock: >- if (numtowrite) { >+ if (numtowrite && !fsp->print_file) { > SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); > } > >@@ -3963,14 +3981,16 @@ void reply_write(struct smb_request *req) > startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0); > data = (const char *)req->buf + 3; > >- init_strict_lock_struct(fsp, (uint32)req->smbpid, >- (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, >- &lock); >+ if (!fsp->print_file) { >+ init_strict_lock_struct(fsp, (uint32)req->smbpid, >+ (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, >+ &lock); > >- if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { >- reply_doserror(req, ERRDOS, ERRlock); >- END_PROFILE(SMBwrite); >- return; >+ if (!SMB_VFS_STRICT_LOCK(conn, fsp, &lock)) { >+ reply_doserror(req, ERRDOS, ERRlock); >+ END_PROFILE(SMBwrite); >+ return; >+ } > } > > /* >@@ -4023,7 +4043,9 @@ void reply_write(struct smb_request *req) > DEBUG(3,("write fnum=%d num=%d wrote=%d\n", fsp->fnum, (int)numtowrite, (int)nwritten)); > > strict_unlock: >- SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); >+ if (!fsp->print_file) { >+ SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); >+ } > > END_PROFILE(SMBwrite); > return; >@@ -4555,7 +4577,10 @@ void reply_writeclose(struct smb_request *req) > mtime = convert_time_t_to_timespec(srv_make_unix_date3(req->vwv+4)); > data = (const char *)req->buf + 1; > >- if (numtowrite) { >+ if (fsp->print_file) { >+ /* Print files ignore the offset - use end of file. */ >+ startpos = (SMB_OFF_T)-1; >+ } else if (numtowrite) { > init_strict_lock_struct(fsp, (uint32)req->smbpid, > (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK, > &lock); >@@ -4601,7 +4626,7 @@ void reply_writeclose(struct smb_request *req) > SSVAL(req->outbuf,smb_vwv0,nwritten); > > strict_unlock: >- if (numtowrite) { >+ if (numtowrite && !fsp->print_file) { > SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); > } > >@@ -5057,7 +5082,7 @@ void reply_printwrite(struct smb_request *req) > > data = (const char *)req->buf + 3; > >- if (write_file(req,fsp,data,-1,numtowrite) != numtowrite) { >+ if (write_file(req,fsp,data,(SMB_OFF_T)-1,numtowrite) != numtowrite) { > reply_unixerror(req, ERRHRD, ERRdiskfull); > END_PROFILE(SMBsplwr); > return; >-- >1.7.0.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7233
:
5487
|
5500
|
5525
|
5527
|
5528
|
5534
|
5535
|
5536
|
5542
|
5558
|
5563
|
5564