#include "printing.h"
/* Current printer interface */
-static struct printif *current_printif = &generic_printif;
static BOOL remove_from_jobs_changed(int snum, uint32 jobid);
/*
close_all_print_db(); /* Don't leave any open. */
- /* select the appropriate printing interface... */
-#ifdef HAVE_CUPS
- if (strcmp(lp_printcapname(), "cups") == 0)
- current_printif = &cups_printif;
-#endif /* HAVE_CUPS */
-
/* do NT print initialization... */
return nt_printing_init();
}
close_all_print_db(); /* Don't leave any open. */
}
+/****************************************************************************
+ Retrieve the set of printing functions for a given service. This allows
+ us to set the printer function table based on the value of the 'printing'
+ service parameter.
+
+ Use the generic interface as the default and only use cups interface only
+ when asked for (and only when supported)
+****************************************************************************/
+
+static struct printif *get_printer_fns( int snum )
+{
+ struct printif *printer_fns = &generic_printif;
+
+#ifdef HAVE_CUPS
+ if ( lp_printing(snum) == PRINT_CUPS ) {
+ printer_fns = &cups_printif;
+ }
+#endif /* HAVE_CUPS */
+
+ return printer_fns;
+}
+
/****************************************************************************
Useful function to generate a tdb key.
****************************************************************************/
TDB_DATA data, key;
TDB_DATA jcdata;
struct tdb_print_db *pdb;
+ struct printif *current_printif = get_printer_fns( snum );
fstrcpy(printer_name, lp_const_servicename(snum));
pdb = get_print_db_byname(printer_name);
{
struct printjob *pjob = print_job_find(snum, jobid);
int result = 0;
+ struct printif *current_printif = get_printer_fns( snum );
if (!pjob)
return False;
{
struct printjob *pjob = print_job_find(snum, jobid);
int ret = -1;
+ struct printif *current_printif = get_printer_fns( snum );
if (!pjob || !user)
return False;
{
struct printjob *pjob = print_job_find(snum, jobid);
int ret;
+ struct printif *current_printif = get_printer_fns( snum );
if (!pjob || !user)
return False;
struct printjob *pjob = print_job_find(snum, jobid);
int ret;
SMB_STRUCT_STAT sbuf;
+ struct printif *current_printif = get_printer_fns( snum );
if (!pjob)
return False;
BOOL print_queue_pause(struct current_user *user, int snum, WERROR *errcode)
{
int ret;
+ struct printif *current_printif = get_printer_fns( snum );
if (!print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
*errcode = WERR_ACCESS_DENIED;
BOOL print_queue_resume(struct current_user *user, int snum, WERROR *errcode)
{
int ret;
+ struct printif *current_printif = get_printer_fns( snum );
if (!print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
*errcode = WERR_ACCESS_DENIED;