1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

r3873: 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
(This used to be commit 3cdde7071b6bf83ad05046745ad2a5fa353995bf)
This commit is contained in:
Volker Lendecke 2004-11-19 12:11:13 +00:00 committed by Gerald (Jerry) Carter
parent b917dd4bfa
commit d0bb5f9505

View File

@ -1226,8 +1226,6 @@ static void init_printer_values(service *pService)
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'");
@ -1236,7 +1234,6 @@ static void init_printer_values(service *pService)
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;
@ -1346,7 +1343,6 @@ static void init_globals(void)
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");
@ -1626,7 +1622,6 @@ FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
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)
@ -4283,6 +4278,26 @@ int lp_maxprintjobs(int snum)
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.
********************************************************************/