summaryrefslogtreecommitdiffstats
path: root/source/printing/pcap.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-12-03 05:08:07 +0000
committerAndrew Tridgell <tridge@samba.org>1997-12-03 05:08:07 +0000
commit6a83de0ae954bb18d3f15382f2b0b3259fedff09 (patch)
treeb8631057724bc01baf26f7bb92fe80f35ed70f1d /source/printing/pcap.c
parentaf57bc05fe0f248aaef329358c583abcffe1657c (diff)
downloadsamba-6a83de0ae954bb18d3f15382f2b0b3259fedff09.tar.gz
samba-6a83de0ae954bb18d3f15382f2b0b3259fedff09.tar.xz
samba-6a83de0ae954bb18d3f15382f2b0b3259fedff09.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.
Diffstat (limited to 'source/printing/pcap.c')
-rw-r--r--source/printing/pcap.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/printing/pcap.c b/source/printing/pcap.c
index 65195ab1af6..ff0a2b54772 100644
--- a/source/printing/pcap.c
+++ b/source/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));