diff --git a/cups-lspp.patch b/cups-lspp.patch
index 87ef0be..1755626 100644
--- a/cups-lspp.patch
+++ b/cups-lspp.patch
@@ -1,7 +1,7 @@
diff -up cups-1.3.8/config.h.in.lspp cups-1.3.8/config.h.in
---- cups-1.3.8/config.h.in.lspp 2008-01-07 18:26:57.000000000 +0000
-+++ cups-1.3.8/config.h.in 2008-07-28 16:37:51.000000000 +0100
-@@ -530,6 +530,13 @@
+--- cups-1.3.8/config.h.in.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/config.h.in 2008-09-10 16:18:26.000000000 +0100
+@@ -544,6 +544,13 @@
#undef HAVE_REMOVEFILE
@@ -16,8 +16,8 @@ diff -up cups-1.3.8/config.h.in.lspp cups-1.3.8/config.h.in
/*
diff -up /dev/null cups-1.3.8/config-scripts/cups-lspp.m4
---- /dev/null 2008-07-28 15:45:57.127000670 +0100
-+++ cups-1.3.8/config-scripts/cups-lspp.m4 2008-07-28 16:37:51.000000000 +0100
+--- /dev/null 2008-09-10 08:56:32.430063181 +0100
++++ cups-1.3.8/config-scripts/cups-lspp.m4 2008-09-10 16:18:26.000000000 +0100
@@ -0,0 +1,36 @@
+dnl
+dnl LSPP code for the Common UNIX Printing System (CUPS).
@@ -57,7 +57,7 @@ diff -up /dev/null cups-1.3.8/config-scripts/cups-lspp.m4
+fi
diff -up cups-1.3.8/configure.in.lspp cups-1.3.8/configure.in
--- cups-1.3.8/configure.in.lspp 2007-07-25 00:47:12.000000000 +0100
-+++ cups-1.3.8/configure.in 2008-07-28 16:37:51.000000000 +0100
++++ cups-1.3.8/configure.in 2008-09-10 16:18:26.000000000 +0100
@@ -42,6 +42,8 @@ sinclude(config-scripts/cups-pap.m4)
sinclude(config-scripts/cups-pdf.m4)
sinclude(config-scripts/cups-scripting.m4)
@@ -68,9 +68,9 @@ diff -up cups-1.3.8/configure.in.lspp cups-1.3.8/configure.in
UNINSTALL_LANGUAGES=""
LANGFILES=""
diff -up cups-1.3.8/configure.lspp cups-1.3.8/configure
---- cups-1.3.8/configure.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/configure 2008-07-28 16:37:51.000000000 +0100
-@@ -806,6 +806,8 @@ PHP
+--- cups-1.3.8/configure.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/configure 2008-09-10 16:18:43.000000000 +0100
+@@ -807,6 +807,8 @@ PHP
PHPCONFIG
PHPDIR
PYTHON
@@ -79,7 +79,7 @@ diff -up cups-1.3.8/configure.lspp cups-1.3.8/configure
INSTALL_LANGUAGES
UNINSTALL_LANGUAGES
LIBOBJS
-@@ -1429,6 +1431,7 @@ Optional Features:
+@@ -1430,6 +1432,7 @@ Optional Features:
enable UseNetworkDefault by default, default=auto
--enable-raw-printing enable raw printing by default, default=auto
--enable-pdftops build pdftops filter, default=auto
@@ -87,22 +87,7 @@ diff -up cups-1.3.8/configure.lspp cups-1.3.8/configure
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
-@@ -9680,10 +9683,10 @@ case "$uname" in
- ;;
- Linux* | GNU*)
- # Linux and GNU Hurd
-- MAN1EXT=1.gz
-- MAN5EXT=5.gz
-- MAN7EXT=7.gz
-- MAN8EXT=8.gz
-+ MAN1EXT=1
-+ MAN5EXT=5
-+ MAN7EXT=7
-+ MAN8EXT=8
- MAN8DIR=8
- ;;
- *)
-@@ -18452,6 +18455,412 @@ fi
+@@ -18555,6 +18558,412 @@ fi
@@ -515,35 +500,34 @@ diff -up cups-1.3.8/configure.lspp cups-1.3.8/configure
INSTALL_LANGUAGES=""
UNINSTALL_LANGUAGES=""
LANGFILES=""
-@@ -19345,8 +19754,8 @@ PHP!$PHP$ac_delim
+@@ -19449,7 +19858,7 @@ PHP!$PHP$ac_delim
PHPCONFIG!$PHPCONFIG$ac_delim
PHPDIR!$PHPDIR$ac_delim
PYTHON!$PYTHON$ac_delim
-INSTALL_LANGUAGES!$INSTALL_LANGUAGES$ac_delim
--UNINSTALL_LANGUAGES!$UNINSTALL_LANGUAGES$ac_delim
+LIBAUDIT!$LIBAUDIT$ac_delim
-+LIBSELINUX!$LIBSELINUX$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
-@@ -19388,11 +19797,13 @@ _ACEOF
+@@ -19491,12 +19900,14 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
++LIBSELINUX!$LIBSELINUX$ac_delim
+INSTALL_LANGUAGES!$INSTALL_LANGUAGES$ac_delim
-+UNINSTALL_LANGUAGES!$UNINSTALL_LANGUAGES$ac_delim
+ UNINSTALL_LANGUAGES!$UNINSTALL_LANGUAGES$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
-- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 2; then
-+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then
+- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then
++ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 5; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff -up cups-1.3.8/cups/cups.h.lspp cups-1.3.8/cups/cups.h
---- cups-1.3.8/cups/cups.h.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/cups/cups.h 2008-07-28 16:37:51.000000000 +0100
+--- cups-1.3.8/cups/cups.h.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/cups/cups.h 2008-09-10 16:18:26.000000000 +0100
@@ -15,6 +15,9 @@
* This file is subject to the Apple OS-Developed Software exception.
*/
@@ -569,7 +553,7 @@ diff -up cups-1.3.8/cups/cups.h.lspp cups-1.3.8/cups/cups.h
*/
diff -up cups-1.3.8/data/Makefile.lspp cups-1.3.8/data/Makefile
--- cups-1.3.8/data/Makefile.lspp 2007-10-10 23:00:43.000000000 +0100
-+++ cups-1.3.8/data/Makefile 2008-07-28 16:37:51.000000000 +0100
++++ cups-1.3.8/data/Makefile 2008-09-10 16:18:26.000000000 +0100
@@ -25,7 +25,10 @@ BANNERS = \
secret \
standard \
@@ -583,8 +567,8 @@ diff -up cups-1.3.8/data/Makefile.lspp cups-1.3.8/data/Makefile
CHARMAPS = \
euc-cn.txt \
diff -up /dev/null cups-1.3.8/data/mls
---- /dev/null 2008-07-28 15:45:57.127000670 +0100
-+++ cups-1.3.8/data/mls 2008-07-28 16:37:51.000000000 +0100
+--- /dev/null 2008-09-10 08:56:32.430063181 +0100
++++ cups-1.3.8/data/mls 2008-09-10 16:18:26.000000000 +0100
@@ -0,0 +1,261 @@
+%!PS-Adobe-3.0
+%%BoundingBox: 0 0 612 792
@@ -848,8 +832,8 @@ diff -up /dev/null cups-1.3.8/data/mls
+%
+%%EOF
diff -up /dev/null cups-1.3.8/data/selinux
---- /dev/null 2008-07-28 15:45:57.127000670 +0100
-+++ cups-1.3.8/data/selinux 2008-07-28 16:37:51.000000000 +0100
+--- /dev/null 2008-09-10 08:56:32.430063181 +0100
++++ cups-1.3.8/data/selinux 2008-09-10 16:18:26.000000000 +0100
@@ -0,0 +1,261 @@
+%!PS-Adobe-3.0
+%%BoundingBox: 0 0 612 792
@@ -1113,8 +1097,8 @@ diff -up /dev/null cups-1.3.8/data/selinux
+%
+%%EOF
diff -up /dev/null cups-1.3.8/data/te
---- /dev/null 2008-07-28 15:45:57.127000670 +0100
-+++ cups-1.3.8/data/te 2008-07-28 16:37:51.000000000 +0100
+--- /dev/null 2008-09-10 08:56:32.430063181 +0100
++++ cups-1.3.8/data/te 2008-09-10 16:18:26.000000000 +0100
@@ -0,0 +1,261 @@
+%!PS-Adobe-3.0
+%%BoundingBox: 0 0 612 792
@@ -1379,7 +1363,7 @@ diff -up /dev/null cups-1.3.8/data/te
+%%EOF
diff -up cups-1.3.8/filter/common.c.lspp cups-1.3.8/filter/common.c
--- cups-1.3.8/filter/common.c.lspp 2008-07-11 23:48:49.000000000 +0100
-+++ cups-1.3.8/filter/common.c 2008-07-28 16:37:51.000000000 +0100
++++ cups-1.3.8/filter/common.c 2008-09-10 16:18:26.000000000 +0100
@@ -30,6 +30,12 @@
* Include necessary headers...
*/
@@ -1550,7 +1534,7 @@ diff -up cups-1.3.8/filter/common.c.lspp cups-1.3.8/filter/common.c
/*
diff -up cups-1.3.8/Makedefs.in.lspp cups-1.3.8/Makedefs.in
--- cups-1.3.8/Makedefs.in.lspp 2008-01-22 22:37:21.000000000 +0000
-+++ cups-1.3.8/Makedefs.in 2008-07-28 16:37:51.000000000 +0100
++++ cups-1.3.8/Makedefs.in 2008-09-10 16:18:26.000000000 +0100
@@ -134,7 +134,7 @@ LIBCUPSORDER = @LIBCUPSORDER@
LIBCUPSIMAGEORDER = @LIBCUPSIMAGEORDER@
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
@@ -1561,9 +1545,9 @@ diff -up cups-1.3.8/Makedefs.in.lspp cups-1.3.8/Makedefs.in
OPTIONS =
PAMLIBS = @PAMLIBS@
diff -up cups-1.3.8/scheduler/client.c.lspp cups-1.3.8/scheduler/client.c
---- cups-1.3.8/scheduler/client.c.lspp 2008-07-11 23:48:49.000000000 +0100
-+++ cups-1.3.8/scheduler/client.c 2008-07-28 16:37:51.000000000 +0100
-@@ -39,12 +39,14 @@
+--- cups-1.3.8/scheduler/client.c.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/scheduler/client.c 2008-09-10 16:18:26.000000000 +0100
+@@ -40,12 +40,14 @@
* pipe_command() - Pipe the output of a command to the remote client.
* write_file() - Send a file via HTTP.
* write_pipe() - Flag that data is available on the CGI pipe.
@@ -1578,7 +1562,7 @@ diff -up cups-1.3.8/scheduler/client.c.lspp cups-1.3.8/scheduler/client.c
#include
#include "cupsd.h"
-@@ -76,6 +78,12 @@ extern const char *cssmErrorString(int e
+@@ -77,6 +79,12 @@ extern const char *cssmErrorString(int e
# include
#endif /* HAVE_GNUTLS */
@@ -1591,7 +1575,7 @@ diff -up cups-1.3.8/scheduler/client.c.lspp cups-1.3.8/scheduler/client.c
/*
* Local functions...
-@@ -349,6 +357,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
+@@ -351,6 +359,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
}
}
@@ -1649,7 +1633,7 @@ diff -up cups-1.3.8/scheduler/client.c.lspp cups-1.3.8/scheduler/client.c
#ifdef AF_INET6
if (con->http.hostaddr->addr.sa_family == AF_INET6)
cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAcceptClient: %d from %s:%d (IPv6)",
-@@ -731,6 +790,13 @@ cupsdReadClient(cupsd_client_t *con) /*
+@@ -733,6 +792,13 @@ cupsdReadClient(cupsd_client_t *con) /*
mime_type_t *type; /* MIME type of file */
cupsd_printer_t *p; /* Printer */
static unsigned request_id = 0; /* Request ID for temp files */
@@ -1663,7 +1647,7 @@ diff -up cups-1.3.8/scheduler/client.c.lspp cups-1.3.8/scheduler/client.c
status = HTTP_CONTINUE;
-@@ -2016,6 +2082,67 @@ cupsdReadClient(cupsd_client_t *con) /*
+@@ -2017,6 +2083,67 @@ cupsdReadClient(cupsd_client_t *con) /*
fchmod(con->file, 0640);
fchown(con->file, RunUser, Group);
fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC);
@@ -1731,7 +1715,7 @@ diff -up cups-1.3.8/scheduler/client.c.lspp cups-1.3.8/scheduler/client.c
}
if (con->http.state != HTTP_POST_SEND)
-@@ -4255,6 +4382,50 @@ make_certificate(cupsd_client_t *con) /*
+@@ -4288,6 +4415,50 @@ make_certificate(cupsd_client_t *con) /*
#endif /* HAVE_SSL */
@@ -1784,7 +1768,7 @@ diff -up cups-1.3.8/scheduler/client.c.lspp cups-1.3.8/scheduler/client.c
*/
diff -up cups-1.3.8/scheduler/client.h.lspp cups-1.3.8/scheduler/client.h
--- cups-1.3.8/scheduler/client.h.lspp 2007-10-22 19:52:13.000000000 +0100
-+++ cups-1.3.8/scheduler/client.h 2008-07-28 16:37:51.000000000 +0100
++++ cups-1.3.8/scheduler/client.h 2008-09-10 16:18:26.000000000 +0100
@@ -17,6 +17,13 @@
# include
#endif /* HAVE_AUTHORIZATION_H */
@@ -1821,9 +1805,9 @@ diff -up cups-1.3.8/scheduler/client.h.lspp cups-1.3.8/scheduler/client.h
/*
diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
---- cups-1.3.8/scheduler/conf.c.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/scheduler/conf.c 2008-07-28 16:37:51.000000000 +0100
-@@ -26,6 +26,7 @@
+--- cups-1.3.8/scheduler/conf.c.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/scheduler/conf.c 2008-09-10 16:18:26.000000000 +0100
+@@ -27,6 +27,7 @@
* read_configuration() - Read a configuration file.
* read_location() - Read a definition.
* read_policy() - Read a definition.
@@ -1831,7 +1815,7 @@ diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
*/
/*
-@@ -47,6 +48,9 @@
+@@ -48,6 +49,9 @@
# define INADDR_NONE 0xffffffff
#endif /* !INADDR_NONE */
@@ -1841,7 +1825,7 @@ diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
/*
* Configuration variable structure...
-@@ -160,6 +164,10 @@ static const cupsd_var_t variables[] =
+@@ -161,6 +165,10 @@ static const cupsd_var_t variables[] =
# if defined(HAVE_LIBSSL) || defined(HAVE_GNUTLS)
{ "ServerKey", &ServerKey, CUPSD_VARTYPE_PATHNAME },
# endif /* HAVE_LIBSSL || HAVE_GNUTLS */
@@ -1852,7 +1836,7 @@ diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
#endif /* HAVE_SSL */
{ "ServerName", &ServerName, CUPSD_VARTYPE_STRING },
{ "ServerRoot", &ServerRoot, CUPSD_VARTYPE_PATHNAME },
-@@ -350,6 +358,9 @@ cupsdReadConfiguration(void)
+@@ -352,6 +360,9 @@ cupsdReadConfiguration(void)
*old_requestroot; /* Old RequestRoot */
const char *tmpdir; /* TMPDIR environment variable */
struct stat tmpinfo; /* Temporary directory info */
@@ -1862,7 +1846,7 @@ diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
/*
-@@ -611,6 +622,25 @@ cupsdReadConfiguration(void)
+@@ -614,6 +625,25 @@ cupsdReadConfiguration(void)
RunUser = getuid();
@@ -1888,7 +1872,7 @@ diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
/*
* See if the ServerName is an IP address...
*/
-@@ -889,11 +919,23 @@ cupsdReadConfiguration(void)
+@@ -896,11 +926,23 @@ cupsdReadConfiguration(void)
if (MaxActiveJobs > (MaxFDs / 3))
MaxActiveJobs = MaxFDs / 3;
@@ -1913,8 +1897,8 @@ diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
/*
* Update the MaxClientsPerHost value, as needed...
-@@ -3360,6 +3402,18 @@ read_policy(cups_file_t *fp, /* I - Con
- return (0);
+@@ -3299,6 +3341,18 @@ read_location(cups_file_t *fp, /* I - C
+ return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
}
+#ifdef WITH_LSPP
@@ -1931,11 +1915,11 @@ diff -up cups-1.3.8/scheduler/conf.c.lspp cups-1.3.8/scheduler/conf.c
+
/*
- * End of "$Id: conf.c 7648 2008-06-16 17:41:11Z mike $".
+ * 'read_policy()' - Read a definition.
diff -up cups-1.3.8/scheduler/conf.h.lspp cups-1.3.8/scheduler/conf.h
---- cups-1.3.8/scheduler/conf.h.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/scheduler/conf.h 2008-07-28 16:37:51.000000000 +0100
-@@ -193,6 +193,12 @@ VAR char *ServerKey VALUE(NULL);
+--- cups-1.3.8/scheduler/conf.h.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/scheduler/conf.h 2008-09-10 16:18:26.000000000 +0100
+@@ -208,6 +208,12 @@ VAR char *ServerKey VALUE(NULL);
/* Server key file */
# endif /* HAVE_LIBSSL || HAVE_GNUTLS */
#endif /* HAVE_SSL */
@@ -1948,7 +1932,7 @@ diff -up cups-1.3.8/scheduler/conf.h.lspp cups-1.3.8/scheduler/conf.h
#ifdef HAVE_LAUNCHD
VAR int LaunchdTimeout VALUE(DEFAULT_TIMEOUT);
-@@ -211,6 +217,9 @@ VAR char *SystemGroupAuthKey VALUE(NULL
+@@ -226,6 +232,9 @@ VAR char *SystemGroupAuthKey VALUE(NULL
/* System group auth key */
#endif /* HAVE_AUTHORIZATION_H */
@@ -1959,8 +1943,8 @@ diff -up cups-1.3.8/scheduler/conf.h.lspp cups-1.3.8/scheduler/conf.h
/*
* Prototypes...
diff -up cups-1.3.8/scheduler/ipp.c.lspp cups-1.3.8/scheduler/ipp.c
---- cups-1.3.8/scheduler/ipp.c.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/scheduler/ipp.c 2008-07-28 16:39:08.000000000 +0100
+--- cups-1.3.8/scheduler/ipp.c.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/scheduler/ipp.c 2008-09-10 16:18:26.000000000 +0100
@@ -36,6 +36,7 @@
* cancel_all_jobs() - Cancel all print jobs.
* cancel_job() - Cancel a print job.
@@ -2553,8 +2537,8 @@ diff -up cups-1.3.8/scheduler/ipp.c.lspp cups-1.3.8/scheduler/ipp.c
* Check the username against the owner...
*/
diff -up cups-1.3.8/scheduler/job.c.lspp cups-1.3.8/scheduler/job.c
---- cups-1.3.8/scheduler/job.c.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/scheduler/job.c 2008-07-28 16:37:51.000000000 +0100
+--- cups-1.3.8/scheduler/job.c.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/scheduler/job.c 2008-09-10 16:18:26.000000000 +0100
@@ -60,6 +60,9 @@
* update_job_attrs() - Update the job-printer-* attributes.
*/
@@ -2913,7 +2897,7 @@ diff -up cups-1.3.8/scheduler/job.c.lspp cups-1.3.8/scheduler/job.c
if ((attr = ippFindAttribute(job->attrs, "job-sheets",
diff -up cups-1.3.8/scheduler/job.h.lspp cups-1.3.8/scheduler/job.h
--- cups-1.3.8/scheduler/job.h.lspp 2008-01-16 22:20:33.000000000 +0000
-+++ cups-1.3.8/scheduler/job.h 2008-07-28 16:37:51.000000000 +0100
++++ cups-1.3.8/scheduler/job.h 2008-09-10 16:18:26.000000000 +0100
@@ -13,6 +13,13 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@@ -2940,8 +2924,8 @@ diff -up cups-1.3.8/scheduler/job.h.lspp cups-1.3.8/scheduler/job.h
diff -up cups-1.3.8/scheduler/main.c.lspp cups-1.3.8/scheduler/main.c
---- cups-1.3.8/scheduler/main.c.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/scheduler/main.c 2008-07-28 16:37:51.000000000 +0100
+--- cups-1.3.8/scheduler/main.c.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/scheduler/main.c 2008-09-10 16:18:26.000000000 +0100
@@ -35,6 +35,8 @@
* usage() - Show scheduler usage.
*/
@@ -3010,8 +2994,8 @@ diff -up cups-1.3.8/scheduler/main.c.lspp cups-1.3.8/scheduler/main.c
}
diff -up cups-1.3.8/scheduler/printers.c.lspp cups-1.3.8/scheduler/printers.c
---- cups-1.3.8/scheduler/printers.c.lspp 2008-07-28 16:37:51.000000000 +0100
-+++ cups-1.3.8/scheduler/printers.c 2008-07-28 16:37:51.000000000 +0100
+--- cups-1.3.8/scheduler/printers.c.lspp 2008-09-10 16:18:26.000000000 +0100
++++ cups-1.3.8/scheduler/printers.c 2008-09-10 16:18:26.000000000 +0100
@@ -51,6 +51,8 @@
* printing desktop tools.
*/
diff --git a/cups-str2536.patch b/cups-str2536.patch
new file mode 100644
index 0000000..e6e33a7
--- /dev/null
+++ b/cups-str2536.patch
@@ -0,0 +1,810 @@
+diff -up cups-1.3.8/config.h.in.str2536 cups-1.3.8/config.h.in
+--- cups-1.3.8/config.h.in.str2536 2008-09-10 16:16:44.000000000 +0100
++++ cups-1.3.8/config.h.in 2008-09-10 16:16:44.000000000 +0100
+@@ -43,6 +43,13 @@
+
+
+ /*
++ * Default fatal error settings...
++ */
++
++#define CUPS_DEFAULT_FATAL_ERRORS "config"
++
++
++/*
+ * Default browsing settings...
+ */
+
+diff -up cups-1.3.8/config-scripts/cups-defaults.m4.str2536 cups-1.3.8/config-scripts/cups-defaults.m4
+--- cups-1.3.8/config-scripts/cups-defaults.m4.str2536 2008-04-14 19:10:27.000000000 +0100
++++ cups-1.3.8/config-scripts/cups-defaults.m4 2008-09-10 16:16:44.000000000 +0100
+@@ -43,6 +43,14 @@ AC_ARG_WITH(log_file_perm, [ --with-log
+ AC_SUBST(CUPS_LOG_FILE_PERM)
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_FILE_PERM, 0$CUPS_LOG_FILE_PERM)
+
++dnl Default FatalErrors
++AC_ARG_WITH(fatal_errors, [ --with-fatal-errors set default FatalErrors value, default=config],
++ CUPS_FATAL_ERRORS="$withval",
++ CUPS_FATAL_ERRORS="config")
++AC_SUBST(CUPS_FATAL_ERRORS)
++AC_DEFINE_UNQUOTED(CUPS_DEFAULT_FATAL_ERRORS, "$CUPS_FATAL_ERRORS")
++
++
+ dnl Default Browsing
+ AC_ARG_ENABLE(browsing, [ --enable-browsing enable Browsing by default, default=yes])
+ if test "x$enable_browsing" = xno; then
+diff -up cups-1.3.8/configure.str2536 cups-1.3.8/configure
+--- cups-1.3.8/configure.str2536 2008-09-10 16:16:44.000000000 +0100
++++ cups-1.3.8/configure 2008-09-10 16:18:16.000000000 +0100
+@@ -782,6 +782,7 @@ LAUNCHDLIBS
+ LANGUAGES
+ CUPS_CONFIG_FILE_PERM
+ CUPS_LOG_FILE_PERM
++CUPS_FATAL_ERRORS
+ CUPS_BROWSING
+ CUPS_BROWSE_LOCAL_PROTOCOLS
+ CUPS_BROWSE_REMOTE_PROTOCOLS
+@@ -1471,6 +1472,7 @@ Optional Packages:
+ --with-languages set installed languages, default=all
+ --with-config-file-perm set default ConfigFilePerm value, default=0640
+ --with-log-file-perm set default LogFilePerm value, default=0644
++ --with-fatal-errors set default FatalErrors value, default=config
+ --with-local-protocols set default BrowseLocalProtocols, default="CUPS"
+ --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"
+ --with-cups-user set default user for CUPS
+@@ -9680,10 +9682,10 @@ case "$uname" in
+ ;;
+ Linux* | GNU*)
+ # Linux and GNU Hurd
+- MAN1EXT=1.gz
+- MAN5EXT=5.gz
+- MAN7EXT=7.gz
+- MAN8EXT=8.gz
++ MAN1EXT=1
++ MAN5EXT=5
++ MAN7EXT=7
++ MAN8EXT=8
+ MAN8DIR=8
+ ;;
+ *)
+@@ -17624,6 +17626,21 @@ cat >>confdefs.h <<_ACEOF
+ _ACEOF
+
+
++
++# Check whether --with-fatal_errors was given.
++if test "${with_fatal_errors+set}" = set; then
++ withval=$with_fatal_errors; CUPS_FATAL_ERRORS="$withval"
++else
++ CUPS_FATAL_ERRORS="config"
++fi
++
++
++cat >>confdefs.h <<_ACEOF
++#define CUPS_DEFAULT_FATAL_ERRORS "$CUPS_FATAL_ERRORS"
++_ACEOF
++
++
++
+ # Check whether --enable-browsing was given.
+ if test "${enable_browsing+set}" = set; then
+ enableval=$enable_browsing;
+@@ -19407,6 +19424,7 @@ LAUNCHDLIBS!$LAUNCHDLIBS$ac_delim
+ LANGUAGES!$LANGUAGES$ac_delim
+ CUPS_CONFIG_FILE_PERM!$CUPS_CONFIG_FILE_PERM$ac_delim
+ CUPS_LOG_FILE_PERM!$CUPS_LOG_FILE_PERM$ac_delim
++CUPS_FATAL_ERRORS!$CUPS_FATAL_ERRORS$ac_delim
+ CUPS_BROWSING!$CUPS_BROWSING$ac_delim
+ CUPS_BROWSE_LOCAL_PROTOCOLS!$CUPS_BROWSE_LOCAL_PROTOCOLS$ac_delim
+ CUPS_BROWSE_REMOTE_PROTOCOLS!$CUPS_BROWSE_REMOTE_PROTOCOLS$ac_delim
+@@ -19432,7 +19450,6 @@ PHPCONFIG!$PHPCONFIG$ac_delim
+ PHPDIR!$PHPDIR$ac_delim
+ PYTHON!$PYTHON$ac_delim
+ INSTALL_LANGUAGES!$INSTALL_LANGUAGES$ac_delim
+-UNINSTALL_LANGUAGES!$UNINSTALL_LANGUAGES$ac_delim
+ _ACEOF
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+@@ -19474,11 +19491,12 @@ _ACEOF
+ ac_delim='%!_!# '
+ for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
++UNINSTALL_LANGUAGES!$UNINSTALL_LANGUAGES$ac_delim
+ LIBOBJS!$LIBOBJS$ac_delim
+ LTLIBOBJS!$LTLIBOBJS$ac_delim
+ _ACEOF
+
+- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 2; then
++ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then
+ break
+ elif $ac_last_try; then
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+diff -up cups-1.3.8/doc/help/ref-cupsd-conf.html.in.str2536 cups-1.3.8/doc/help/ref-cupsd-conf.html.in
+--- cups-1.3.8/doc/help/ref-cupsd-conf.html.in.str2536 2008-06-17 19:27:16.000000000 +0100
++++ cups-1.3.8/doc/help/ref-cupsd-conf.html.in 2008-09-10 16:16:44.000000000 +0100
+@@ -1115,6 +1115,57 @@ printer.
+
+
+
++
++
++
++Examples
++
++
++FatalErrors none
++FatalErrors all
++FatalErrors browse
++FatalErrors config
++FatalErrors listen
++FatalErrors log
++FatalErrors permissions
++FatalErrors all -permissions
++FatalErrors config permissions log
++
++
++Description
++
++The FatalErrors
directive determines whether certain kinds of
++errors are fatal. The following kinds of errors are currently recognized:
++
++
++
++ none
- No errors are fatal
++
++ all
- All of the errors below are fatal
++
++ browse
- Browsing initialization errors are fatal,
++ for example failed binding to the CUPS browse port or failed connections
++ to LDAP servers
++
++ config
- Configuration file syntax errors are
++ fatal
++
++ listen
- Listen or Port errors are fatal, except for
++ IPv6 failures on the loopback or "any" addresses
++
++ log
- Log file creation or write errors are fatal
++
++ permissions
- Bad startup file permissions are
++ fatal, for example shared SSL certificate and key files with world-
++ read permissions
++
++
++
++Multiple errors can be listed, and the form "-kind" can be used with
++all
to remove specific kinds of errors. The default setting is
++@CUPS_FATAL_ERRORS@
.
++
++
+
+
+ Examples
+diff -up cups-1.3.8/man/cupsd.conf.man.in.str2536 cups-1.3.8/man/cupsd.conf.man.in
+--- cups-1.3.8/man/cupsd.conf.man.in.str2536 2008-06-16 18:41:11.000000000 +0100
++++ cups-1.3.8/man/cupsd.conf.man.in 2008-09-10 16:16:44.000000000 +0100
+@@ -275,6 +275,15 @@ ErrorLog syslog
+ .br
+ Specifies the error log filename.
+ .TP 5
++FatalErrors none
++.TP 5
++FatalErrors all -kind [... -kind]
++.TP 5
++FatalErrors kind [... kind]
++.br
++Specifies which errors are fatal, causing the scheduler to exit. "Kind" is
++"browse", "config", "listen", "log", or "permissions".
++.TP 5
+ FileDevice Yes
+ .TP 5
+ FileDevice No
+diff -up cups-1.3.8/scheduler/conf.c.str2536 cups-1.3.8/scheduler/conf.c
+--- cups-1.3.8/scheduler/conf.c.str2536 2008-09-10 16:16:44.000000000 +0100
++++ cups-1.3.8/scheduler/conf.c 2008-09-10 16:17:52.000000000 +0100
+@@ -21,6 +21,7 @@
+ * get_addr_and_mask() - Get an IP address and netmask.
+ * parse_aaa() - Parse authentication, authorization, and
+ * access control lines.
++ * parse_fatal_errors() - Parse FatalErrors values in a string.
+ * parse_groups() - Parse system group names in a string.
+ * parse_protocols() - Parse browse protocols in a string.
+ * read_configuration() - Read a configuration file.
+@@ -192,6 +193,7 @@ static int get_addr_and_mask(const char
+ unsigned *mask);
+ static int parse_aaa(cupsd_location_t *loc, char *line,
+ char *value, int linenum);
++static int parse_fatal_errors(const char *s);
+ static int parse_groups(const char *s);
+ static int parse_protocols(const char *s);
+ static int read_configuration(cups_file_t *fp);
+@@ -512,6 +514,7 @@ cupsdReadConfiguration(void)
+ */
+
+ ConfigFilePerm = CUPS_DEFAULT_CONFIG_FILE_PERM;
++ FatalErrors = parse_fatal_errors(CUPS_DEFAULT_FATAL_ERRORS);
+ DefaultAuthType = CUPSD_AUTH_BASIC;
+ #ifdef HAVE_SSL
+ DefaultEncryption = HTTP_ENCRYPT_REQUIRED;
+@@ -782,30 +785,31 @@ cupsdReadConfiguration(void)
+
+ snprintf(temp, sizeof(temp), "%s/rss", CacheDir);
+
+- if (cupsdCheckPermissions(RequestRoot, NULL, 0710, RunUser,
+- Group, 1, 1) < 0 ||
+- cupsdCheckPermissions(CacheDir, NULL, 0775, RunUser,
+- Group, 1, 1) < 0 ||
+- cupsdCheckPermissions(temp, NULL, 0775, RunUser,
+- Group, 1, 1) < 0 ||
+- cupsdCheckPermissions(StateDir, NULL, 0755, RunUser,
+- Group, 1, 1) < 0 ||
+- cupsdCheckPermissions(StateDir, "certs", RunUser ? 0711 : 0511, User,
+- SystemGroupIDs[0], 1, 1) < 0 ||
+- cupsdCheckPermissions(ServerRoot, NULL, 0755, RunUser,
+- Group, 1, 0) < 0 ||
+- cupsdCheckPermissions(ServerRoot, "ppd", 0755, RunUser,
+- Group, 1, 1) < 0 ||
+- cupsdCheckPermissions(ServerRoot, "ssl", 0700, RunUser,
+- Group, 1, 0) < 0 ||
+- cupsdCheckPermissions(ServerRoot, "cupsd.conf", ConfigFilePerm, RunUser,
+- Group, 0, 0) < 0 ||
+- cupsdCheckPermissions(ServerRoot, "classes.conf", 0600, RunUser,
+- Group, 0, 0) < 0 ||
+- cupsdCheckPermissions(ServerRoot, "printers.conf", 0600, RunUser,
+- Group, 0, 0) < 0 ||
+- cupsdCheckPermissions(ServerRoot, "passwd.md5", 0600, User,
+- Group, 0, 0) < 0)
++ if ((cupsdCheckPermissions(RequestRoot, NULL, 0710, RunUser,
++ Group, 1, 1) < 0 ||
++ cupsdCheckPermissions(CacheDir, NULL, 0775, RunUser,
++ Group, 1, 1) < 0 ||
++ cupsdCheckPermissions(temp, NULL, 0775, RunUser,
++ Group, 1, 1) < 0 ||
++ cupsdCheckPermissions(StateDir, NULL, 0755, RunUser,
++ Group, 1, 1) < 0 ||
++ cupsdCheckPermissions(StateDir, "certs", RunUser ? 0711 : 0511, User,
++ SystemGroupIDs[0], 1, 1) < 0 ||
++ cupsdCheckPermissions(ServerRoot, NULL, 0755, RunUser,
++ Group, 1, 0) < 0 ||
++ cupsdCheckPermissions(ServerRoot, "ppd", 0755, RunUser,
++ Group, 1, 1) < 0 ||
++ cupsdCheckPermissions(ServerRoot, "ssl", 0700, RunUser,
++ Group, 1, 0) < 0 ||
++ cupsdCheckPermissions(ServerRoot, "cupsd.conf", ConfigFilePerm, RunUser,
++ Group, 0, 0) < 0 ||
++ cupsdCheckPermissions(ServerRoot, "classes.conf", 0600, RunUser,
++ Group, 0, 0) < 0 ||
++ cupsdCheckPermissions(ServerRoot, "printers.conf", 0600, RunUser,
++ Group, 0, 0) < 0 ||
++ cupsdCheckPermissions(ServerRoot, "passwd.md5", 0600, User,
++ Group, 0, 0) < 0) &&
++ FatalErrors & CUPSD_FATAL_PERMISSIONS)
+ return (0);
+
+ /*
+@@ -855,7 +859,8 @@ cupsdReadConfiguration(void)
+ * is under the spool directory or does not exist...
+ */
+
+- if (cupsdCheckPermissions(TempDir, NULL, 01770, RunUser, Group, 1, 1) < 0)
++ if (cupsdCheckPermissions(TempDir, NULL, 01770, RunUser, Group, 1, 1) < 0 &&
++ (FatalErrors & CUPSD_FATAL_PERMISSIONS))
+ return (0);
+ }
+
+@@ -872,8 +877,10 @@ cupsdReadConfiguration(void)
+ if (MaxClients > (MaxFDs / 3) || MaxClients <= 0)
+ {
+ if (MaxClients > 0)
+- cupsdLogMessage(CUPSD_LOG_INFO, "MaxClients limited to 1/3 (%d) of the file descriptor limit (%d)...",
+- MaxFDs / 3, MaxFDs);
++ cupsdLogMessage(CUPSD_LOG_INFO,
++ "MaxClients limited to 1/3 (%d) of the file descriptor "
++ "limit (%d)...",
++ MaxFDs / 3, MaxFDs);
+
+ MaxClients = MaxFDs / 3;
+ }
+@@ -1115,7 +1122,8 @@ cupsdReadConfiguration(void)
+ {
+ cupsdLogMessage(CUPSD_LOG_EMERG,
+ "Unable to load MIME database from \'%s\'!", ServerRoot);
+- exit(errno);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+
+ cupsdLogMessage(CUPSD_LOG_INFO,
+@@ -1912,6 +1920,86 @@ parse_aaa(cupsd_location_t *loc, /* I -
+
+
+ /*
++ * 'parse_fatal_errors()' - Parse FatalErrors values in a string.
++ */
++
++static int /* O - FatalErrors bits */
++parse_fatal_errors(const char *s) /* I - FatalErrors string */
++{
++ int fatal; /* FatalErrors bits */
++ char value[1024], /* Value string */
++ *valstart, /* Pointer into value */
++ *valend; /* End of value */
++
++
++ /*
++ * Empty FatalErrors line yields NULL pointer...
++ */
++
++ if (!s)
++ return (CUPSD_FATAL_NONE);
++
++ /*
++ * Loop through the value string,...
++ */
++
++ strlcpy(value, s, sizeof(value));
++
++ fatal = CUPSD_FATAL_NONE;
++
++ for (valstart = value; *valstart;)
++ {
++ /*
++ * Get the current space/comma-delimited kind name...
++ */
++
++ for (valend = valstart; *valend; valend ++)
++ if (isspace(*valend & 255) || *valend == ',')
++ break;
++
++ if (*valend)
++ *valend++ = '\0';
++
++ /*
++ * Add the error to the bitmask...
++ */
++
++ if (!strcasecmp(valstart, "all"))
++ fatal = CUPSD_FATAL_ALL;
++ else if (!strcasecmp(valstart, "browse"))
++ fatal |= CUPSD_FATAL_BROWSE;
++ else if (!strcasecmp(valstart, "-browse"))
++ fatal &= ~CUPSD_FATAL_BROWSE;
++ else if (!strcasecmp(valstart, "config"))
++ fatal |= CUPSD_FATAL_CONFIG;
++ else if (!strcasecmp(valstart, "-config"))
++ fatal &= ~CUPSD_FATAL_CONFIG;
++ else if (!strcasecmp(valstart, "listen"))
++ fatal |= CUPSD_FATAL_LISTEN;
++ else if (!strcasecmp(valstart, "-listen"))
++ fatal &= ~CUPSD_FATAL_LISTEN;
++ else if (!strcasecmp(valstart, "log"))
++ fatal |= CUPSD_FATAL_LOG;
++ else if (!strcasecmp(valstart, "-log"))
++ fatal &= ~CUPSD_FATAL_LOG;
++ else if (!strcasecmp(valstart, "permissions"))
++ fatal |= CUPSD_FATAL_PERMISSIONS;
++ else if (!strcasecmp(valstart, "-permissions"))
++ fatal &= ~CUPSD_FATAL_PERMISSIONS;
++ else if (strcasecmp(valstart, "none"))
++ cupsdLogMessage(CUPSD_LOG_ERROR,
++ "Unknown FatalErrors kind \"%s\" ignored!", valstart);
++
++ for (valstart = valend; *valstart; valstart ++)
++ if (!isspace(*valstart & 255) || *valstart != ',')
++ break;
++ }
++
++ return (fatal);
++}
++
++
++/*
+ * 'parse_groups()' - Parse system group names in a string.
+ */
+
+@@ -2740,7 +2828,8 @@ read_configuration(cups_file_t *fp) /* I
+ cupsdLogMessage(CUPSD_LOG_WARN,
+ "Unknown default authorization type %s on line %d.",
+ value, linenum);
+- return (0);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+ }
+ #ifdef HAVE_SSL
+@@ -2761,7 +2850,8 @@ read_configuration(cups_file_t *fp) /* I
+ cupsdLogMessage(CUPSD_LOG_WARN,
+ "Unknown default encryption %s on line %d.",
+ value, linenum);
+- return (0);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+ }
+ #endif /* HAVE_SSL */
+@@ -3148,7 +3238,8 @@ read_location(cups_file_t *fp, /* I - C
+ if (!value)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum);
+- return (0);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+
+ if ((loc = cupsdCopyLocation(&parent)) == NULL)
+@@ -3196,7 +3287,8 @@ read_location(cups_file_t *fp, /* I - C
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Unknown Location directive %s on line %d.",
+ line, linenum);
+- return (0);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+ }
+
+@@ -3204,7 +3296,7 @@ read_location(cups_file_t *fp, /* I - C
+ "Unexpected end-of-file at line %d while reading location!",
+ linenum);
+
+- return (0);
++ return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
+ }
+
+
+@@ -3262,7 +3354,8 @@ read_policy(cups_file_t *fp, /* I - Con
+ if (!value)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum);
+- return (0);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+
+ /*
+@@ -3336,7 +3429,8 @@ read_policy(cups_file_t *fp, /* I - Con
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Missing directive before %s on line %d.",
+ line, linenum);
+- return (0);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+ else if (!parse_aaa(op, line, value, linenum))
+ {
+@@ -3349,7 +3443,8 @@ read_policy(cups_file_t *fp, /* I - Con
+ "Unknown Policy directive %s on line %d.",
+ line, linenum);
+
+- return (0);
++ if (FatalErrors & CUPSD_FATAL_CONFIG)
++ return (0);
+ }
+ }
+
+@@ -3357,7 +3452,7 @@ read_policy(cups_file_t *fp, /* I - Con
+ "Unexpected end-of-file at line %d while reading policy \"%s\"!",
+ linenum, policy);
+
+- return (0);
++ return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
+ }
+
+
+diff -up cups-1.3.8/scheduler/conf.h.str2536 cups-1.3.8/scheduler/conf.h
+--- cups-1.3.8/scheduler/conf.h.str2536 2008-09-10 16:16:44.000000000 +0100
++++ cups-1.3.8/scheduler/conf.h 2008-09-10 16:16:44.000000000 +0100
+@@ -38,6 +38,19 @@ typedef enum
+
+
+ /*
++ * FatalErrors flags...
++ */
++
++#define CUPSD_FATAL_NONE 0 /* No errors are fatal */
++#define CUPSD_FATAL_BROWSE 1 /* Browse bind errors are fatal */
++#define CUPSD_FATAL_CONFIG 2 /* Config file syntax errors are fatal */
++#define CUPSD_FATAL_LISTEN 4 /* Listen/Port bind errors are fatal */
++#define CUPSD_FATAL_LOG 8 /* Log file errors are fatal */
++#define CUPSD_FATAL_PERMISSIONS 16 /* File permission errors are fatal */
++#define CUPSD_FATAL_ALL ~0 /* All errors are fatal */
++
++
++/*
+ * Printcap formats...
+ */
+
+@@ -124,6 +137,8 @@ VAR int ClassifyOverride VALUE(0),
+ /* Allow overrides? */
+ ConfigFilePerm VALUE(0640),
+ /* Permissions for config files */
++ FatalErrors VALUE(CUPSD_FATAL_CONFIG),
++ /* Which errors are fatal? */
+ LogFilePerm VALUE(0644),
+ /* Permissions for log files */
+ LogLevel VALUE(CUPSD_LOG_ERROR),
+diff -up cups-1.3.8/scheduler/dirsvc.c.str2536 cups-1.3.8/scheduler/dirsvc.c
+--- cups-1.3.8/scheduler/dirsvc.c.str2536 2008-07-18 21:30:23.000000000 +0100
++++ cups-1.3.8/scheduler/dirsvc.c 2008-09-10 16:16:44.000000000 +0100
+@@ -954,9 +954,14 @@ cupsdStartBrowsing(void)
+ strerror(errno));
+ BrowseLocalProtocols &= ~BROWSE_CUPS;
+ BrowseRemoteProtocols &= ~BROWSE_CUPS;
+- return;
++
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
+ }
++ }
+
++ if (BrowseSocket >= 0)
++ {
+ /*
+ * Bind the socket to browse port...
+ */
+@@ -981,50 +986,60 @@ cupsdStartBrowsing(void)
+ BrowseSocket = -1;
+ BrowseLocalProtocols &= ~BROWSE_CUPS;
+ BrowseRemoteProtocols &= ~BROWSE_CUPS;
+- return;
++
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
+ }
+ }
+
+- /*
+- * Set the "broadcast" flag...
+- */
+-
+- val = 1;
+- if (setsockopt(BrowseSocket, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
++ if (BrowseSocket >= 0)
+ {
+- cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to set broadcast mode - %s.",
+- strerror(errno));
++ /*
++ * Set the "broadcast" flag...
++ */
++
++ val = 1;
++ if (setsockopt(BrowseSocket, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
++ {
++ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to set broadcast mode - %s.",
++ strerror(errno));
+
+ #ifdef WIN32
+- closesocket(BrowseSocket);
++ closesocket(BrowseSocket);
+ #else
+- close(BrowseSocket);
++ close(BrowseSocket);
+ #endif /* WIN32 */
+
+- BrowseSocket = -1;
+- BrowseLocalProtocols &= ~BROWSE_CUPS;
+- BrowseRemoteProtocols &= ~BROWSE_CUPS;
+- return;
+- }
++ BrowseSocket = -1;
++ BrowseLocalProtocols &= ~BROWSE_CUPS;
++ BrowseRemoteProtocols &= ~BROWSE_CUPS;
+
+- /*
+- * Close the socket on exec...
+- */
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
++ }
++ }
+
+- fcntl(BrowseSocket, F_SETFD, fcntl(BrowseSocket, F_GETFD) | FD_CLOEXEC);
++ if (BrowseSocket >= 0)
++ {
++ /*
++ * Close the socket on exec...
++ */
+
+- /*
+- * Finally, add the socket to the input selection set as needed...
+- */
++ fcntl(BrowseSocket, F_SETFD, fcntl(BrowseSocket, F_GETFD) | FD_CLOEXEC);
+
+- if (BrowseRemoteProtocols & BROWSE_CUPS)
+- {
+ /*
+- * We only listen if we want remote printers...
++ * Finally, add the socket to the input selection set as needed...
+ */
+
+- cupsdAddSelect(BrowseSocket, (cupsd_selfunc_t)update_cups_browse,
+- NULL, NULL);
++ if (BrowseRemoteProtocols & BROWSE_CUPS)
++ {
++ /*
++ * We only listen if we want remote printers...
++ */
++
++ cupsdAddSelect(BrowseSocket, (cupsd_selfunc_t)update_cups_browse,
++ NULL, NULL);
++ }
+ }
+ }
+ else
+@@ -1043,6 +1058,10 @@ cupsdStartBrowsing(void)
+ "Unable to open an SLP handle; disabling SLP browsing!");
+ BrowseLocalProtocols &= ~BROWSE_SLP;
+ BrowseRemoteProtocols &= ~BROWSE_SLP;
++ BrowseSLPHandle = NULL;
++
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
+ }
+
+ BrowseSLPRefresh = 0;
+@@ -1060,6 +1079,9 @@ cupsdStartBrowsing(void)
+ "Need to set BrowseLDAPDN to use LDAP browsing!");
+ BrowseLocalProtocols &= ~BROWSE_LDAP;
+ BrowseRemoteProtocols &= ~BROWSE_LDAP;
++
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
+ }
+ else
+ {
+@@ -1105,6 +1127,9 @@ cupsdStartBrowsing(void)
+ "Unable to initialize LDAP; disabling LDAP browsing!");
+ BrowseLocalProtocols &= ~BROWSE_LDAP;
+ BrowseRemoteProtocols &= ~BROWSE_LDAP;
++
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
+ }
+ else if (ldap_set_option(BrowseLDAPHandle, LDAP_OPT_PROTOCOL_VERSION,
+ (const void *)&version) != LDAP_SUCCESS)
+@@ -1116,6 +1141,9 @@ cupsdStartBrowsing(void)
+ "disabling LDAP browsing!");
+ BrowseLocalProtocols &= ~BROWSE_LDAP;
+ BrowseRemoteProtocols &= ~BROWSE_LDAP;
++
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
+ }
+ else
+ {
+@@ -1134,6 +1162,9 @@ cupsdStartBrowsing(void)
+ ldap_unbind_ext(BrowseLDAPHandle, NULL, NULL);
+ BrowseLocalProtocols &= ~BROWSE_LDAP;
+ BrowseRemoteProtocols &= ~BROWSE_LDAP;
++
++ if (FatalErrors & CUPSD_FATAL_BROWSE)
++ cupsdEndProcess(getpid(), 0);
+ }
+ }
+ }
+diff -up cups-1.3.8/scheduler/listen.c.str2536 cups-1.3.8/scheduler/listen.c
+--- cups-1.3.8/scheduler/listen.c.str2536 2007-08-13 18:20:14.000000000 +0100
++++ cups-1.3.8/scheduler/listen.c 2008-09-10 16:16:44.000000000 +0100
+@@ -150,10 +150,15 @@ cupsdStartListening(void)
+ httpAddrFreeList(ServerAddrs);
+
+ if ((ServerAddrs = httpAddrGetList(ServerName, AF_UNSPEC, NULL)) == NULL)
++ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Unable to find IP address for server name \"%s\"!\n",
+ ServerName);
+
++ if (FatalErrors & CUPSD_FATAL_LISTEN)
++ cupsdEndProcess(getpid(), 0);
++ }
++
+ /*
+ * Setup socket listeners...
+ */
+@@ -194,6 +199,20 @@ cupsdStartListening(void)
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Unable to open listen socket for address %s:%d - %s.",
+ s, p, strerror(errno));
++
++#ifdef AF_INET6
++ /*
++ * IPv6 is often disabled while DNS returns IPv6 addresses...
++ */
++
++ if (lis->address.addr.sa_family != AF_INET6 &&
++ (FatalErrors & CUPSD_FATAL_LISTEN))
++ cupsdEndProcess(getpid(), 0);
++#else
++ if (FatalErrors & CUPSD_FATAL_LISTEN)
++ cupsdEndProcess(getpid(), 0);
++#endif /* AF_INET6 */
++
+ continue;
+ }
+
+@@ -278,6 +297,10 @@ cupsdStartListening(void)
+ s, p, strerror(errno));
+ close(lis->fd);
+ lis->fd = -1;
++
++ if (FatalErrors & CUPSD_FATAL_LISTEN)
++ cupsdEndProcess(getpid(), 0);
++
+ continue;
+ }
+
+@@ -290,7 +313,14 @@ cupsdStartListening(void)
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "Unable to listen for clients on address %s:%d - %s.",
+ s, p, strerror(errno));
+- exit(errno);
++
++ close(lis->fd);
++ lis->fd = -1;
++
++ if (FatalErrors & CUPSD_FATAL_LISTEN)
++ cupsdEndProcess(getpid(), 0);
++
++ continue;
+ }
+ }
+
+@@ -339,11 +369,8 @@ cupsdStartListening(void)
+ "No Listen or Port lines were found to allow access via "
+ "localhost!");
+
+- /*
+- * Commit suicide...
+- */
+-
+- cupsdEndProcess(getpid(), 0);
++ if (FatalErrors & (CUPSD_FATAL_CONFIG | CUPSD_FATAL_LISTEN))
++ cupsdEndProcess(getpid(), 0);
+ }
+
+ /*
+diff -up cups-1.3.8/scheduler/log.c.str2536 cups-1.3.8/scheduler/log.c
+--- cups-1.3.8/scheduler/log.c.str2536 2008-09-10 16:16:44.000000000 +0100
++++ cups-1.3.8/scheduler/log.c 2008-09-10 16:16:44.000000000 +0100
+@@ -546,7 +546,20 @@ check_log_file(cups_file_t **lf, /* IO -
+
+ if (!strncmp(filename, CUPS_LOGDIR, strlen(CUPS_LOGDIR)))
+ {
+- cupsdCheckPermissions(CUPS_LOGDIR, NULL, 0755, RunUser, Group, 1, -1);
++ /*
++ * Try updating the permissions of the containing log directory, using
++ * the log file permissions as a basis...
++ */
++
++ int log_dir_perm = 0300 | LogFilePerm;
++ /* LogFilePerm + owner write/search */
++ if (log_dir_perm & 0040)
++ log_dir_perm |= 0010; /* Add group search */
++ if (log_dir_perm & 0004)
++ log_dir_perm |= 0001; /* Add other search */
++
++ cupsdCheckPermissions(CUPS_LOGDIR, NULL, log_dir_perm, RunUser, Group,
++ 1, -1);
+
+ *lf = cupsFileOpen(filename, "a");
+ }
+@@ -555,6 +568,10 @@ check_log_file(cups_file_t **lf, /* IO -
+ {
+ syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
+ strerror(errno));
++
++ if (FatalErrors & CUPSD_FATAL_LOG)
++ cupsdEndProcess(getpid(), 0);
++
+ return (0);
+ }
+ }
+@@ -622,6 +639,9 @@ check_log_file(cups_file_t **lf, /* IO -
+ syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
+ strerror(errno));
+
++ if (FatalErrors & CUPSD_FATAL_LOG)
++ cupsdEndProcess(getpid(), 0);
++
+ return (0);
+ }
+
diff --git a/cups.spec b/cups.spec
index 4787227..2bf0471 100644
--- a/cups.spec
+++ b/cups.spec
@@ -50,6 +50,7 @@ Patch22: cups-getnameddest.patch
Patch23: cups-str2892.patch
Patch24: cups-str2101.patch
Patch25: cups-res_init.patch
+Patch26: cups-str2536.patch
Patch100: cups-lspp.patch
Epoch: 1
Url: http://www.cups.org/
@@ -188,6 +189,7 @@ module.
%patch23 -p1 -b .str2892
%patch24 -p1 -b .str2101
%patch25 -p1 -b .res_init
+%patch26 -p1 -b .str2536
%if %lspp
%patch100 -p1 -b .lspp
@@ -479,6 +481,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/php/modules/*.so
%changelog
+* Wed Sep 10 2008 Tim Waugh
+- Backported patch for FatalErrors configuration directive
+ (bug #314941, STR #2536).
+
* Thu Sep 4 2008 Tim Waugh
- Use php-cgi for executing PHP scripts (bug #460898).