mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
printing: always store sytem job-ID in queue state
Print jobs have multiple identifiers: the regular spoolss jobid, which is allocated by spoolss on job submission, and the system jobid, which is assigned by the printing back-end. Currently these identifiers are incorrectly mixed in print job queue tracking. Fix this by ensuring that only the system jobid is stored in the print queue state structure. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10271 Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Mon Nov 18 18:03:41 CET 2013 on sn-devel-104
This commit is contained in:
parent
24d025f85d
commit
b7da5a5b00
@ -3051,7 +3051,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
|
||||
size_t len = 0;
|
||||
uint32 i;
|
||||
int max_reported_jobs = lp_max_reported_jobs(snum);
|
||||
bool ret = False;
|
||||
bool ret = false;
|
||||
const char* sharename = lp_servicename(talloc_tos(), snum);
|
||||
TALLOC_CTX *tmp_ctx = talloc_new(msg_ctx);
|
||||
if (tmp_ctx == NULL) {
|
||||
@ -3095,7 +3095,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
|
||||
|
||||
/* Retrieve the linearised queue data. */
|
||||
|
||||
for( i = 0; i < qcount; i++) {
|
||||
for(i = 0; i < qcount; i++) {
|
||||
uint32 qjob, qsize, qpage_count, qstatus, qpriority, qtime;
|
||||
len += tdb_unpack(data.dptr + len, data.dsize - len, "ddddddff",
|
||||
&qjob,
|
||||
@ -3117,7 +3117,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
|
||||
total_count = qcount;
|
||||
|
||||
/* Add new jobids to the queue. */
|
||||
for( i = 0; i < extra_count; i++) {
|
||||
for (i = 0; i < extra_count; i++) {
|
||||
uint32 jobid;
|
||||
struct printjob *pjob;
|
||||
|
||||
@ -3130,7 +3130,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
|
||||
continue;
|
||||
}
|
||||
|
||||
queue[total_count].sysjob = jobid;
|
||||
queue[total_count].sysjob = pjob->sysjob;
|
||||
queue[total_count].size = pjob->size;
|
||||
queue[total_count].page_count = pjob->page_count;
|
||||
queue[total_count].status = pjob->status;
|
||||
@ -3145,32 +3145,31 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
|
||||
/* Update the changed jobids. */
|
||||
for (i = 0; i < changed_count; i++) {
|
||||
uint32_t jobid = IVAL(jcdata.dptr, i * 4);
|
||||
struct printjob *pjob;
|
||||
uint32_t j;
|
||||
bool found = false;
|
||||
|
||||
pjob = print_job_find(tmp_ctx, sharename, jobid);
|
||||
if (pjob == NULL) {
|
||||
DEBUG(5,("get_stored_queue_info: failed to find "
|
||||
"changed job = %u\n",
|
||||
(unsigned int)jobid));
|
||||
remove_from_jobs_changed(sharename, jobid);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (j = 0; j < total_count; j++) {
|
||||
if (queue[j].sysjob == jobid) {
|
||||
if (queue[j].sysjob == pjob->sysjob) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
struct printjob *pjob;
|
||||
|
||||
DEBUG(5,("get_stored_queue_info: changed job: %u\n",
|
||||
(unsigned int) jobid));
|
||||
(unsigned int)jobid));
|
||||
|
||||
pjob = print_job_find(tmp_ctx, sharename, jobid);
|
||||
if (pjob == NULL) {
|
||||
DEBUG(5,("get_stored_queue_info: failed to find "
|
||||
"changed job = %u\n",
|
||||
(unsigned int) jobid));
|
||||
remove_from_jobs_changed(sharename, jobid);
|
||||
continue;
|
||||
}
|
||||
|
||||
queue[j].sysjob = jobid;
|
||||
queue[j].sysjob = pjob->sysjob;
|
||||
queue[j].size = pjob->size;
|
||||
queue[j].page_count = pjob->page_count;
|
||||
queue[j].status = pjob->status;
|
||||
@ -3180,8 +3179,10 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
|
||||
fstrcpy(queue[j].fs_file, pjob->jobname);
|
||||
talloc_free(pjob);
|
||||
|
||||
DEBUG(5,("get_stored_queue_info: updated queue[%u], jobid: %u, jobname: %s\n",
|
||||
(unsigned int) j, (unsigned int) jobid, pjob->jobname));
|
||||
DEBUG(5,("updated queue[%u], jobid: %u, sysjob: %u, "
|
||||
"jobname: %s\n",
|
||||
(unsigned int)j, (unsigned int)jobid,
|
||||
(unsigned int)queue[j].sysjob, pjob->jobname));
|
||||
}
|
||||
|
||||
remove_from_jobs_changed(sharename, jobid);
|
||||
@ -3200,7 +3201,7 @@ static bool get_stored_queue_info(struct messaging_context *msg_ctx,
|
||||
*ppqueue = queue;
|
||||
*pcount = total_count;
|
||||
|
||||
ret = True;
|
||||
ret = true;
|
||||
|
||||
out:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user