From e7b5d059c2af0ffb71e3d6b12a35a1dcd3295942 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 19 Feb 2003 01:38:12 +0000 Subject: Bit of a hack job to prevent smbprn.XXX jobs appearing in the queue if the jobid is below the UNIX_JOB_START number. Jeremy. (This used to be commit e8a9bf67cbe5b3e33f99e6793fe4ec445d6e8819) --- source3/printing/printing.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 3bf992ad69..c9612ab3a9 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -579,11 +579,13 @@ static uint32 print_parse_jobid(char *fname) List a unix job in the print database. ****************************************************************************/ -static void print_unix_job(int snum, print_queue_struct *q) +static void print_unix_job(int snum, print_queue_struct *q, uint32 jobid) { - uint32 jobid = q->job + UNIX_JOB_START; struct printjob pj, *old_pj; + if (jobid == (uint32)-1) + jobid = q->job + UNIX_JOB_START; + /* Preserve the timestamp on an existing unix print job */ old_pj = print_job_find(snum, jobid); @@ -597,11 +599,14 @@ static void print_unix_job(int snum, print_queue_struct *q) pj.status = q->status; pj.size = q->size; pj.spooled = True; - pj.smbjob = False; - fstrcpy(pj.filename, ""); - fstrcpy(pj.jobname, q->fs_file); - fstrcpy(pj.user, q->fs_user); - fstrcpy(pj.queuename, lp_const_servicename(snum)); + pj.smbjob = (old_pj != NULL ? True : False); + fstrcpy(pj.filename, old_pj ? old_pj->filename : ""); + if (jobid < UNIX_JOB_START) + fstrcpy(pj.jobname, old_pj ? old_pj->jobname : "Remote Downlevel Document"); + else + fstrcpy(pj.jobname, old_pj ? old_pj->jobname : q->fs_file); + fstrcpy(pj.user, old_pj ? old_pj->user : q->fs_user); + fstrcpy(pj.queuename, old_pj ? old_pj->queuename : lp_const_servicename(snum)); pjob_store(snum, jobid, &pj); } @@ -879,7 +884,7 @@ static void print_queue_update(int snum) if (jobid == (uint32)-1) { /* assume its a unix print job */ - print_unix_job(snum, &queue[i]); + print_unix_job(snum, &queue[i], jobid); continue; } @@ -889,7 +894,7 @@ static void print_queue_update(int snum) /* err, somethings wrong. Probably smbd was restarted with jobs in the queue. All we can do is treat them like unix jobs. Pity. */ - print_unix_job(snum, &queue[i]); + print_unix_job(snum, &queue[i], jobid); continue; } -- cgit