diff options
author | Volker Lendecke <vlendec@samba.org> | 2004-11-19 12:11:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:22 -0500 |
commit | d0bb5f9505b1bd90913d159f91c7aa9c5654bf73 (patch) | |
tree | d4d06fd8b398a54c303c14858e7a4feeedce358a /source3 | |
parent | b917dd4bfa9082e3447ee8e38e52c402d602793e (diff) | |
download | samba-d0bb5f9505b1bd90913d159f91c7aa9c5654bf73.tar.gz samba-d0bb5f9505b1bd90913d159f91c7aa9c5654bf73.tar.bz2 samba-d0bb5f9505b1bd90913d159f91c7aa9c5654bf73.zip |
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)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/param/loadparm.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 65e9e6b57f..b8e5f88efc 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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. ********************************************************************/ |