summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/printing.h8
-rw-r--r--source3/printing/printing.c47
-rw-r--r--source3/rpc_server/spoolss/srv_spoolss_nt.c12
3 files changed, 36 insertions, 31 deletions
diff --git a/source3/include/printing.h b/source3/include/printing.h
index 0e7a5f51fe..58483cbbfb 100644
--- a/source3/include/printing.h
+++ b/source3/include/printing.h
@@ -203,12 +203,12 @@ bool print_job_get_name(TALLOC_CTX *mem_ctx, const char *sharename, uint32_t job
WERROR print_job_delete(const struct auth_session_info *server_info,
struct messaging_context *msg_ctx,
int snum, uint32_t jobid);
-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);
-bool print_job_resume(const struct auth_session_info *server_info,
+ int snum, uint32 jobid);
+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);
ssize_t print_job_write(struct tevent_context *ev,
struct messaging_context *msg_ctx,
int snum, uint32 jobid, const char *buf, size_t size);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 3e9fa469c5..931964f959 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;
}
/****************************************************************************
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index fab5579223..7befe7fd8f 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -7381,17 +7381,13 @@ WERROR _spoolss_SetJob(struct pipes_struct *p,
}
break;
case SPOOLSS_JOB_CONTROL_PAUSE:
- if (print_job_pause(session_info, p->msg_ctx,
- snum, r->in.job_id, &errcode)) {
- errcode = WERR_OK;
- }
+ errcode = print_job_pause(session_info, p->msg_ctx,
+ snum, r->in.job_id);
break;
case SPOOLSS_JOB_CONTROL_RESTART:
case SPOOLSS_JOB_CONTROL_RESUME:
- if (print_job_resume(session_info, p->msg_ctx,
- snum, r->in.job_id, &errcode)) {
- errcode = WERR_OK;
- }
+ errcode = print_job_resume(session_info, p->msg_ctx,
+ snum, r->in.job_id);
break;
case 0:
errcode = WERR_OK;