svn commit: samba r3874 - in trunk/source/param: .

vlendec at samba.org vlendec at samba.org
Fri Nov 19 12:12:11 GMT 2004


Author: vlendec
Date: 2004-11-19 12:12:10 +0000 (Fri, 19 Nov 2004)
New Revision: 3874

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3874

Log:
The semantics of the parameter 'printcap name' are a bit tricky. I had seen
the effect that I could not list printers with smbclient -L. I have cups
libraries but no running cups server, so remove_stale_printers() removed all
my printer definitions from the share list. So I said 'printing = bsd' but it
still would not work.

This happened because init_globals() would initialize Globals.szPrintcapname
to "cups", and the explicit 'printing = bsd' did not reset it. 'printing=bsd'
can't reset it, as this might overwrite an explicit setting. Thus I separated
the lp_printcapname into a function of its own, looking at
Globals.szPrintcapname and subsequently at sDefault.iPrinting.

Please revisit, there are just too many cases to cover.

Thanks,

Volker

Modified:
   trunk/source/param/loadparm.c


Changeset:
Modified: trunk/source/param/loadparm.c
===================================================================
--- trunk/source/param/loadparm.c	2004-11-19 12:11:13 UTC (rev 3873)
+++ trunk/source/param/loadparm.c	2004-11-19 12:12:10 UTC (rev 3874)
@@ -1232,8 +1232,6 @@
 			string_set(&pService->szLpresumecommand, "");
 			string_set(&pService->szQueuepausecommand, "");
 			string_set(&pService->szQueueresumecommand, "");
-
-	                string_set(&Globals.szPrintcapname, "cups");
 #else
 			string_set(&pService->szLpqcommand, "/usr/bin/lpstat -o '%p'");
 			string_set(&pService->szLprmcommand, "/usr/bin/cancel '%p-%j'");
@@ -1242,7 +1240,6 @@
 			string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
 			string_set(&pService->szQueuepausecommand, "/usr/bin/disable '%p'");
 			string_set(&pService->szQueueresumecommand, "/usr/bin/enable '%p'");
-			string_set(&Globals.szPrintcapname, "lpstat");
 #endif /* HAVE_CUPS */
 			break;
 
@@ -1354,7 +1351,6 @@
 	string_set(&Globals.szWorkgroup, lp_workgroup());
 	
 	string_set(&Globals.szPasswdProgram, "");
-	string_set(&Globals.szPrintcapname, PRINTCAP_NAME);
 	string_set(&Globals.szPidDir, dyn_PIDDIR);
 	string_set(&Globals.szLockDir, dyn_LOCKDIR);
 	string_set(&Globals.szSocketAddress, "0.0.0.0");
@@ -1637,7 +1633,6 @@
 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
-FN_GLOBAL_STRING(lp_printcapname, &Globals.szPrintcapname)
 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
@@ -4302,6 +4297,26 @@
 	return maxjobs;
 }
 
+const char *lp_printcapname(void)
+{
+	if ((Globals.szPrintcapname != NULL) &&
+	    (Globals.szPrintcapname[0] != '\0'))
+		return Globals.szPrintcapname;
+
+	if (sDefault.iPrinting == PRINT_CUPS) {
+#ifdef HAVE_CUPS
+		return "cups";
+#else
+		return "lpstat";
+#endif
+	}
+
+	if (sDefault.iPrinting == PRINT_BSD)
+		return "/etc/printcap";
+
+	return PRINTCAP_NAME;
+}
+
 /*******************************************************************
  Ensure we don't use sendfile if server smb signing is active.
 ********************************************************************/



More information about the samba-cvs mailing list