summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-02-15 19:36:47 +0000
committerJeremy Allison <jra@samba.org>2000-02-15 19:36:47 +0000
commit3cf31a194f5721b67b1255e3f168d4bc87d433fc (patch)
treef9e3ef842e2bad4d7fb0142f685962e125176b23 /source3/printing
parent8688933c7feb87179c178a30e4fc42970fe1da8f (diff)
downloadsamba-3cf31a194f5721b67b1255e3f168d4bc87d433fc.tar.gz
samba-3cf31a194f5721b67b1255e3f168d4bc87d433fc.tar.bz2
samba-3cf31a194f5721b67b1255e3f168d4bc87d433fc.zip
Added replacement functions sys_popen and sys_pclose. These are based
on the glibc source code and are safer than the traditional popen as they don't use a shell to exec the requested command. Now we have these functions they can be tightened up (environment etc.) as required to make a safe popen. It should now be safe to add the environement variable loading code to loadparm.c Jeremy. (This used to be commit b52e92b09d4ca3b66e534f520468dee27065d048)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/print_svid.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c
index ffc059f9f9..9891e158a2 100644
--- a/source3/printing/print_svid.c
+++ b/source3/printing/print_svid.c
@@ -47,10 +47,9 @@ static printer_t *printers = NULL;
static void populate_printers(void)
{
-#ifdef HAVE_POPEN
FILE *fp;
- if ((fp = popen("/usr/bin/lpstat -v", "r")) != NULL) {
+ if ((fp = sys_popen("/usr/bin/lpstat -v", "r")) != NULL) {
char buf[BUFSIZ];
while (fgets(buf, sizeof (buf), fp) != NULL) {
@@ -88,13 +87,10 @@ static void populate_printers(void)
DEBUG(0,("populate_printers: malloc fail for ptmp\n"));
}
}
- pclose(fp);
+ sys_pclose(fp);
} else {
DEBUG(0,( "Unable to run lpstat!\n"));
}
-#else
- DEBUG(0,( "No popen() defined: Unable to run lpstat!\n"));
-#endif
}