summaryrefslogtreecommitdiff
path: root/source3/printing/printing.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2012-02-08 15:01:15 +0100
committerDavid Disseldorp <ddiss@samba.org>2012-06-26 16:10:39 +0200
commite1ddf8f0e41643933c2aa58dc9421cbc7631e2e5 (patch)
tree943805c1965b1db294e9f349f9840460a0c7a4eb /source3/printing/printing.c
parent97073589d03f8ea4b871c58cfc86603909568da2 (diff)
downloadsamba-e1ddf8f0e41643933c2aa58dc9421cbc7631e2e5.tar.gz
s3-printing: clean up print_job_pause/resume interface
Currently both return a bool and sometimes set a werr pointer argument, always return werror instead.
Diffstat (limited to 'source3/printing/printing.c')
-rw-r--r--source3/printing/printing.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 3e9fa469c55..931964f9597 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -2229,27 +2229,30 @@ pause, or resume print job. User name: %s. Printer name: %s.",
Pause a job.
****************************************************************************/
-bool print_job_pause(const struct auth_session_info *server_info,
+WERROR print_job_pause(const struct auth_session_info *server_info,
struct messaging_context *msg_ctx,
- int snum, uint32 jobid, WERROR *errcode)
+ int snum, uint32 jobid)
{
const char* sharename = lp_const_servicename(snum);
struct printjob *pjob;
int ret = -1;
struct printif *current_printif = get_printer_fns( snum );
+ WERROR werr;
pjob = print_job_find(sharename, jobid);
if (!pjob || !server_info) {
DEBUG(10, ("print_job_pause: no pjob or user for jobid %u\n",
(unsigned int)jobid ));
- return False;
+ werr = WERR_INVALID_PARAM;
+ goto err_out;
}
if (!pjob->spooled || pjob->sysjob == -1) {
DEBUG(10, ("print_job_pause: not spooled or bad sysjob = %d for jobid %u\n",
(int)pjob->sysjob, (unsigned int)jobid ));
- return False;
+ werr = WERR_INVALID_PARAM;
+ goto err_out;
}
if (!is_owner(server_info, lp_const_servicename(snum), jobid) &&
@@ -2265,16 +2268,16 @@ pause, or resume print job. User name: %s. Printer name: %s.",
lp_printername(snum) );
/* END_ADMIN_LOG */
- *errcode = WERR_ACCESS_DENIED;
- return False;
+ werr = WERR_ACCESS_DENIED;
+ goto err_out;
}
/* need to pause the spooled entry */
ret = (*(current_printif->job_pause))(snum, pjob);
if (ret != 0) {
- *errcode = WERR_INVALID_PARAM;
- return False;
+ werr = WERR_INVALID_PARAM;
+ goto err_out;
}
/* force update the database */
@@ -2286,42 +2289,45 @@ pause, or resume print job. User name: %s. Printer name: %s.",
JOB_STATUS_PAUSED);
/* how do we tell if this succeeded? */
-
- return True;
+ werr = WERR_OK;
+err_out:
+ return werr;
}
/****************************************************************************
Resume a job.
****************************************************************************/
-bool print_job_resume(const struct auth_session_info *server_info,
+WERROR print_job_resume(const struct auth_session_info *server_info,
struct messaging_context *msg_ctx,
- int snum, uint32 jobid, WERROR *errcode)
+ int snum, uint32 jobid)
{
const char *sharename = lp_const_servicename(snum);
struct printjob *pjob;
int ret;
struct printif *current_printif = get_printer_fns( snum );
+ WERROR werr;
pjob = print_job_find(sharename, jobid);
if (!pjob || !server_info) {
DEBUG(10, ("print_job_resume: no pjob or user for jobid %u\n",
(unsigned int)jobid ));
- return False;
+ werr = WERR_INVALID_PARAM;
+ goto err_out;
}
if (!pjob->spooled || pjob->sysjob == -1) {
DEBUG(10, ("print_job_resume: not spooled or bad sysjob = %d for jobid %u\n",
(int)pjob->sysjob, (unsigned int)jobid ));
- return False;
+ werr = WERR_INVALID_PARAM;
+ goto err_out;
}
if (!is_owner(server_info, lp_const_servicename(snum), jobid) &&
!print_access_check(server_info, msg_ctx, snum,
JOB_ACCESS_ADMINISTER)) {
DEBUG(3, ("resume denied by security descriptor\n"));
- *errcode = WERR_ACCESS_DENIED;
/* BEGIN_ADMIN_LOG */
sys_adminlog( LOG_ERR,
@@ -2330,14 +2336,15 @@ pause, or resume print job. User name: %s. Printer name: %s.",
uidtoname(server_info->unix_token->uid),
lp_printername(snum) );
/* END_ADMIN_LOG */
- return False;
+ werr = WERR_ACCESS_DENIED;
+ goto err_out;
}
ret = (*(current_printif->job_resume))(snum, pjob);
if (ret != 0) {
- *errcode = WERR_INVALID_PARAM;
- return False;
+ werr = WERR_INVALID_PARAM;
+ goto err_out;
}
/* force update the database */
@@ -2348,7 +2355,9 @@ pause, or resume print job. User name: %s. Printer name: %s.",
notify_job_status(server_event_context(), msg_ctx, sharename, jobid,
JOB_STATUS_QUEUED);
- return True;
+ werr = WERR_OK;
+err_out:
+ return werr;
}
/****************************************************************************