#include "includes.h"
#include "printing.h"
#include "librpc/gen_ndr/messaging.h"
+#include "../librpc/gen_ndr/ndr_spoolss.h"
+#include "nt_printing.h"
+#include "../librpc/gen_ndr/netlogon.h"
extern struct current_user current_user;
extern userdom_struct current_user_info;
return ret;
}
+/****************************************************************************
+ Pack the devicemode to store it in a tdb.
+****************************************************************************/
+static int pack_devicemode(struct spoolss_DeviceMode *devmode, uint8 *buf, int buflen)
+{
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob;
+ int len = 0;
+
+ if (devmode) {
+ ndr_err = ndr_push_struct_blob(&blob, talloc_tos(),
+ devmode,
+ (ndr_push_flags_fn_t)
+ ndr_push_spoolss_DeviceMode);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(10, ("pack_devicemode: "
+ "error encoding spoolss_DeviceMode\n"));
+ goto done;
+ }
+ } else {
+ ZERO_STRUCT(blob);
+ }
+
+ len = tdb_pack(buf, buflen, "B", blob.length, blob.data);
+
+ if (devmode) {
+ DEBUG(8, ("Packed devicemode [%s]\n", devmode->formname));
+ }
+
+done:
+ return len;
+}
+
+/****************************************************************************
+ Unpack the devicemode to store it in a tdb.
+****************************************************************************/
+static int unpack_devicemode(TALLOC_CTX *mem_ctx,
+ const uint8 *buf, int buflen,
+ struct spoolss_DeviceMode **devmode)
+{
+ struct spoolss_DeviceMode *dm;
+ enum ndr_err_code ndr_err;
+ char *data = NULL;
+ int data_len = 0;
+ DATA_BLOB blob;
+ int len = 0;
+
+ *devmode = NULL;
+
+ len = tdb_unpack(buf, buflen, "B", &data_len, &data);
+ if (!data) {
+ return len;
+ }
+
+ dm = talloc_zero(mem_ctx, struct spoolss_DeviceMode);
+ if (!dm) {
+ goto done;
+ }
+
+ blob = data_blob_const(data, data_len);
+
+ ndr_err = ndr_pull_struct_blob(&blob, dm, dm,
+ (ndr_pull_flags_fn_t)ndr_pull_spoolss_DeviceMode);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(10, ("unpack_devicemode: "
+ "error parsing spoolss_DeviceMode\n"));
+ goto done;
+ }
+
+ DEBUG(8, ("Unpacked devicemode [%s](%s)\n",
+ dm->devicename, dm->formname));
+ if (dm->driverextra_data.data) {
+ DEBUG(8, ("with a private section of %d bytes\n",
+ dm->__driverextra_length));
+ }
+
+ *devmode = dm;
+
+done:
+ SAFE_FREE(data);
+ return len;
+}
+
/***********************************************************************
unpack a pjob from a tdb buffer
***********************************************************************/
return 0;
}
-static void pjob_store_notify(const char* sharename, uint32 jobid, struct printjob *old_data,
+static void pjob_store_notify(struct tevent_context *ev,
+ struct messaging_context *msg_ctx,
+ const char* sharename, uint32 jobid,
+ struct printjob *old_data,
struct printjob *new_data)
{
bool new_job = False;
--jerry (i'll feel dirty for this) */
if (new_job) {
- notify_job_submitted(sharename, jobid, new_data->starttime);
- notify_job_username(sharename, jobid, new_data->user);
+ notify_job_submitted(ev, msg_ctx,
+ sharename, jobid, new_data->starttime);
+ notify_job_username(ev, msg_ctx,
+ sharename, jobid, new_data->user);
}
if (new_job || !strequal(old_data->jobname, new_data->jobname))
- notify_job_name(sharename, jobid, new_data->jobname);
+ notify_job_name(ev, msg_ctx,
+ sharename, jobid, new_data->jobname);
/* Job attributes of a new job or attributes that can be
modified. */
if (new_job || !strequal(old_data->jobname, new_data->jobname))
- notify_job_name(sharename, jobid, new_data->jobname);
+ notify_job_name(ev, msg_ctx,
+ sharename, jobid, new_data->jobname);
if (new_job || old_data->status != new_data->status)
- notify_job_status(sharename, jobid, map_to_spoolss_status(new_data->status));
+ notify_job_status(ev, msg_ctx,
+ sharename, jobid,
+ map_to_spoolss_status(new_data->status));
if (new_job || old_data->size != new_data->size)
- notify_job_total_bytes(sharename, jobid, new_data->size);
+ notify_job_total_bytes(ev, msg_ctx,
+ sharename, jobid, new_data->size);
if (new_job || old_data->page_count != new_data->page_count)
- notify_job_total_pages(sharename, jobid, new_data->page_count);
+ notify_job_total_pages(ev, msg_ctx,
+ sharename, jobid, new_data->page_count);
}
/****************************************************************************
Store a job structure back to the database.
****************************************************************************/
-static bool pjob_store(const char* sharename, uint32 jobid, struct printjob *pjob)
+static bool pjob_store(struct tevent_context *ev,
+ struct messaging_context *msg_ctx,
+ const char* sharename, uint32 jobid,
+ struct printjob *pjob)
{
uint32_t tmp;
TDB_DATA old_data, new_data;
{
if ( unpack_pjob( old_data.dptr, old_data.dsize, &old_pjob ) != -1 )
{
- pjob_store_notify( sharename, jobid, &old_pjob , pjob );
+ pjob_store_notify(server_event_context(),
+ msg_ctx,
+ sharename, jobid, &old_pjob,
+ pjob);
talloc_free(old_pjob.devmode);
}
}
else {
/* new job */
- pjob_store_notify( sharename, jobid, NULL, pjob );
+ pjob_store_notify(server_event_context(), msg_ctx,
+ sharename, jobid, NULL, pjob);
}
}
Remove a job structure from the database.
****************************************************************************/
-void pjob_delete(const char* sharename, uint32 jobid)
+static void pjob_delete(struct tevent_context *ev,
+ struct messaging_context *msg_ctx,
+ const char* sharename, uint32 jobid)
{
uint32_t tmp;
struct printjob *pjob;
properly. */
job_status = JOB_STATUS_DELETING|JOB_STATUS_DELETED;
- notify_job_status(sharename, jobid, job_status);
+ notify_job_status(ev, msg_ctx, sharename, jobid, job_status);
/* Remove from printing.tdb */
List a unix job in the print database.
****************************************************************************/
-static void print_unix_job(const char *sharename, print_queue_struct *q, uint32 jobid)
+static void print_unix_job(struct tevent_context *ev,
+ struct messaging_context *msg_ctx,
+ const char *sharename, print_queue_struct *q,
+ uint32 jobid)
{
struct printjob pj, *old_pj;
fstrcpy(pj.user, old_pj ? old_pj->user : q->fs_user);
fstrcpy(pj.queuename, old_pj ? old_pj->queuename : sharename );
- pjob_store(sharename, jobid, &pj);
+ pjob_store(ev, msg_ctx, sharename, jobid, &pj);
}
time_t lpq_time;
const char *lprm_command;
struct printif *print_if;
+ struct tevent_context *ev;
+ struct messaging_context *msg_ctx;
};
/****************************************************************************
if (i == ts->qcount) {
DEBUG(10,("traverse_fn_delete: pjob %u deleted due to !smbjob\n",
(unsigned int)jobid ));
- pjob_delete(ts->sharename, jobid);
+ pjob_delete(ts->ev, ts->msg_ctx,
+ ts->sharename, jobid);
return 0;
}
if (!process_exists_by_pid(pjob.pid)) {
DEBUG(10,("traverse_fn_delete: pjob %u deleted due to !process_exists (%u)\n",
(unsigned int)jobid, (unsigned int)pjob.pid ));
- pjob_delete(ts->sharename, jobid);
+ pjob_delete(ts->ev, ts->msg_ctx,
+ ts->sharename, jobid);
} else
ts->total_jobs++;
return 0;
if ( result != 0 ) {
/* if we can't delete, then reset the job status */
pjob.status = LPQ_QUEUED;
- pjob_store(ts->sharename, jobid, &pjob);
+ pjob_store(ts->ev, ts->msg_ctx,
+ ts->sharename, jobid, &pjob);
}
else {
/* if we deleted the job, the remove the tdb record */
- pjob_delete(ts->sharename, jobid);
+ pjob_delete(ts->ev,
+ ts->msg_ctx,
+ ts->sharename, jobid);
pjob.status = LPQ_DELETED;
}
(unsigned int)jobid,
(unsigned int)pjob.starttime,
(unsigned int)ts->lpq_time ));
- pjob_delete(ts->sharename, jobid);
+ pjob_delete(ts->ev, ts->msg_ctx,
+ ts->sharename, jobid);
} else
ts->total_jobs++;
return 0;
main work for updating the lpq cahe for a printer queue
****************************************************************************/
-static void print_queue_update_internal( const char *sharename,
+static void print_queue_update_internal( struct tevent_context *ev,
+ struct messaging_context *msg_ctx,
+ const char *sharename,
struct printif *current_printif,
char *lpq_command, char *lprm_command )
{
if (jobid == (uint32)-1) {
/* assume its a unix print job */
- print_unix_job(sharename, &queue[i], jobid);
+ print_unix_job(ev, msg_ctx,
+ sharename, &queue[i], jobid);
continue;
}
/* err, somethings wrong. Probably smbd was restarted
with jobs in the queue. All we can do is treat them
like unix jobs. Pity. */
- print_unix_job(sharename, &queue[i], jobid);
+ print_unix_job(ev, msg_ctx,
+ sharename, &queue[i], jobid);
continue;
}
if ( pjob->status != LPQ_DELETING )
pjob->status = queue[i].status;
- pjob_store(sharename, jobid, pjob);
+ pjob_store(ev, msg_ctx, sharename, jobid, pjob);
check_job_changed(sharename, jcdata, jobid);
}
tstruct.sharename = sharename;
tstruct.lprm_command = lprm_command;
tstruct.print_if = current_printif;
+ tstruct.ev = ev;
+ tstruct.msg_ctx = msg_ctx;
tdb_traverse(pdb->tdb, traverse_fn_delete, (void *)&tstruct);
/* do the main work now */
- print_queue_update_internal( sharename, current_printif,
- lpq_command, lprm_command );
+ print_queue_update_internal(server_event_context(),
+ server_messaging_context(),
+ sharename, current_printif,
+ lpq_command, lprm_command);
/* Delete our pid from the db. */
set_updating_pid(sharename, False);
/****************************************************************************
main thread of the background lpq updater
****************************************************************************/
-void start_background_queue(void)
+void start_background_queue(struct tevent_context *ev,
+ struct messaging_context *msg_ctx)
{
/* Use local variables for this as we don't
* need to save the parent side of this, just
close(pause_pipe[0]);
pause_pipe[0] = -1;
- status = reinit_after_fork(server_messaging_context(),
- server_event_context(),
- procid_self(), true);
+ status = reinit_after_fork(msg_ctx, ev, procid_self(), true);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
}
smbd_setup_sig_term_handler();
- smbd_setup_sig_hup_handler();
+ smbd_setup_sig_hup_handler(ev, msg_ctx);
if (!serverid_register(procid_self(),
FLAG_MSG_GENERAL|FLAG_MSG_SMBD
exit(1);
}
- messaging_register(server_messaging_context(), NULL,
- MSG_PRINTER_UPDATE, print_queue_receive);
+ messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE,
+ print_queue_receive);
- fde = tevent_add_fd(server_event_context(),
- server_event_context(),
- pause_pipe[1], TEVENT_FD_READ,
+ fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ,
printing_pause_fd_handler,
NULL);
if (!fde) {
}
DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n"));
- ret = tevent_loop_wait(server_event_context());
+ ret = tevent_loop_wait(ev);
/* should not be reached */
DEBUG(0,("background_queue: tevent_loop_wait() exited with %d - %s\n",
ret, (ret == 0) ? "out of events" : strerror(errno)));
update the internal database from the system print queue for a queue
****************************************************************************/
-static void print_queue_update(int snum, bool force)
+static void print_queue_update(struct messaging_context *msg_ctx,
+ int snum, bool force)
{
fstring key;
fstring sharename;
/* finally send the message */
- messaging_send_buf(server_messaging_context(),
- pid_to_procid(background_lpq_updater_pid),
+ messaging_send_buf(msg_ctx, pid_to_procid(background_lpq_updater_pid),
MSG_PRINTER_UPDATE, (uint8 *)buffer, len);
SAFE_FREE( buffer );
return ret;
}
-/****************************************************************************
- Give the fd used for a jobid.
-****************************************************************************/
-
-int print_job_fd(const char* sharename, uint32 jobid)
-{
- struct printjob *pjob = print_job_find(sharename, jobid);
- if (!pjob)
- return -1;
- /* don't allow another process to get this info - it is meaningless */
- if (pjob->pid != sys_getpid())
- return -1;
- return pjob->fd;
-}
-
/****************************************************************************
Give the filename used for a jobid.
Only valid for the process doing the spooling and when the job
return False;
fstrcpy(pjob->jobname, name);
- return pjob_store(sharename, jobid, pjob);
+ return pjob_store(server_event_context(), server_messaging_context(),
+ sharename, jobid, pjob);
}
/****************************************************************************
/* Set the tdb entry to be deleting. */
pjob->status = LPQ_DELETING;
- pjob_store(sharename, jobid, pjob);
+ pjob_store(server_event_context(), server_messaging_context(),
+ sharename, jobid, pjob);
if (pjob->spooled && pjob->sysjob != -1)
{
if (!pdb)
return False;
- pjob_delete(sharename, jobid);
+ pjob_delete(server_event_context(),
+ server_messaging_context(),
+ sharename, jobid);
/* Ensure we keep a rough count of the number of total jobs... */
tdb_change_int32_atomic(pdb->tdb, "INFO/total_jobs", &njobs, -1);
release_print_db(pdb);
****************************************************************************/
WERROR print_job_delete(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx,
int snum, uint32_t jobid)
{
const char* sharename = lp_const_servicename(snum);
owns their job. */
if (!owner &&
- !print_access_check(server_info, snum, JOB_ACCESS_ADMINISTER)) {
+ !print_access_check(server_info, msg_ctx, snum,
+ JOB_ACCESS_ADMINISTER)) {
DEBUG(3, ("delete denied by security descriptor\n"));
/* BEGIN_ADMIN_LOG */
/* force update the database and say the delete failed if the
job still exists */
- print_queue_update(snum, True);
+ print_queue_update(msg_ctx, snum, True);
pjob = print_job_find(sharename, jobid);
if (pjob && (pjob->status != LPQ_DELETING)) {
Pause a job.
****************************************************************************/
-bool print_job_pause(struct auth_serversupplied_info *server_info, int snum,
- uint32 jobid, WERROR *errcode)
+bool print_job_pause(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx,
+ int snum, uint32 jobid, WERROR *errcode)
{
const char* sharename = lp_const_servicename(snum);
struct printjob *pjob;
}
if (!is_owner(server_info, lp_const_servicename(snum), jobid) &&
- !print_access_check(server_info, snum, JOB_ACCESS_ADMINISTER)) {
+ !print_access_check(server_info, msg_ctx, snum,
+ JOB_ACCESS_ADMINISTER)) {
DEBUG(3, ("pause denied by security descriptor\n"));
/* BEGIN_ADMIN_LOG */
/* Send a printer notify message */
- notify_job_status(sharename, jobid, JOB_STATUS_PAUSED);
+ notify_job_status(server_event_context(), msg_ctx, sharename, jobid,
+ JOB_STATUS_PAUSED);
/* how do we tell if this succeeded? */
Resume a job.
****************************************************************************/
-bool print_job_resume(struct auth_serversupplied_info *server_info, int snum,
- uint32 jobid, WERROR *errcode)
+bool print_job_resume(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx,
+ int snum, uint32 jobid, WERROR *errcode)
{
const char *sharename = lp_const_servicename(snum);
struct printjob *pjob;
}
if (!is_owner(server_info, lp_const_servicename(snum), jobid) &&
- !print_access_check(server_info, snum, JOB_ACCESS_ADMINISTER)) {
+ !print_access_check(server_info, msg_ctx, snum,
+ JOB_ACCESS_ADMINISTER)) {
DEBUG(3, ("resume denied by security descriptor\n"));
*errcode = WERR_ACCESS_DENIED;
/* Send a printer notify message */
- notify_job_status(sharename, jobid, JOB_STATUS_QUEUED);
+ notify_job_status(server_event_context(), msg_ctx, sharename, jobid,
+ JOB_STATUS_QUEUED);
return True;
}
if (return_code>0) {
pjob->size += size;
- pjob_store(sharename, jobid, pjob);
+ pjob_store(server_event_context(), server_messaging_context(),
+ sharename, jobid, pjob);
}
return return_code;
}
Determine the number of jobs in a queue.
****************************************************************************/
-int print_queue_length(int snum, print_status_struct *pstatus)
+int print_queue_length(struct messaging_context *msg_ctx, int snum,
+ print_status_struct *pstatus)
{
const char* sharename = lp_const_servicename( snum );
print_status_struct status;
/* make sure the database is up to date */
if (print_cache_expired(lp_const_servicename(snum), True))
- print_queue_update(snum, False);
+ print_queue_update(msg_ctx, snum, False);
/* also fetch the queue status */
memset(&status, 0, sizeof(status));
***************************************************************************/
static WERROR print_job_checks(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx,
int snum, int *njobs)
{
const char *sharename = lp_const_servicename(snum);
uint64_t minspace;
int ret;
- if (!print_access_check(server_info, snum, PRINTER_ACCESS_USE)) {
+ if (!print_access_check(server_info, msg_ctx, snum,
+ PRINTER_ACCESS_USE)) {
DEBUG(3, ("print_job_checks: "
"job start denied by security descriptor\n"));
return WERR_ACCESS_DENIED;
}
- if (!print_time_access_check(server_info, sharename)) {
+ if (!print_time_access_check(server_info, msg_ctx, sharename)) {
DEBUG(3, ("print_job_checks: "
"job start denied by time check\n"));
return WERR_ACCESS_DENIED;
}
/* Insure the maximum queue size is not violated */
- *njobs = print_queue_length(snum, NULL);
+ *njobs = print_queue_length(msg_ctx, snum, NULL);
if (*njobs > lp_maxprintjobs(snum)) {
DEBUG(3, ("print_job_checks: Queue %s number of jobs (%d) "
"larger than max printjobs per queue (%d).\n",
***************************************************************************/
WERROR print_job_start(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx,
int snum, const char *docname, const char *filename,
struct spoolss_DeviceMode *devmode, uint32_t *_jobid)
{
path = lp_pathname(snum);
- werr = print_job_checks(server_info, snum, &njobs);
+ werr = print_job_checks(server_info, msg_ctx, snum, &njobs);
if (!W_ERROR_IS_OK(werr)) {
release_print_db(pdb);
return werr;
goto fail;
}
- pjob_store(sharename, jobid, &pjob);
+ pjob_store(server_event_context(), msg_ctx, sharename, jobid, &pjob);
/* Update the 'jobs changed' entry used by print_queue_status. */
add_to_jobs_changed(pdb, jobid);
fail:
if (jobid != -1) {
- pjob_delete(sharename, jobid);
+ pjob_delete(server_event_context(), msg_ctx, sharename, jobid);
}
release_print_db(pdb);
return;
pjob->page_count++;
- pjob_store(sharename, jobid, pjob);
+ pjob_store(server_event_context(), server_messaging_context(),
+ sharename, jobid, pjob);
}
/****************************************************************************
error.
****************************************************************************/
-NTSTATUS print_job_end(int snum, uint32 jobid, enum file_close_type close_type)
+NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
+ uint32 jobid, enum file_close_type close_type)
{
const char* sharename = lp_const_servicename(snum);
struct printjob *pjob;
DEBUG(5,("print_job_end: canceling spool of %s (%s)\n",
pjob->filename, pjob->size ? "deleted" : "zero length" ));
unlink(pjob->filename);
- pjob_delete(sharename, jobid);
+ pjob_delete(server_event_context(), msg_ctx, sharename, jobid);
return NT_STATUS_OK;
}
pjob->spooled = True;
pjob->status = LPQ_QUEUED;
- pjob_store(sharename, jobid, pjob);
+ pjob_store(server_event_context(), msg_ctx, sharename, jobid, pjob);
/* make sure the database is up to date */
if (print_cache_expired(lp_const_servicename(snum), True))
- print_queue_update(snum, False);
+ print_queue_update(msg_ctx, snum, False);
return NT_STATUS_OK;
/* Still need to add proper error return propagation! 010122:JRR */
pjob->fd = -1;
unlink(pjob->filename);
- pjob_delete(sharename, jobid);
+ pjob_delete(server_event_context(), msg_ctx, sharename, jobid);
return status;
}
Get a snapshot of jobs in the system without traversing.
****************************************************************************/
-static bool get_stored_queue_info(struct tdb_print_db *pdb, int snum, int *pcount, print_queue_struct **ppqueue)
+static bool get_stored_queue_info(struct messaging_context *msg_ctx,
+ struct tdb_print_db *pdb, int snum,
+ int *pcount, print_queue_struct **ppqueue)
{
TDB_DATA data, cgdata;
print_queue_struct *queue = NULL;
/* make sure the database is up to date */
if (print_cache_expired(lp_const_servicename(snum), True))
- print_queue_update(snum, False);
+ print_queue_update(msg_ctx, snum, False);
*pcount = 0;
*ppqueue = NULL;
set queue = NULL and status = NULL if you just want to update the cache
****************************************************************************/
-int print_queue_status(int snum,
+int print_queue_status(struct messaging_context *msg_ctx, int snum,
print_queue_struct **ppqueue,
print_status_struct *status)
{
/* make sure the database is up to date */
if (print_cache_expired(lp_const_servicename(snum), True))
- print_queue_update(snum, False);
+ print_queue_update(msg_ctx, snum, False);
/* return if we are done */
if ( !ppqueue || !status )
* of entries, and then only retrieve the queue if necessary.
*/
- if (!get_stored_queue_info(pdb, snum, &count, ppqueue)) {
+ if (!get_stored_queue_info(msg_ctx, pdb, snum, &count, ppqueue)) {
release_print_db(pdb);
return 0;
}
Pause a queue.
****************************************************************************/
-WERROR print_queue_pause(struct auth_serversupplied_info *server_info, int snum)
+WERROR print_queue_pause(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx, int snum)
{
int ret;
struct printif *current_printif = get_printer_fns( snum );
- if (!print_access_check(server_info, snum,
+ if (!print_access_check(server_info, msg_ctx, snum,
PRINTER_ACCESS_ADMINISTER)) {
return WERR_ACCESS_DENIED;
}
/* Send a printer notify message */
- notify_printer_status(snum, PRINTER_STATUS_PAUSED);
+ notify_printer_status(server_event_context(), msg_ctx, snum,
+ PRINTER_STATUS_PAUSED);
return WERR_OK;
}
Resume a queue.
****************************************************************************/
-WERROR print_queue_resume(struct auth_serversupplied_info *server_info, int snum)
+WERROR print_queue_resume(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx, int snum)
{
int ret;
struct printif *current_printif = get_printer_fns( snum );
- if (!print_access_check(server_info, snum,
+ if (!print_access_check(server_info, msg_ctx, snum,
PRINTER_ACCESS_ADMINISTER)) {
return WERR_ACCESS_DENIED;
}
/* make sure the database is up to date */
if (print_cache_expired(lp_const_servicename(snum), True))
- print_queue_update(snum, True);
+ print_queue_update(msg_ctx, snum, True);
/* Send a printer notify message */
- notify_printer_status(snum, PRINTER_STATUS_OK);
+ notify_printer_status(server_event_context(), msg_ctx, snum,
+ PRINTER_STATUS_OK);
return WERR_OK;
}
Purge a queue - implemented by deleting all jobs that we can delete.
****************************************************************************/
-WERROR print_queue_purge(struct auth_serversupplied_info *server_info, int snum)
+WERROR print_queue_purge(struct auth_serversupplied_info *server_info,
+ struct messaging_context *msg_ctx, int snum)
{
print_queue_struct *queue;
print_status_struct status;
bool can_job_admin;
/* Force and update so the count is accurate (i.e. not a cached count) */
- print_queue_update(snum, True);
+ print_queue_update(msg_ctx, snum, True);
- can_job_admin = print_access_check(server_info, snum,
+ can_job_admin = print_access_check(server_info,
+ msg_ctx,
+ snum,
JOB_ACCESS_ADMINISTER);
- njobs = print_queue_status(snum, &queue, &status);
+ njobs = print_queue_status(msg_ctx, snum, &queue, &status);
if ( can_job_admin )
become_root();
unbecome_root();
/* update the cache */
- print_queue_update( snum, True );
+ print_queue_update(msg_ctx, snum, True);
SAFE_FREE(queue);