diff options
author | Jeremy Allison <jra@samba.org> | 2002-03-20 22:39:30 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-03-20 22:39:30 +0000 |
commit | e67f1be9f0c3193d122e3e429af4fb242121b169 (patch) | |
tree | f25138c8f28d47c79cc32aca2388423d97ae1527 /source3 | |
parent | 60a7d07d63196d140fed14a75c1c5360f3546905 (diff) | |
download | samba-e67f1be9f0c3193d122e3e429af4fb242121b169.tar.gz samba-e67f1be9f0c3193d122e3e429af4fb242121b169.tar.bz2 samba-e67f1be9f0c3193d122e3e429af4fb242121b169.zip |
Ensure we don't do lp_servicename()'s in tdb traverse as this
allocates lots of memory.
Jeremy.
(This used to be commit fbc8c6a1096ec829f48b403239f105065bf155b1)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/printing/printing.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c index febdd0eec5..ad5acb1505 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -115,10 +115,12 @@ store a job structure back to the database static BOOL print_job_store(int jobid, struct printjob *pjob) { TDB_DATA d; + BOOL ret; + d.dptr = (void *)pjob; d.dsize = sizeof(*pjob); - - return (tdb_store(tdb, print_key(jobid), d, TDB_REPLACE) == 0); + ret = (tdb_store(tdb, print_key(jobid), d, TDB_REPLACE) == 0); + return ret; } /**************************************************************************** @@ -185,7 +187,7 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void memcpy(&jobid, key.dptr, sizeof(jobid)); memcpy(&pjob, data.dptr, sizeof(pjob)); - if (!strequal(lp_servicename(ts->snum), pjob.queuename)) { + if (ts->snum != lp_servicenumber(pjob.queuename)) { /* this isn't for the queue we are looking at */ ts->total_jobs++; return 0; @@ -1176,7 +1178,7 @@ static int traverse_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void * memcpy(&pjob, data.dptr, sizeof(pjob)); /* maybe it isn't for this queue */ - if (!strequal(lp_servicename(ts->snum), pjob.queuename)) + if (ts->snum != lp_servicenumber(pjob.queuename)) return 0; if (ts->qcount >= ts->maxcount) return 0; @@ -1213,7 +1215,7 @@ static int traverse_count_fn_queue(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, memcpy(&pjob, data.dptr, sizeof(pjob)); /* maybe it isn't for this queue */ - if (!strequal(lp_servicename(ts->snum), pjob.queuename)) + if (ts->snum != lp_servicenumber(pjob.queuename)) return 0; ts->count++; |