s3-printing: Restrict printing=cups to systems with cups development headers at build...
authorAndrew Bartlett <abartlet@samba.org>
Wed, 5 Sep 2012 05:03:31 +0000 (15:03 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 6 Sep 2012 01:16:11 +0000 (11:16 +1000)
This means that instead of failing due to the default commandline values not being quite correct
that we clearly fail at loadparm and testparm time when parsing the printing= line.

Andrew Bartlett

docs-xml/smbdotconf/printing/printing.xml
lib/param/param_table.c
source3/param/loadparm.c
source3/utils/testparm.c

index c365594e1f12997e5838f90bb293b89173dd9450..eb5925f740f2b70ed4061ad1998fcec0165ef986 100644 (file)
     <constant>LPRNG</constant>, <constant>PLP</constant>,
     <constant>SYSV</constant>, <constant>HPUX</constant>,
     <constant>QNX</constant>, <constant>SOFTQ</constant>,
-    and <constant>CUPS</constant>.</para>
+    <constant>CUPS</constant> and <constant>IPRINT</constant>.</para>
+
+    <para>Be aware that CUPS and IPRINT are only available if the CUPS
+    development library was available at the time Samba was compiled
+    or packaged.</para>
 
     <para>To see what the defaults are for the other print 
     commands when using the various options use the <citerefentry><refentrytitle>testparm</refentrytitle>
index 4126d89c65cef11ecc5e341e3f67497ddbf82053..2aa392a683baa7120d8e91fb11349f7ca3c55a8b 100644 (file)
@@ -186,8 +186,12 @@ static const struct enum_list enum_printing[] = {
        {PRINT_QNX, "qnx"},
        {PRINT_PLP, "plp"},
        {PRINT_LPRNG, "lprng"},
+#ifdef HAVE_CUPS
        {PRINT_CUPS, "cups"},
+#endif
+#ifdef HAVE_IPRINT
        {PRINT_IPRINT, "iprint"},
+#endif
        {PRINT_LPRNT, "nt"},
        {PRINT_LPROS2, "os2"},
 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
index 1e418258d4924845573f1584afa4785f18bbb2f1..2c77691373dae15caefb37a3bc28db29af03bbe2 100644 (file)
@@ -408,7 +408,6 @@ static void init_printer_values(struct loadparm_service *pService)
 
                case PRINT_CUPS:
                case PRINT_IPRINT:
-#ifdef HAVE_CUPS
                        /* set the lpq command to contain the destination printer
                           name only.  This is used by cups_queue_get() */
                        string_set(&pService->szLpqcommand, "%p");
@@ -418,15 +417,6 @@ static void init_printer_values(struct loadparm_service *pService)
                        string_set(&pService->szLpresumecommand, "");
                        string_set(&pService->szQueuepausecommand, "");
                        string_set(&pService->szQueueresumecommand, "");
-#else
-                       string_set(&pService->szLpqcommand, "lpq -P'%p'");
-                       string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
-                       string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
-                       string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
-                       string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
-                       string_set(&pService->szQueuepausecommand, "disable '%p'");
-                       string_set(&pService->szQueueresumecommand, "enable '%p'");
-#endif /* HAVE_CUPS */
                        break;
 
                case PRINT_SYSV:
@@ -5284,11 +5274,7 @@ const char *lp_printcapname(void)
                return Globals.szPrintcapname;
 
        if (sDefault.iPrinting == PRINT_CUPS) {
-#ifdef HAVE_CUPS
                return "cups";
-#else
-               return "lpstat";
-#endif
        }
 
        if (sDefault.iPrinting == PRINT_BSD)
index 105f1c5746ec23d5be9107fb21baf87ca80fc693..a9793ab4cd764e4fb59a2638778d15341a2d0881 100644 (file)
@@ -333,13 +333,11 @@ static void do_per_share_checks(int s)
                        "%s. Map system can only work if force create mode "
                        "excludes octal 010 (S_IXGRP).\n", lp_servicename(talloc_tos(), s));
        }
-#ifdef HAVE_CUPS
        if (lp_printing(s) == PRINT_CUPS && *(lp_printcommand(talloc_tos(), s)) != '\0') {
                 fprintf(stderr,"Warning: Service %s defines a print command, but \
 rameter is ignored when using CUPS libraries.\n",
                           lp_servicename(talloc_tos(), s) );
        }
-#endif
 }
 
  int main(int argc, const char *argv[])