From 578a7d254fa857a9cd109f27efe1071c0afc37c5 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 15 Apr 2004 20:40:26 +0000 Subject: r242: adding 'cups options' parameter to allow raw printing without changing /etc/cups/cupsd.conf -- documentation to follow (This used to be commit 2f323b0991c37022fb59ef8c69454eff03296662) --- source3/include/smb.h | 2 +- source3/param/loadparm.c | 4 ++++ source3/printing/print_cups.c | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/include/smb.h b/source3/include/smb.h index 7ed284896d..aab61deaab 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -539,7 +539,7 @@ enum {LPQ_QUEUED=0,LPQ_PAUSED,LPQ_SPOOLING,LPQ_PRINTING,LPQ_ERROR,LPQ_DELETING, typedef struct _print_queue_struct { - int job; /* normally the SMB jobid -- see note in + int job; /* normally the UNIX jobid -- see note in printing.c:traverse_fn_delete() */ int size; int page_count; diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 061af12494..edd1bc0be7 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -315,6 +315,7 @@ typedef struct char *szPostExec; char *szRootPreExec; char *szRootPostExec; + char *szCupsOptions; char *szPrintcommand; char *szLpqcommand; char *szLprmcommand; @@ -438,6 +439,7 @@ static service sDefault = { NULL, /* szPostExec */ NULL, /* szRootPreExec */ NULL, /* szRootPostExec */ + NULL, /* szCupsOptions */ NULL, /* szPrintcommand */ NULL, /* szLpqcommand */ NULL, /* szLprmcommand */ @@ -952,6 +954,7 @@ static struct parm_struct parm_table[] = { {"printable", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT}, {"print ok", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_HIDE}, {"printing", P_ENUM, P_LOCAL, &sDefault.iPrinting, handle_printing, enum_printing, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, + {"cups options", P_STRING, P_LOCAL, &sDefault.szCupsOptions, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, {"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, {"disable spoolss", P_BOOL, P_GLOBAL, &Globals.bDisableSpoolss, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, {"lpq command", P_STRING, P_LOCAL, &sDefault.szLpqcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL}, @@ -1800,6 +1803,7 @@ FN_LOCAL_STRING(lp_username, szUsername) FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers) FN_LOCAL_LIST(lp_valid_users, szValidUsers) FN_LOCAL_LIST(lp_admin_users, szAdminUsers) +FN_LOCAL_STRING(lp_cups_options, szCupsOptions) FN_LOCAL_STRING(lp_printcommand, szPrintcommand) FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand) FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand) diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index f0096a17c2..9a48296543 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -683,6 +683,8 @@ cups_job_submit(int snum, struct printjob *pjob) char uri[HTTP_MAX_URI]; /* printer-uri attribute */ char *clientname; /* hostname of client for job-originating-host attribute */ pstring new_jobname; + int num_options = 0; + cups_option_t *options; DEBUG(5,("cups_job_submit(%d, %p (%d))\n", snum, pjob, pjob->sysjob)); @@ -751,6 +753,17 @@ cups_job_submit(int snum, struct printjob *pjob) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL, new_jobname); + /* + * add any options defined in smb.conf + */ + + num_options = 0; + options = NULL; + num_options = cupsParseOptions(lp_cups_options(snum), num_options, &options); + + if ( num_options ) + cupsEncodeOptions(request, num_options, options); + /* * Do the request and get back a response... */ @@ -782,7 +795,6 @@ cups_job_submit(int snum, struct printjob *pjob) return (ret); } - /* * 'cups_queue_get()' - Get all the jobs in the print queue. */ -- cgit