r242: adding 'cups options' parameter to allow raw printing without changing /etc...
authorGerald Carter <jerry@samba.org>
Thu, 15 Apr 2004 20:40:26 +0000 (20:40 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:51:15 +0000 (10:51 -0500)
(This used to be commit 2f323b0991c37022fb59ef8c69454eff03296662)

source3/include/smb.h
source3/param/loadparm.c
source3/printing/print_cups.c

index 7ed284896df56250ef1b20613613120908b480f9..aab61deaabbac67e3ca26c676947bfeee4c544bc 100644 (file)
@@ -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;
index 061af12494aba2d326034694be308dce64cf737b..edd1bc0be78202c25f539b7b8b4f74a669f7b33b 100644 (file)
@@ -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)
index f0096a17c2c40a42c082eb0288ac2039716b8e9f..9a48296543d0e9d03cbfa41cf925032506d3ce34 100644 (file)
@@ -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.
  */