diff options
Diffstat (limited to 'source/smbd/fileio.c')
-rw-r--r-- | source/smbd/fileio.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/smbd/fileio.c b/source/smbd/fileio.c index 9e37b951e50..b612b1a4514 100644 --- a/source/smbd/fileio.c +++ b/source/smbd/fileio.c @@ -158,8 +158,19 @@ ssize_t write_file(files_struct *fsp, char *data, SMB_OFF_T pos, size_t n) ssize_t total_written = 0; int write_path = -1; - if (fsp->print_file) - return print_job_write(SNUM(fsp->conn), fsp->print_jobid, data, n); + if (fsp->print_file) { + int snum; + uint32 jobid; + + if (!rap_to_pjobid(fsp->rap_print_jobid, &snum, &jobid)) { + DEBUG(3,("write_file: Unable to map RAP jobid %u to jobid.\n", + (unsigned int)fsp->rap_print_jobid )); + errno = EBADF; + return -1; + } + + return print_job_write(SNUM(fsp->conn), jobid, data, n); + } if (!fsp->can_write) { errno = EPERM; |