diff options
author | Andrew Tridgell <tridge@samba.org> | 1997-12-03 05:08:07 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1997-12-03 05:08:07 +0000 |
commit | 7a668a7641cd747455b7a9854dbc208a3e4bc7ef (patch) | |
tree | 337d3570bd8160d93ee74c2e3ff139be0db9e4d9 /source3/printing/pcap.c | |
parent | 02bc90ea442f5d115df17de0ebd0bbfdf214c1a5 (diff) | |
download | samba-7a668a7641cd747455b7a9854dbc208a3e4bc7ef.tar.gz samba-7a668a7641cd747455b7a9854dbc208a3e4bc7ef.tar.xz samba-7a668a7641cd747455b7a9854dbc208a3e4bc7ef.zip |
applied a patch from Norm Jacobs to allow "printcap name = lpstat"
to use lpstat to obtain the printer list on systemV systems.
I've now made this the default on all SYSV systems.
Jeremy, you were a little worried about the security of this patch. I
believe it's OK as the user has no control over the options given to
popen() and the pipe is only open for reading.
(This used to be commit 6a83de0ae954bb18d3f15382f2b0b3259fedff09)
Diffstat (limited to 'source3/printing/pcap.c')
-rw-r--r-- | source3/printing/pcap.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index 65195ab1af6..ff0a2b54772 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -7,6 +7,8 @@ Re-working by Martin Kiff, 1994 Re-written again by Andrew Tridgell + + Modified for SVID support by Norm Jacobs, 1997 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,6 +51,9 @@ * Opening a pipe for "lpc status" and reading that would probably * be pretty effective. Code to do this already exists in the freely * distributable PCNFS server code. + * + * Modified to call SVID/XPG4 support if printcap name is set to "lpstat" + * in smb.conf under Solaris. */ #include "includes.h" @@ -255,10 +260,17 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) DEBUG(0,( "No printcap file name configured!\n")); return(False); } + +#ifdef SYSV + if (strequal(psz, "lpstat")) + return (sysv_printername_ok(pszPrintername)); +#endif + #ifdef AIX if (strlocate(psz,"/qconfig") != NULL) return(ScanQconfig(psz,pszPrintername)); #endif + if ((pfile = fopen(psz, "r")) == NULL) { DEBUG(0,( "Unable to open printcap file %s for read!\n", psz)); @@ -292,7 +304,6 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) } } - fclose(pfile); return(False); } @@ -317,6 +328,13 @@ void pcap_printer_fn(void (*fn)()) return; } +#ifdef SYSV + if (strequal(psz, "lpstat")) { + sysv_printer_fn(fn); + return; + } +#endif + #ifdef AIX if (strlocate(psz,"/qconfig") != NULL) { @@ -324,6 +342,7 @@ void pcap_printer_fn(void (*fn)()) return; } #endif + if ((pfile = fopen(psz, "r")) == NULL) { DEBUG(0,( "Unable to open printcap file %s for read!\n", psz)); |