summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2000-06-16 08:21:51 +0000
committerTim Potter <tpot@samba.org>2000-06-16 08:21:51 +0000
commitccc32898cf56baf93581b3773cb1d82ce0e59b8d (patch)
tree96331f261dafa37952bcc8f049d0f0d1828421a7
parenta1a0f7e1e5ac062dc25afe192b48f41dc0c4477f (diff)
downloadsamba-ccc32898cf56baf93581b3773cb1d82ce0e59b8d.tar.gz
samba-ccc32898cf56baf93581b3773cb1d82ce0e59b8d.tar.bz2
samba-ccc32898cf56baf93581b3773cb1d82ce0e59b8d.zip
Call print_access_check() function from printing back end.
(This used to be commit 979e083d3dd844b98b03108e636dfe11ae157fb0)
-rw-r--r--source3/printing/printing.c60
1 files changed, 45 insertions, 15 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 662bc606a1..9ba6288a68 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -480,10 +480,15 @@ static BOOL print_job_delete1(int jobid)
/****************************************************************************
delete a print job
****************************************************************************/
-BOOL print_job_delete(int jobid)
+BOOL print_job_delete(uint16 vuid, int jobid)
{
int snum = print_job_snum(jobid);
+ if (!print_access_check(snum, vuid, PRINTER_ACE_MANAGE_DOCUMENTS)) {
+ DEBUG(3, ("delete denied by security descriptor\n"));
+ return False;
+ }
+
if (!print_job_delete1(jobid)) return False;
/* force update the database and say the delete failed if the
@@ -497,7 +502,7 @@ BOOL print_job_delete(int jobid)
/****************************************************************************
pause a job
****************************************************************************/
-BOOL print_job_pause(int jobid)
+BOOL print_job_pause(uint16 vuid, int jobid)
{
struct printjob *pjob = print_job_find(jobid);
int snum, ret = -1;
@@ -508,6 +513,11 @@ BOOL print_job_pause(int jobid)
snum = print_job_snum(jobid);
+ if (!print_access_check(snum, vuid, PRINTER_ACE_MANAGE_DOCUMENTS)) {
+ DEBUG(3, ("pause denied by security descriptor\n"));
+ return False;
+ }
+
/* need to pause the spooled entry */
slprintf(jobstr, sizeof(jobstr), "%d", pjob->sysjob);
ret = print_run_command(snum,
@@ -525,7 +535,7 @@ BOOL print_job_pause(int jobid)
/****************************************************************************
resume a job
****************************************************************************/
-BOOL print_job_resume(int jobid)
+BOOL print_job_resume(uint16 vuid, int jobid)
{
struct printjob *pjob = print_job_find(jobid);
int snum, ret;
@@ -536,6 +546,11 @@ BOOL print_job_resume(int jobid)
snum = print_job_snum(jobid);
+ if (!print_access_check(snum, vuid, PRINTER_ACE_MANAGE_DOCUMENTS)) {
+ DEBUG(3, ("resume denied by security descriptor\n"));
+ return False;
+ }
+
slprintf(jobstr, sizeof(jobstr), "%d", pjob->sysjob);
ret = print_run_command(snum,
lp_lpresumecommand(snum), NULL,
@@ -566,7 +581,7 @@ int print_job_write(int jobid, const char *buf, int size)
/***************************************************************************
start spooling a job - return the jobid
***************************************************************************/
-int print_job_start(int snum, char *jobname)
+int print_job_start(int snum, uint16 vuid, char *jobname)
{
int jobid;
char *path;
@@ -574,6 +589,11 @@ int print_job_start(int snum, char *jobname)
int next_jobid;
extern struct current_user current_user;
+ if (!print_access_check(snum, vuid, PRINTER_ACE_PRINT)) {
+ DEBUG(3, ("job start denied by security descriptor\n"));
+ return False;
+ }
+
path = lp_pathname(snum);
/* see if we have sufficient disk space */
@@ -828,11 +848,15 @@ int print_queue_snum(char *qname)
/****************************************************************************
pause a queue
****************************************************************************/
-BOOL print_queue_pause(int snum)
+BOOL print_queue_pause(int snum, uint16 vuid)
{
- int ret = print_run_command(snum,
- lp_queuepausecommand(snum), NULL,
- NULL);
+ int ret;
+
+ if (!print_access_check(snum, vuid, PRINTER_ACE_MANAGE_DOCUMENTS)) {
+ return False;
+ }
+
+ ret = print_run_command(snum, lp_queuepausecommand(snum), NULL, NULL);
/* force update the database */
print_cache_flush(snum);
@@ -843,11 +867,15 @@ BOOL print_queue_pause(int snum)
/****************************************************************************
resume a queue
****************************************************************************/
-BOOL print_queue_resume(int snum)
+BOOL print_queue_resume(int snum, uint16 vuid)
{
- int ret = print_run_command(snum,
- lp_queueresumecommand(snum), NULL,
- NULL);
+ int ret;
+
+ if (!print_access_check(snum, vuid, PRINTER_ACE_MANAGE_DOCUMENTS)) {
+ return False;
+ }
+
+ ret = print_run_command(snum, lp_queueresumecommand(snum), NULL, NULL);
/* force update the database */
print_cache_flush(snum);
@@ -858,12 +886,16 @@ BOOL print_queue_resume(int snum)
/****************************************************************************
purge a queue - implemented by deleting all jobs that we can delete
****************************************************************************/
-BOOL print_queue_purge(int snum)
+BOOL print_queue_purge(int snum, uint16 vuid)
{
print_queue_struct *queue;
print_status_struct status;
int njobs, i;
+ if (!print_access_check(snum, vuid, PRINTER_ACE_MANAGE_DOCUMENTS)) {
+ return False;
+ }
+
njobs = print_queue_status(snum, &queue, &status);
for (i=0;i<njobs;i++) {
print_job_delete1(queue[i].job);
@@ -873,5 +905,3 @@ BOOL print_queue_purge(int snum)
return True;
}
-
-