[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Tue Mar 30 16:31:12 MDT 2010
The branch, master has been updated
via 32c8fea... Fix for bug #7233 - print fails with jobs >4GB from Win7 clients.
from 4b249a6... s4:lsa implement lsaRSetForestTrustInformation
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 32c8feab5d8320cba7f47fc27ba0fc264f3c4333
Author: Jeremy Allison <jra at samba.org>
Date: Tue Mar 30 15:27:26 2010 -0700
Fix for bug #7233 - print fails with jobs >4GB from Win7 clients.
Contains for by Sebastian Kloska <oncaphillis at snafu.de>. Submitter
confirms this fixes the problem.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 1 +
source3/printing/printfsp.c | 20 ++++++++++++++++++++
source3/smbd/reply.c | 16 ++++++++++++----
3 files changed, 33 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2708c3a..2ebc75c 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4919,6 +4919,7 @@ 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 */
diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c
index 756a314..5382b73 100644
--- a/source3/printing/printfsp.c
+++ b/source3/printing/printfsp.c
@@ -114,3 +114,23 @@ void print_fsp_end(files_struct *fsp, enum file_close_type close_type)
print_job_end(SNUM(fsp->conn),jobid, close_type);
}
+
+/****************************************************************************
+ Discovered by Sebastian Kloska <oncaphillis at snafu.de>. When print files
+ go beyond 4GB, the 32-bit offset sent in old SMBwrite calls is relative
+ to the current 4GB chunk we're writing to.
+****************************************************************************/
+
+SMB_OFF_T printfile_offset(files_struct *fsp, SMB_OFF_T offset)
+{
+ SMB_STRUCT_STAT st;
+
+ if (sys_fstat(fsp->fh->fd, &st, false) == -1) {
+ DEBUG(3,("printfile_offset: sys_fstat failed on %s (%s)\n",
+ fsp_str_dbg(fsp),
+ strerror(errno) ));
+ return offset;
+ }
+
+ return (st.st_ex_size & 0xffffffff00000000LL) + offset;
+}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 1c99aec..fdcf487 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3822,7 +3822,9 @@ void reply_writebraw(struct smb_request *req)
return;
}
- if (!fsp->print_file) {
+ if (fsp->print_file) {
+ startpos = printfile_offset(fsp, startpos);
+ } else {
init_strict_lock_struct(fsp, (uint32)req->smbpid,
(uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK,
&lock);
@@ -4024,7 +4026,9 @@ 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 && !fsp->print_file) {
+ if (fsp->print_file) {
+ startpos = printfile_offset(fsp, startpos);
+ } else if (numtowrite) {
init_strict_lock_struct(fsp, (uint32)req->smbpid,
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
&lock);
@@ -4145,7 +4149,9 @@ void reply_write(struct smb_request *req)
startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0);
data = (const char *)req->buf + 3;
- if (!fsp->print_file) {
+ if (fsp->print_file) {
+ startpos = printfile_offset(fsp, startpos);
+ } else {
init_strict_lock_struct(fsp, (uint32)req->smbpid,
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
&lock);
@@ -4751,7 +4757,9 @@ 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 && !fsp->print_file) {
+ if (fsp->print_file) {
+ startpos = printfile_offset(fsp, startpos);
+ } else if (numtowrite) {
init_strict_lock_struct(fsp, (uint32)req->smbpid,
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
&lock);
--
Samba Shared Repository
More information about the samba-cvs
mailing list