summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-03-01 02:39:14 +0000
committerJeremy Allison <jra@samba.org>2003-03-01 02:39:14 +0000
commite2366787aea4c1a083eb481dc3e58ec09a33c9e8 (patch)
treefaa1dc7fd30095a79bc7c5634f48db86374447e5 /source3
parent4e5439438c452e7153f122de2ca7428e885b4c6a (diff)
downloadsamba-e2366787aea4c1a083eb481dc3e58ec09a33c9e8.tar.gz
samba-e2366787aea4c1a083eb481dc3e58ec09a33c9e8.tar.bz2
samba-e2366787aea4c1a083eb481dc3e58ec09a33c9e8.zip
Added limit to number of jobs enumerated. Set to 0 (means no limit).
Yes I will add the docs.... Jeremy. (This used to be commit 4a739d914bb87a3c8d071dfd0f275a9aab1cf90a)
Diffstat (limited to 'source3')
-rw-r--r--source3/param/loadparm.c4
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 0eeb9be9de..246023ba47 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -340,6 +340,7 @@ typedef struct
char *szMSDfsProxy;
int iMinPrintSpace;
int iMaxPrintJobs;
+ int iMaxReportedPrintJobs;
int iWriteCacheSize;
int iCreate_mask;
int iCreate_force_mode;
@@ -460,6 +461,7 @@ static service sDefault = {
NULL, /* szMSDfsProxy */
0, /* iMinPrintSpace */
1000, /* iMaxPrintJobs */
+ 0, /* iMaxReportedPrintJobs */
0, /* iWriteCacheSize */
0744, /* iCreate_mask */
0000, /* iCreate_force_mode */
@@ -907,6 +909,7 @@ static struct parm_struct parm_table[] = {
{"Printing Options", P_SEP, P_SEPARATOR},
{"total print jobs", P_INTEGER, P_GLOBAL, &Globals.iTotalPrintJobs, NULL, NULL, FLAG_PRINT},
+ {"max reported print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxReportedPrintJobs, NULL, NULL, FLAG_PRINT},
{"max print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxPrintJobs, NULL, NULL, FLAG_PRINT},
{"load printers", P_BOOL, P_GLOBAL, &Globals.bLoadPrinters, NULL, NULL, FLAG_PRINT},
{"printcap name", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, FLAG_PRINT | FLAG_DEVELOPER},
@@ -1838,6 +1841,7 @@ FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
FN_LOCAL_INTEGER(lp_printing, iPrinting)
+FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 4006d0c08e..b321832930 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -6323,6 +6323,7 @@ WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO
int snum;
print_status_struct prt_status;
print_queue_struct *queue=NULL;
+ int max_rep_jobs;
/* that's an [in out] buffer */
spoolss_move_buffer(q_u->buffer, &r_u->buffer);
@@ -6336,6 +6337,8 @@ WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO
if (!get_printer_snum(p, handle, &snum))
return WERR_BADFID;
+ max_rep_jobs = lp_max_reported_jobs(snum);
+
*returned = print_queue_status(snum, &queue, &prt_status);
DEBUGADD(4,("count:[%d], status:[%d], [%s]\n", *returned, prt_status.status, prt_status.message));
@@ -6344,6 +6347,9 @@ WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO
return WERR_OK;
}
+ if (max_rep_jobs && (*returned > max_rep_jobs))
+ *returned = max_rep_jobs;
+
switch (level) {
case 1:
return enumjobs_level1(queue, snum, buffer, offered, needed, returned);