diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-01-29 18:07:00 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-01-29 18:07:00 +0000 |
commit | dfd5680b8770f4dd462a90a7a6579aa9523e484f (patch) | |
tree | 7b73e21339610b1c0be8f975244256bd39b41263 /scheduler/quotas.c | |
parent | d1c13e168660dfc384ead2efe29eb20a7abc5950 (diff) |
Merge changes from CUPS 1.4svn-r8305.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1166 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'scheduler/quotas.c')
-rw-r--r-- | scheduler/quotas.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/scheduler/quotas.c b/scheduler/quotas.c index 4286f0e22..6d45b300d 100644 --- a/scheduler/quotas.c +++ b/scheduler/quotas.c @@ -3,7 +3,7 @@ * * Quota routines for the Common UNIX Printing System (CUPS). * - * Copyright 2007 by Apple Inc. + * Copyright 2007-2009 by Apple Inc. * Copyright 1997-2007 by Easy Software Products. * * These coded instructions, statements, and computer programs are the @@ -155,10 +155,22 @@ cupsdUpdateQuota( job; job = (cupsd_job_t *)cupsArrayNext(Jobs)) { + /* + * We only care about the current printer/class and user... + */ + if (strcasecmp(job->dest, p->name) != 0 || strcasecmp(job->username, q->username) != 0) continue; + /* + * Make sure attributes are loaded; we always call cupsdLoadJob() to ensure + * the access_time member is updated so the job isn't unloaded right away... + */ + + if (!cupsdLoadJob(job)) + continue; + if ((attr = ippFindAttribute(job->attrs, "time-at-completion", IPP_TAG_INTEGER)) == NULL) if ((attr = ippFindAttribute(job->attrs, "time-at-processing", @@ -166,11 +178,22 @@ cupsdUpdateQuota( attr = ippFindAttribute(job->attrs, "time-at-creation", IPP_TAG_INTEGER); - if (attr == NULL) - break; + if (!attr) + { + /* + * This should never happen since cupsdLoadJob() checks for + * time-at-creation, but if it does just ignore this job... + */ + + continue; + } if (attr->values[0].integer < curtime) { + /* + * This job is too old to count towards the quota, ignore it... + */ + if (JobAutoPurge) cupsdCancelJob(job, 1, IPP_JOB_CANCELED); |