[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Fri Apr 30 12:53:26 MDT 2010
The branch, master has been updated
via dffeb12... smbd: move printfile_offset() within write_file()
from b9a97cf... s4-smbtorture: add test_netprintjobgetinfo().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit dffeb12f3dcb339bc258a7fbc38bbf9ec8dd928e
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 28 19:42:04 2010 -0400
smbd: move printfile_offset() within write_file()
-----------------------------------------------------------------------
Summary of changes:
source3/locking/locking.c | 6 ++++++
source3/printing/printfsp.c | 7 ++++++-
source3/smbd/fileio.c | 3 +++
source3/smbd/reply.c | 16 ++++------------
4 files changed, 19 insertions(+), 13 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index a2581b1..3975a78 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -241,6 +241,12 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
{
struct byte_range_lock *br_lck = NULL;
+ /* silently return ok on print files as we don't do locking there */
+ if (fsp->print_file) {
+ *perr = NT_STATUS_OK;
+ return NULL;
+ }
+
if (!fsp->can_lock) {
*perr = fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE;
return NULL;
diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c
index e890748..5bb662e 100644
--- a/source3/printing/printfsp.c
+++ b/source3/printing/printfsp.c
@@ -76,7 +76,7 @@ NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
GetTimeOfDay(&fsp->open_time);
fsp->vuid = current_vuid;
fsp->fh->pos = -1;
- fsp->can_lock = True;
+ fsp->can_lock = False;
fsp->can_read = False;
fsp->access_mask = FILE_GENERIC_WRITE;
fsp->can_write = True;
@@ -131,6 +131,11 @@ SMB_OFF_T printfile_offset(files_struct *fsp, SMB_OFF_T offset)
{
SMB_STRUCT_STAT st;
+ if (offset & 0xffffffff00000000LL) {
+ /* offset is > 4G, skip */
+ return offset;
+ }
+
if (sys_fstat(fsp->fh->fd, &st, false) == -1) {
DEBUG(3,("printfile_offset: sys_fstat failed on %s (%s)\n",
fsp_str_dbg(fsp),
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index da72e5a..92b7d3e 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -301,6 +301,9 @@ ssize_t write_file(struct smb_request *req,
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);
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 6469ad8..571b8a8 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3832,9 +3832,7 @@ void reply_writebraw(struct smb_request *req)
return;
}
- if (fsp->print_file) {
- startpos = printfile_offset(fsp, startpos);
- } else {
+ if (!fsp->print_file) {
init_strict_lock_struct(fsp, (uint32)req->smbpid,
(uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK,
&lock);
@@ -4036,9 +4034,7 @@ void reply_writeunlock(struct smb_request *req)
startpos = IVAL_TO_SMB_OFF_T(req->vwv+2, 0);
data = (const char *)req->buf + 3;
- if (fsp->print_file) {
- startpos = printfile_offset(fsp, startpos);
- } else if (numtowrite) {
+ if (!fsp->print_file && numtowrite > 0) {
init_strict_lock_struct(fsp, (uint32)req->smbpid,
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
&lock);
@@ -4159,9 +4155,7 @@ 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) {
- startpos = printfile_offset(fsp, startpos);
- } else {
+ if (!fsp->print_file) {
init_strict_lock_struct(fsp, (uint32)req->smbpid,
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
&lock);
@@ -4779,9 +4773,7 @@ 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 (fsp->print_file) {
- startpos = printfile_offset(fsp, startpos);
- } else if (numtowrite) {
+ if (!fsp->print_file) {
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