summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-05-06 01:10:33 +0200
committerGünther Deschner <gd@samba.org>2009-05-06 10:19:04 +0200
commit9966541f89b45834cdf63060202621f885bf9f5c (patch)
tree0f689b5ae92a753a6b18aba932a8fea2dfd164bf
parent4cbd0c77e42627c76dda88af5326ef91415a652d (diff)
downloadsamba-9966541f89b45834cdf63060202621f885bf9f5c.tar.gz
samba-9966541f89b45834cdf63060202621f885bf9f5c.tar.bz2
samba-9966541f89b45834cdf63060202621f885bf9f5c.zip
s3-printing: simplify print_queue helper functions and return WERROR.
Guenther
-rw-r--r--source3/include/proto.h9
-rw-r--r--source3/printing/printing.c27
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c12
-rw-r--r--source3/smbd/lanman.c17
4 files changed, 23 insertions, 42 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 194d74db5e..6b1febb160 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4799,12 +4799,9 @@ bool print_job_end(int snum, uint32 jobid, enum file_close_type close_type);
int print_queue_status(int snum,
print_queue_struct **ppqueue,
print_status_struct *status);
-bool print_queue_pause(struct auth_serversupplied_info *server_info, int snum,
- WERROR *errcode);
-bool print_queue_resume(struct auth_serversupplied_info *server_info, int snum,
- WERROR *errcode);
-bool print_queue_purge(struct auth_serversupplied_info *server_info, int snum,
- WERROR *errcode);
+WERROR print_queue_pause(struct auth_serversupplied_info *server_info, int snum);
+WERROR print_queue_resume(struct auth_serversupplied_info *server_info, int snum);
+WERROR print_queue_purge(struct auth_serversupplied_info *server_info, int snum);
/* The following definitions come from printing/printing_db.c */
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index a661d3dbdc..83b5ac8b43 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -2797,16 +2797,14 @@ int print_queue_status(int snum,
Pause a queue.
****************************************************************************/
-bool print_queue_pause(struct auth_serversupplied_info *server_info, int snum,
- WERROR *errcode)
+WERROR print_queue_pause(struct auth_serversupplied_info *server_info, int snum)
{
int ret;
struct printif *current_printif = get_printer_fns( snum );
if (!print_access_check(server_info, snum,
PRINTER_ACCESS_ADMINISTER)) {
- *errcode = WERR_ACCESS_DENIED;
- return False;
+ return WERR_ACCESS_DENIED;
}
@@ -2817,8 +2815,7 @@ bool print_queue_pause(struct auth_serversupplied_info *server_info, int snum,
unbecome_root();
if (ret != 0) {
- *errcode = WERR_INVALID_PARAM;
- return False;
+ return WERR_INVALID_PARAM;
}
/* force update the database */
@@ -2828,23 +2825,21 @@ bool print_queue_pause(struct auth_serversupplied_info *server_info, int snum,
notify_printer_status(snum, PRINTER_STATUS_PAUSED);
- return True;
+ return WERR_OK;
}
/****************************************************************************
Resume a queue.
****************************************************************************/
-bool print_queue_resume(struct auth_serversupplied_info *server_info, int snum,
- WERROR *errcode)
+WERROR print_queue_resume(struct auth_serversupplied_info *server_info, int snum)
{
int ret;
struct printif *current_printif = get_printer_fns( snum );
if (!print_access_check(server_info, snum,
PRINTER_ACCESS_ADMINISTER)) {
- *errcode = WERR_ACCESS_DENIED;
- return False;
+ return WERR_ACCESS_DENIED;
}
become_root();
@@ -2854,8 +2849,7 @@ bool print_queue_resume(struct auth_serversupplied_info *server_info, int snum,
unbecome_root();
if (ret != 0) {
- *errcode = WERR_INVALID_PARAM;
- return False;
+ return WERR_INVALID_PARAM;
}
/* make sure the database is up to date */
@@ -2866,15 +2860,14 @@ bool print_queue_resume(struct auth_serversupplied_info *server_info, int snum,
notify_printer_status(snum, PRINTER_STATUS_OK);
- return True;
+ return WERR_OK;
}
/****************************************************************************
Purge a queue - implemented by deleting all jobs that we can delete.
****************************************************************************/
-bool print_queue_purge(struct auth_serversupplied_info *server_info, int snum,
- WERROR *errcode)
+WERROR print_queue_purge(struct auth_serversupplied_info *server_info, int snum)
{
print_queue_struct *queue;
print_status_struct status;
@@ -2908,5 +2901,5 @@ bool print_queue_purge(struct auth_serversupplied_info *server_info, int snum,
SAFE_FREE(queue);
- return True;
+ return WERR_OK;
}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 57410d0539..28c59d1fee 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -5730,20 +5730,14 @@ static WERROR control_printer(struct policy_handle *handle, uint32_t command,
switch (command) {
case SPOOLSS_PRINTER_CONTROL_PAUSE:
- if (print_queue_pause(p->server_info, snum, &errcode)) {
- errcode = WERR_OK;
- }
+ errcode = print_queue_pause(p->server_info, snum);
break;
case SPOOLSS_PRINTER_CONTROL_RESUME:
case SPOOLSS_PRINTER_CONTROL_UNPAUSE:
- if (print_queue_resume(p->server_info, snum, &errcode)) {
- errcode = WERR_OK;
- }
+ errcode = print_queue_resume(p->server_info, snum);
break;
case SPOOLSS_PRINTER_CONTROL_PURGE:
- if (print_queue_purge(p->server_info, snum, &errcode)) {
- errcode = WERR_OK;
- }
+ errcode = print_queue_purge(p->server_info, snum);
break;
default:
return WERR_UNKNOWN_LEVEL;
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 979e5b57a4..1672c518ac 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -2869,23 +2869,20 @@ static bool api_WPrintQueueCtrl(connection_struct *conn,uint16 vuid,
switch (function) {
case 74: /* Pause queue */
- if (print_queue_pause(conn->server_info, snum, &werr)) {
- errcode = NERR_Success;
- }
+ werr = print_queue_pause(conn->server_info, snum);
break;
case 75: /* Resume queue */
- if (print_queue_resume(conn->server_info, snum, &werr)) {
- errcode = NERR_Success;
- }
+ werr = print_queue_resume(conn->server_info, snum);
break;
case 103: /* Purge */
- if (print_queue_purge(conn->server_info, snum, &werr)) {
- errcode = NERR_Success;
- }
+ werr = print_queue_purge(conn->server_info, snum);
+ break;
+ default:
+ werr = WERR_NOT_SUPPORTED;
break;
}
- if (!W_ERROR_IS_OK(werr)) errcode = W_ERROR_V(werr);
+ errcode = W_ERROR_V(werr);
out:
SSVAL(*rparam,0,errcode);