summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-04-23 14:26:33 -0700
committerJeremy Allison <jra@samba.org>2010-04-23 14:26:33 -0700
commit168b86c3847a5b575eef36cc2308802cbd25bb4a (patch)
tree28546e3b7bb429a06bfbba51b3cbcefe2b59be33 /source3/smbd
parent2bbb8c917e372ceeb1e144259d9d2b0eab7cc212 (diff)
downloadsamba-168b86c3847a5b575eef36cc2308802cbd25bb4a.tar.gz
s3-smbd: group print relate data in own structure
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/fileio.c7
-rw-r--r--source3/smbd/files.c10
-rw-r--r--source3/smbd/open.c4
-rw-r--r--source3/smbd/reply.c7
-rw-r--r--source3/smbd/trans2.c7
5 files changed, 27 insertions, 8 deletions
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index 1c27fef09b1..da72e5a5f04 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -293,9 +293,10 @@ ssize_t write_file(struct smb_request *req,
if (fsp->print_file) {
uint32 jobid;
- if (!rap_to_pjobid(fsp->rap_print_jobid, NULL, &jobid)) {
- DEBUG(3,("write_file: Unable to map RAP jobid %u to jobid.\n",
- (unsigned int)fsp->rap_print_jobid ));
+ 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;
return -1;
}
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index a2a7dabea54..43956e3903e 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -589,10 +589,18 @@ NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
} else {
to->can_write = (access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ? True : False;
}
- to->print_file = from->print_file;
to->modified = from->modified;
to->is_directory = from->is_directory;
to->aio_write_behind = from->aio_write_behind;
+
+ if (from->print_file) {
+ to->print_file = talloc(to, struct print_file_data);
+ if (!to->print_file) return NT_STATUS_NO_MEMORY;
+ to->print_file->rap_jobid = from->print_file->rap_jobid;
+ } else {
+ to->print_file = NULL;
+ }
+
return fsp_set_smb_fname(to, from->fsp_name);
}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index f49aca84294..19bd0c2d97e 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -615,7 +615,7 @@ static NTSTATUS open_file(files_struct *fsp,
fsp->can_write = (access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ?
True : False;
}
- fsp->print_file = False;
+ fsp->print_file = NULL;
fsp->modified = False;
fsp->sent_oplock_break = NO_BREAK_SENT;
fsp->is_directory = False;
@@ -2620,7 +2620,7 @@ static NTSTATUS open_directory(connection_struct *conn,
* According to Samba4, SEC_FILE_READ_ATTRIBUTE is always granted,
*/
fsp->access_mask = access_mask | FILE_READ_ATTRIBUTES;
- fsp->print_file = False;
+ fsp->print_file = NULL;
fsp->modified = False;
fsp->oplock_type = NO_OPLOCK;
fsp->sent_oplock_break = NO_BREAK_SENT;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 0355cb70833..56c067f4dc4 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -924,7 +924,12 @@ void reply_ioctl(struct smb_request *req)
END_PROFILE(SMBioctl);
return;
}
- SSVAL(p,0,fsp->rap_print_jobid); /* Job number */
+ /* Job number */
+ if (fsp->print_file) {
+ SSVAL(p, 0, fsp->print_file->rap_jobid);
+ } else {
+ SSVAL(p, 0, 0);
+ }
srvstr_push((char *)req->outbuf, req->flags2, p+2,
global_myname(), 15,
STR_TERMINATE|STR_ASCII);
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 991b6058e00..4dff67347b2 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -8150,7 +8150,12 @@ static void call_trans2ioctl(connection_struct *conn,
/* NOTE - THIS IS ASCII ONLY AT THE MOMENT - NOT SURE IF OS/2
CAN ACCEPT THIS IN UNICODE. JRA. */
- SSVAL(pdata,0,fsp->rap_print_jobid); /* Job number */
+ /* Job number */
+ if (fsp->print_file) {
+ SSVAL(pdata, 0, fsp->print_file->rap_jobid);
+ } else {
+ SSVAL(pdata, 0, 0);
+ }
srvstr_push(pdata, req->flags2, pdata + 2,
global_myname(), 15,
STR_ASCII|STR_TERMINATE); /* Our NetBIOS name */