diff -up cups-1.3.10/config.h.in.str2536 cups-1.3.10/config.h.in --- cups-1.3.10/config.h.in.str2536 2009-03-12 21:34:21.000000000 +0000 +++ cups-1.3.10/config.h.in 2009-04-20 17:27:31.000000000 +0100 @@ -43,6 +43,13 @@ /* + * Default fatal error settings... + */ + +#define CUPS_DEFAULT_FATAL_ERRORS "config" + + +/* * Default browsing settings... */ diff -up cups-1.3.10/config-scripts/cups-defaults.m4.str2536 cups-1.3.10/config-scripts/cups-defaults.m4 --- cups-1.3.10/config-scripts/cups-defaults.m4.str2536 2008-04-14 19:10:27.000000000 +0100 +++ cups-1.3.10/config-scripts/cups-defaults.m4 2009-04-20 17:27:31.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.10/configure.str2536 cups-1.3.10/configure --- cups-1.3.10/configure.str2536 2009-04-20 17:27:31.000000000 +0100 +++ cups-1.3.10/configure 2009-04-20 17:27:56.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 @@ -1474,6 +1475,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 @@ -17929,6 +17931,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; @@ -20067,6 +20084,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 @@ -20095,7 +20113,7 @@ PHPDIR!$PHPDIR$ac_delim PYTHON!$PYTHON$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 98; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff -up cups-1.3.10/doc/help/ref-cupsd-conf.html.in.str2536 cups-1.3.10/doc/help/ref-cupsd-conf.html.in --- cups-1.3.10/doc/help/ref-cupsd-conf.html.in.str2536 2009-04-16 20:32:04.000000000 +0100 +++ cups-1.3.10/doc/help/ref-cupsd-conf.html.in 2009-04-20 17:27:31.000000000 +0100 @@ -1115,6 +1115,57 @@ printer.

+ +

CUPS 1.4FatalErrors

+ +

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:

+ + + +

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@.

+ +

CUPS 1.1.18FileDevice

Examples

diff -up cups-1.3.10/man/cupsd.conf.man.in.str2536 cups-1.3.10/man/cupsd.conf.man.in --- cups-1.3.10/man/cupsd.conf.man.in.str2536 2009-04-16 20:32:04.000000000 +0100 +++ cups-1.3.10/man/cupsd.conf.man.in 2009-04-20 17:27:31.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.10/scheduler/conf.c.str2536 cups-1.3.10/scheduler/conf.c --- cups-1.3.10/scheduler/conf.c.str2536 2009-04-20 17:27:31.000000000 +0100 +++ cups-1.3.10/scheduler/conf.c 2009-04-20 17:27:31.000000000 +0100 @@ -23,6 +23,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. @@ -197,6 +198,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); @@ -540,6 +542,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; @@ -861,30 +864,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); /* @@ -934,7 +938,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); } @@ -951,8 +956,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; } @@ -1194,7 +1201,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, @@ -2037,6 +2045,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. */ @@ -2868,7 +2956,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 @@ -2889,7 +2978,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 */ @@ -3278,7 +3368,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) @@ -3326,7 +3417,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); } } @@ -3334,7 +3426,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); } @@ -3392,7 +3484,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); } /* @@ -3466,7 +3559,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)) { @@ -3479,7 +3573,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); } } @@ -3487,7 +3582,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.10/scheduler/conf.h.str2536 cups-1.3.10/scheduler/conf.h --- cups-1.3.10/scheduler/conf.h.str2536 2009-04-20 17:27:31.000000000 +0100 +++ cups-1.3.10/scheduler/conf.h 2009-04-20 17:27:31.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... */ @@ -140,6 +153,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.10/scheduler/dirsvc.c.str2536 cups-1.3.10/scheduler/dirsvc.c --- cups-1.3.10/scheduler/dirsvc.c.str2536 2009-02-12 22:23:31.000000000 +0000 +++ cups-1.3.10/scheduler/dirsvc.c 2009-04-20 17:27:31.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.10/scheduler/listen.c.str2536 cups-1.3.10/scheduler/listen.c --- cups-1.3.10/scheduler/listen.c.str2536 2009-01-15 19:12:15.000000000 +0000 +++ cups-1.3.10/scheduler/listen.c 2009-04-20 17:27:31.000000000 +0100 @@ -182,6 +182,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; } @@ -266,6 +280,10 @@ cupsdStartListening(void) s, p, strerror(errno)); close(lis->fd); lis->fd = -1; + + if (FatalErrors & CUPSD_FATAL_LISTEN) + cupsdEndProcess(getpid(), 0); + continue; } @@ -278,7 +296,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; } } @@ -327,11 +352,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.10/scheduler/log.c.str2536 cups-1.3.10/scheduler/log.c --- cups-1.3.10/scheduler/log.c.str2536 2009-04-20 17:27:31.000000000 +0100 +++ cups-1.3.10/scheduler/log.c 2009-04-20 17:27:31.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); }