]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Merge changes from CUPS 1.4svn-r7932.
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 10 Sep 2008 22:30:50 +0000 (22:30 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 10 Sep 2008 22:30:50 +0000 (22:30 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@957 a1ca3aef-8c08-0410-bb20-df032aa958be

40 files changed:
CHANGES-1.3.txt
CHANGES.txt
Makefile
backend/Dependencies
backend/Makefile
config-scripts/cups-defaults.m4
config-scripts/cups-network.m4
config-scripts/cups-scripting.m4
config.h.in
cups/Dependencies
cups/globals.h
cups/http-addr.c
cups/http-addrlist.c
desktop/cups.desktop.in
doc/Makefile
doc/help/ref-cupsd-conf.html.in
locale/translate.c
man/Makefile
man/cupsaccept.man [moved from man/accept.man with 94% similarity]
man/cupsd.conf.man.in
man/lpstat.man
notifier/Dependencies
notifier/Makefile
notifier/dbus.c
packaging/cups.list.in
scheduler/client.c
scheduler/conf.c
scheduler/conf.h
scheduler/cupsd.h
scheduler/dirsvc.c
scheduler/ipp.c
scheduler/listen.c
scheduler/log.c
scheduler/main.c
scheduler/server.c
scheduler/sysman.c
scheduler/sysman.h
systemv/Makefile
systemv/accept.c
systemv/lpstat.c

index c03e5fba243a60fbe11a6be17220fb9807e4cea3..cb1f5832b3864119ec1bc23e4cd8e34a8af05427 100644 (file)
@@ -4,6 +4,13 @@ CHANGES-1.3.txt
 CHANGES IN CUPS V1.3.9
 
        - Documentation updates (STR #2904)
+       - The scheduler did not send the server-started,
+         server-restarted, or server-stopped events (STR #2927)
+       - The scheduler no longer enforces configuration file
+         permissions on symlinked files (STR #2937)
+       - CUPS now reinitializes the DNS resolver on failures
+         (STR #2920)
+       - The CUPS desktop menu item was broken (STR #2924)
        - The PPD parser was too strict about missing keyword
          values in "relaxed" mode.
        - The PostScript filter incorrectly mirrored landscape
index 789220f8f0866f1c9b9a594c7fbdc7f2d944e952..5a8431195cfd153fbb76ac4932eda631b9c10000 100644 (file)
@@ -1,8 +1,18 @@
-CHANGES.txt - 2008-09-03
+CHANGES.txt - 2008-09-10
 ------------------------
 
 CHANGES IN CUPS V1.4b1
 
+       - Renamed the accept and reject commands to cupsaccept and
+         cupsreject; the old names are still available (STR #2936)
+       - The locale/translate utility needed an update to work with
+         Google (STR #2882)
+       - The lpstat command now supports a -H option to display the
+         default server (STR #2833)
+       - The scheduler now supports a FatalErrors directive to control
+         which errors should cause the scheduler to exit (STR #2536)
+       - The scheduler now uses the php-cgi program if it is available
+         (STR #2923)
        - The scheduler now supports a DefaultPaperSize directive
          (STR #2848)
        - The scheduler now passes the job-originating-host-name
index 8cdcb4d287f0330f0e79c2cd87eadc3985a07ed1..8fe7685b9234336759b7c80cbeb664fd6c835b3f 100644 (file)
--- a/Makefile
+++ b/Makefile
 
 include Makedefs
 
+
+#
+# Don't run top-level build targets in parallel...
+#
+
+.NOTPARALLEL:
+
+
 #
 # Directories to make...
 #
index ecd5b130f679043ec36d27589e40d51a96db90cf..9051be05c3d90cf1d7ee81413977ddcefa7e3fef 100644 (file)
@@ -12,12 +12,12 @@ lpd.o: ../cups/backend.h ../cups/sidechannel.h ../cups/ppd-private.h
 lpd.o: ../cups/cups.h ../cups/ppd.h ../cups/array.h ../cups/file.h
 lpd.o: ../cups/language.h ../cups/debug.h ../cups/i18n.h ../cups/transcode.h
 lpd.o: ../cups/snmp-private.h ../cups/string.h
-mdns.o: backend-private.h ../cups/backend.h ../cups/versioning.h
-mdns.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
-mdns.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
-mdns.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
-mdns.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
-mdns.o: ../config.h ../cups/array.h
+dnssd.o: backend-private.h ../cups/backend.h ../cups/versioning.h
+dnssd.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
+dnssd.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
+dnssd.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
+dnssd.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
+dnssd.o: ../config.h ../cups/array.h
 pap.o: ../config.h ../cups/cups.h ../cups/ipp.h ../cups/http.h
 pap.o: ../cups/versioning.h ../cups/ppd.h ../cups/array.h ../cups/file.h
 pap.o: ../cups/language.h ../cups/backend.h ../cups/sidechannel.h
@@ -68,7 +68,9 @@ testsupplies.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
 testsupplies.o: ../cups/file.h ../cups/language.h ../cups/debug.h
 testsupplies.o: ../cups/i18n.h ../cups/transcode.h ../cups/snmp-private.h
 testsupplies.o: ../cups/string.h ../config.h
-usb.o: ../cups/backend.h ../cups/versioning.h ../cups/cups.h ../cups/ipp.h
-usb.o: ../cups/http.h ../cups/ppd.h ../cups/array.h ../cups/file.h
-usb.o: ../cups/language.h ../cups/string.h ../config.h ../cups/i18n.h
-usb.o: ../cups/transcode.h
+usb.o: backend-private.h ../cups/backend.h ../cups/versioning.h
+usb.o: ../cups/sidechannel.h ../cups/ppd-private.h ../cups/cups.h
+usb.o: ../cups/ipp.h ../cups/http.h ../cups/ppd.h ../cups/array.h
+usb.o: ../cups/file.h ../cups/language.h ../cups/debug.h ../cups/i18n.h
+usb.o: ../cups/transcode.h ../cups/snmp-private.h ../cups/string.h
+usb.o: ../config.h
index 79868f83bd8e6f89452ca731d6b878f6b5baf7be..11ebdbd481888e0fb8627eb83d928f51d36d08c0 100644 (file)
@@ -91,6 +91,10 @@ install-exec:
        done
        $(RM) $(SERVERBIN)/backend/http
        $(LN) ipp $(SERVERBIN)/backend/http
+       if test "x$(DNSSD_BACKEND)" != x; then \
+               $(RM) $(SERVERBIN)/backend/mdns; \
+               $(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \
+       fi
        if test "x$(SYMROOT)" != "x"; then \
                $(INSTALL_DIR) $(SYMROOT); \
                for file in $(TARGETS); do \
index bdc22ebb011a9227ec7e4a2146d115621184784f..b3ce770478cf1b57a0062c236ce2440b5259b35e 100644 (file)
@@ -39,6 +39,14 @@ AC_ARG_WITH(log_file_perm, [  --with-log-file-perm    set default LogFilePerm va
 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 LogLevel
 AC_ARG_WITH(log_level, [  --with-log-level        set default LogLevel value, default=warn],
        CUPS_LOG_LEVEL="$withval",
index f363185759c47e6f8061ca3a424f0b049da03d92..9a88aa8f033ebc84d81040d25d89f55fdf3b8667 100644 (file)
@@ -3,7 +3,7 @@ dnl "$Id: cups-network.m4 7127 2007-12-17 18:05:32Z mike $"
 dnl
 dnl   Networking stuff for the Common UNIX Printing System (CUPS).
 dnl
-dnl   Copyright 2007 by Apple Inc.
+dnl   Copyright 2007-2008 by Apple Inc.
 dnl   Copyright 1997-2005 by Easy Software Products, all rights reserved.
 dnl
 dnl   These coded instructions, statements, and computer programs are the
@@ -13,11 +13,15 @@ dnl   which should have been included with this file.  If this file is
 dnl   file is missing or damaged, see the license at "http://www.cups.org/".
 dnl
 
+AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H))
 AC_SEARCH_LIBS(socket, socket)
 AC_SEARCH_LIBS(gethostbyaddr, nsl)
 AC_SEARCH_LIBS(getifaddrs, nsl, AC_DEFINE(HAVE_GETIFADDRS))
 AC_SEARCH_LIBS(hstrerror, nsl socket resolv, AC_DEFINE(HAVE_HSTRERROR))
 AC_SEARCH_LIBS(rresvport_af, nsl, AC_DEFINE(HAVE_RRESVPORT_AF))
+AC_SEARCH_LIBS(__res_init, resolv bind, AC_DEFINE(HAVE_RES_INIT),
+       AC_SEARCH_LIBS(res_9_init, resolv bind, AC_DEFINE(HAVE_RES_INIT),
+       AC_SEARCH_LIBS(res_init, resolv bind, AC_DEFINE(HAVE_RES_INIT))))
 
 # Tru64 5.1b leaks file descriptors with these functions; disable until
 # we can come up with a test for this...
index 71a6707e94630b10f82b47ff831190cf1638afd2..f514221e239a97ab5445076c69262be9b97e9241 100644 (file)
@@ -3,7 +3,7 @@ dnl "$Id: cups-scripting.m4 6649 2007-07-11 21:46:42Z mike $"
 dnl
 dnl   Scripting configuration stuff for the Common UNIX Printing System (CUPS).
 dnl
-dnl   Copyright 2007 by Apple Inc.
+dnl   Copyright 2007-2008 by Apple Inc.
 dnl   Copyright 1997-2006 by Easy Software Products, all rights reserved.
 dnl
 dnl   These coded instructions, statements, and computer programs are the
@@ -51,8 +51,13 @@ AC_ARG_WITH(php, [  --with-php              set PHP interpreter for web interfac
        CUPS_PHP="")
 
 if test "x$CUPS_PHP" = x; then
-       AC_PATH_PROG(PHP,php)
-       CUPS_PHP="$PHP"
+       AC_PATH_PROG(PHPCGI,php-cgi)
+       if test "x$PHPCGI" = x; then
+               AC_PATH_PROG(PHP,php)
+               CUPS_PHP="$PHP"
+       else
+               CUPS_PHP="$PHPCGI"
+       fi
 fi
 
 AC_DEFINE_UNQUOTED(CUPS_PHP, "$CUPS_PHP")
index 39a8d63f3f33cb4a5598bc928be2a74c74d31218..5199ee4f381dd3a3e547bc854fb908de9f89a817 100644 (file)
 #define CUPS_DEFAULT_ACCESS_LOG_LEVEL "actions"
 
 
+/*
+ * Default fatal error settings...
+ */
+
+#define CUPS_DEFAULT_FATAL_ERRORS      "config"
+
+
 /*
  * Default browsing settings...
  */
 #undef HAVE_HSTRERROR
 
 
+/*
+ * Do we have res_init()?
+ */
+
+#undef HAVE_RES_INIT
+
+
+/*
+ * Do we have <resolv.h>
+ */
+
+#undef HAVE_RESOLV_H
+
+
 /*
  * Do we have the <sys/sockio.h> header file?
  */
index 7a32226fb15e6ea0327613126a24643e47262c01..b1336d501f6d53bf9e2faca68544c10347a9620a 100644 (file)
@@ -46,8 +46,8 @@ globals.o: i18n.h transcode.h
 http.o: http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
 http.o: ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
 http.o: i18n.h transcode.h debug.h
-http-addr.o: globals.h string.h ../config.h http-private.h http.h
-http-addr.o: versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
+http-addr.o: http-private.h ../config.h http.h versioning.h md5.h
+http-addr.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
 http-addr.o: file.h language.h i18n.h transcode.h debug.h
 http-addrlist.o: http-private.h ../config.h http.h versioning.h md5.h
 http-addrlist.o: ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
@@ -109,6 +109,8 @@ testadmin.o: adminutil.h cups.h ipp.h http.h versioning.h ppd.h array.h
 testadmin.o: file.h language.h string.h ../config.h
 testarray.o: ../cups/string.h ../config.h string.h array.h versioning.h dir.h
 testarray.o: debug.h
+testconflicts.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h
+testconflicts.o: language.h string.h ../config.h
 testcups.o: cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
 testfile.o: string.h ../config.h file.h versioning.h debug.h
 testhttp.o: http-private.h ../config.h http.h versioning.h md5.h
@@ -172,8 +174,8 @@ globals.32.o: globals.c  i18n.h transcode.h
 http.32.o: http.c  http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
 http.32.o: http.c  ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
 http.32.o: http.c  i18n.h transcode.h debug.h
-http-addr.32.o: http-addr.c  globals.h string.h ../config.h http-private.h http.h
-http-addr.32.o: http-addr.c  versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
+http-addr.32.o: http-addr.c  http-private.h ../config.h http.h versioning.h md5.h
+http-addr.32.o: http-addr.c  ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
 http-addr.32.o: http-addr.c  file.h language.h i18n.h transcode.h debug.h
 http-addrlist.32.o: http-addrlist.c  http-private.h ../config.h http.h versioning.h md5.h
 http-addrlist.32.o: http-addrlist.c  ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
@@ -235,6 +237,8 @@ testadmin.32.o: testadmin.c  adminutil.h cups.h ipp.h http.h versioning.h ppd.h
 testadmin.32.o: testadmin.c  file.h language.h string.h ../config.h
 testarray.32.o: testarray.c  ../cups/string.h ../config.h string.h array.h versioning.h dir.h
 testarray.32.o: testarray.c  debug.h
+testconflicts.32.o: testconflicts.c  cups.h ipp.h http.h versioning.h ppd.h array.h file.h
+testconflicts.32.o: testconflicts.c  language.h string.h ../config.h
 testcups.32.o: testcups.c  cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
 testfile.32.o: testfile.c  string.h ../config.h file.h versioning.h debug.h
 testhttp.32.o: testhttp.c  http-private.h ../config.h http.h versioning.h md5.h
@@ -298,8 +302,8 @@ globals.64.o: globals.c  i18n.h transcode.h
 http.64.o: http.c  http-private.h ../config.h http.h versioning.h md5.h ipp-private.h
 http.64.o: http.c  ipp.h globals.h string.h cups.h ppd.h array.h file.h language.h
 http.64.o: http.c  i18n.h transcode.h debug.h
-http-addr.64.o: http-addr.c  globals.h string.h ../config.h http-private.h http.h
-http-addr.64.o: http-addr.c  versioning.h md5.h ipp-private.h ipp.h cups.h ppd.h array.h
+http-addr.64.o: http-addr.c  http-private.h ../config.h http.h versioning.h md5.h
+http-addr.64.o: http-addr.c  ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
 http-addr.64.o: http-addr.c  file.h language.h i18n.h transcode.h debug.h
 http-addrlist.64.o: http-addrlist.c  http-private.h ../config.h http.h versioning.h md5.h
 http-addrlist.64.o: http-addrlist.c  ipp-private.h ipp.h globals.h string.h cups.h ppd.h array.h
@@ -361,6 +365,8 @@ testadmin.64.o: testadmin.c  adminutil.h cups.h ipp.h http.h versioning.h ppd.h
 testadmin.64.o: testadmin.c  file.h language.h string.h ../config.h
 testarray.64.o: testarray.c  ../cups/string.h ../config.h string.h array.h versioning.h dir.h
 testarray.64.o: testarray.c  debug.h
+testconflicts.64.o: testconflicts.c  cups.h ipp.h http.h versioning.h ppd.h array.h file.h
+testconflicts.64.o: testconflicts.c  language.h string.h ../config.h
 testcups.64.o: testcups.c  cups.h ipp.h http.h versioning.h ppd.h array.h file.h language.h
 testfile.64.o: testfile.c  string.h ../config.h file.h versioning.h debug.h
 testhttp.64.o: testhttp.c  http-private.h ../config.h http.h versioning.h md5.h
index f2ae63b972cf42d1c6800b13529ee0c1bdda7884..d58099548ba4ceae4c0f86688df1ef38854045d2 100644 (file)
@@ -81,6 +81,7 @@ typedef struct _cups_globals_s                /**** CUPS global state data ****/
 #  ifdef HAVE_GETADDRINFO
   char                 hostname[1024]; /* Hostname */
 #  endif /* HAVE_GETADDRINFO */
+  int                  need_res_init;  /* Need to reinitialize resolver? */
 
   /* ipp.c */
   ipp_uchar_t          ipp_date[11];   /* RFC-1903 date/time data */
index 0bc71f6fa711f08e172bd68cfd5a0127bef06672..55d701d64fa8e222604dce1acee28bbf071e0142 100644 (file)
  * Include necessary headers...
  */
 
+#include "http-private.h"
 #include "globals.h"
 #include "debug.h"
 #include <stdlib.h>
 #include <stddef.h>
+#ifdef HAVE_RESOLV_H
+#  include <resolv.h>
+#endif /* HAVE_RESOLV_H */
 
 
 /*
@@ -176,6 +180,10 @@ httpAddrLookup(
     char              *name,           /* I - Host name buffer */
     int               namelen)         /* I - Size of name buffer */
 {
+  _cups_globals_t      *cg = _cupsGlobals();
+                                       /* Global data */
+
+
   DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)\n",
                 addr, name, namelen));
 
@@ -193,9 +201,33 @@ httpAddrLookup(
 
 #ifdef AF_LOCAL
   if (addr->addr.sa_family == AF_LOCAL)
+  {
     strlcpy(name, addr->un.sun_path, namelen);
-  else
+    return (name);
+  }
 #endif /* AF_LOCAL */
+
+#ifdef HAVE_RES_INIT
+ /*
+  * STR #2920: Initialize resolver after failure in cups-polld
+  *
+  * If the previous lookup failed, re-initialize the resolver to prevent
+  * temporary network errors from persisting.  This *should* be handled by
+  * the resolver libraries, but apparently the glibc folks do not agree.
+  *
+  * We set a flag at the end of this function if we encounter an error that
+  * requires reinitialization of the resolver functions.  We then call
+  * res_init() if the flag is set on the next call here or in httpAddrLookup().
+  */
+
+  if (cg->need_res_init)
+  {
+    res_init();
+
+    cg->need_res_init = 0;
+  }
+#endif /* HAVE_RES_INIT */
+
 #ifdef HAVE_GETNAMEINFO
   {
    /*
@@ -206,9 +238,16 @@ httpAddrLookup(
     * do...
     */
 
-    if (getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
-                   NULL, 0, 0))
+    int error = getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
+                           NULL, 0, 0);
+
+    if (error)
+    {
+      if (error == EAI_FAIL)
+        cg->need_res_init = 1;
+
       return (httpAddrString(addr, name, namelen));
+    }
   }
 #else
   {
@@ -230,8 +269,10 @@ httpAddrLookup(
       * No hostname, so return the raw address...
       */
 
-      httpAddrString(addr, name, namelen);
-      return (NULL);
+      if (h_errno == NO_RECOVERY)
+        cg->need_res_init = 1;
+
+      return (httpAddrString(addr, name, namelen));
     }
 
     strlcpy(name, host->h_name, namelen);
index d5685312efa459f5242710948158b1ca9726f932..52b5aeca9c075304be94bac2313d51b679b0c948 100644 (file)
@@ -28,6 +28,9 @@
 #include "debug.h"
 #include <stdlib.h>
 #include <errno.h>
+#ifdef HAVE_RESOLV_H
+#  include <resolv.h>
+#endif /* HAVE_RESOLV_H */
 
 
 /*
@@ -201,6 +204,8 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
   http_addrlist_t      *first,         /* First address in list */
                        *addr,          /* Current address in list */
                        *temp;          /* New address */
+  _cups_globals_t      *cg = _cupsGlobals();
+                                       /* Global data */
 
 
 #ifdef DEBUG
@@ -217,6 +222,28 @@ httpAddrGetList(const char *hostname,      /* I - Hostname, IP address, or NULL for p
                         family == AF_INET ? "INET" : "???", service);
 #endif /* DEBUG */
 
+#ifdef HAVE_RES_INIT
+ /*
+  * STR #2920: Initialize resolver after failure in cups-polld
+  *
+  * If the previous lookup failed, re-initialize the resolver to prevent
+  * temporary network errors from persisting.  This *should* be handled by
+  * the resolver libraries, but apparently the glibc folks do not agree.
+  *
+  * We set a flag at the end of this function if we encounter an error that
+  * requires reinitialization of the resolver functions.  We then call
+  * res_init() if the flag is set on the next call here or in httpAddrLookup().
+  */
+
+  if (cg->need_res_init)
+  {
+    res_init();
+
+    cg->need_res_init = 0;
+  }
+#endif /* HAVE_RES_INIT */
+
+
  /*
   * Lookup the address the best way we can...
   */
@@ -246,6 +273,8 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
     char               ipv6[1024],     /* IPv6 address */
                        *ipv6zone;      /* Pointer to zone separator */
     int                        ipv6len;        /* Length of IPv6 address */
+    int                        error;          /* getaddrinfo() error */
+
 
    /*
     * Lookup the address as needed...
@@ -297,7 +326,7 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
       }
     }
 
-    if (!getaddrinfo(hostname, service, &hints, &results))
+    if ((error = getaddrinfo(hostname, service, &hints, &results)) == 0)
     {
      /*
       * Copy the results to our own address list structure...
@@ -343,6 +372,9 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
 
       freeaddrinfo(results);
     }
+    else if (error == EAI_FAIL)
+      cg->need_res_init = 1;
+
 #else
     if (hostname)
     {
@@ -459,6 +491,8 @@ httpAddrGetList(const char *hostname,       /* I - Hostname, IP address, or NULL for p
          addr = temp;
        }
       }
+      else if (h_errno == NO_RECOVERY)
+        cg->need_res_init = 1;
     }
 #endif /* HAVE_GETADDRINFO */
   }
index d5e2612f7969541f141b576dfc99d01578139ee6..c92a8a0af5aa43e94168d0cf48400b97b1315f89 100644 (file)
@@ -1,41 +1,33 @@
 [Desktop Entry]
-Categories=Application;System;X-Red-Hat-Base;
-Encoding=UTF-8
+Categories=System;Printing;HardwareSettings;X-Red-Hat-Base;
 Exec=@CUPS_HTMLVIEW@ http://localhost:631/
-GenericName=
 Icon=cups
-MimeType=
-Path=
 StartupNotify=false
 Terminal=false
-TerminalOptions=
 Type=Application
-X-DCOP-ServiceType=
-X-KDE-SubstituteUID=false
-X-KDE-Username=
 Name=Manage Printing
 Comment=CUPS Web Interface
-Name[de]=Druckerverwaltung
-Comment[de]=CUPS Webinterface
-Name[en_US]=Manage Printing
-Comment[en_US]=CUPS Web Interface
-Name[es]=Administrar impresión
-Comment[es]=Interfaz Web de CUPS
-Name[et]=Trükkimise haldur
-Comment[et]=CUPS-i veebiliides
-Name[fr]=Gestionnaire d'impression
-Comment[fr]=Interface Web de CUPS
-Name[he]=נהל הדפסות
-Comment[he]=ממשק דפדפן של CUPS
-Name[id]=Manajemen Pencetakan
-Comment[id]=Antarmuka Web CUPS
-Name[it]=Gestione stampa
-Comment[it]=Interfaccia web di CUPS
-Name[ja]=印刷の管理
-Comment[ja]=CUPS Web インタフェース
-Name[pl]=Zarządzanie drukowaniem
-Comment[pl]=Interfejs WWW CUPS
-Name[zh]=打印机管理
-Comment[zh]=CUPS网页界面
-Name[zh_TW]=印表管理
-Comment[zh_TW]=CUPS 網頁介面
+Name[de.UTF-8]=Druckerverwaltung
+Comment[de.UTF-8]=CUPS Webinterface
+Name[en_US.UTF-8]=Manage Printing
+Comment[en_US.UTF-8]=CUPS Web Interface
+Name[es.UTF-8]=Administrar impresión
+Comment[es.UTF-8]=Interfaz Web de CUPS
+Name[et.UTF-8]=Trükkimise haldur
+Comment[et.UTF-8]=CUPS-i veebiliides
+Name[fr.UTF-8]=Gestionnaire d'impression
+Comment[fr.UTF-8]=Interface Web de CUPS
+Name[he.UTF-8]=נהל הדפסות
+Comment[he.UTF-8]=ממשק דפדפן של CUPS
+Name[id.UTF-8]=Manajemen Pencetakan
+Comment[id.UTF-8]=Antarmuka Web CUPS
+Name[it.UTF-8]=Gestione stampa
+Comment[it.UTF-8]=Interfaccia web di CUPS
+Name[ja.UTF-8]=印刷の管理
+Comment[ja.UTF-8]=CUPS Web インタフェース
+Name[pl.UTF-8]=Zarządzanie drukowaniem
+Comment[pl.UTF-8]=Interfejs WWW CUPS
+Name[zh.UTF-8]=打印机管理
+Comment[zh.UTF-8]=CUPS网页界面
+Name[zh_TW.UTF-8]=印表管理
+Comment[zh_TW.UTF-8]=CUPS 網頁介面
index 4c461f75f9c9d4685343ea0f8b5a6d2d22bc912b..25b10104f03607d9958a4e9eeccd3604d6612827 100644 (file)
@@ -59,7 +59,7 @@ HELPFILES     =       \
                        help/glossary.html \
                        help/kerberos.html \
                        help/license.html \
-                       help/man-accept.html \
+                       help/man-cupsaccept.html \
                        help/man-backend.html \
                        help/man-cancel.html \
                        help/man-classes.conf.html \
index 9d5ca0e5ba65c6e46f0211712dcfe0b47394d1b8..1020744a71bc879c8ffa4ca511fddb71ba8f812c 100644 (file)
@@ -975,6 +975,26 @@ language localization file exists for it. The default language
 is "en" for English.</P>
 
 
+<H2 CLASS="title"><SPAN CLASS="info">CUPS 1.4</SPAN><A NAME="DefaultPaperSize">DefaultPaperSize</A></H2>
+
+<H3>Examples</H3>
+
+<PRE CLASS="command">
+DefaultPaperSize Letter
+DefaultPaperSize A4
+DefaultPaperSize Auto
+DefaultPaperSize None
+</PRE>
+
+<H3>Description</H3>
+
+<P>The <CODE>DefaultPaperSize</CODE> directive specifies the default paper
+size to use when creating new printers. The default is <CODE>Auto</CODE>
+which uses a paper size appropriate for the system default locale. A value
+of <CODE>None</CODE> tells the scheduler to not set the default paper
+size.</P>
+
+
 <H2 CLASS="title"><SPAN CLASS="info">CUPS 1.2</SPAN><A NAME="DefaultPolicy">DefaultPolicy</A></H2>
 
 <H3>Examples</H3>
@@ -1058,7 +1078,7 @@ HREF="#Limit"><CODE>Limit</CODE></A> section.</P>
 <H3>Examples</H3>
 
 <PRE CLASS="command">
-DirtyCleanInterval 60
+DirtyCleanInterval 30
 DirtyCleanInterval 0
 </PRE>
 
@@ -1066,7 +1086,7 @@ DirtyCleanInterval 0
 
 <P>The <CODE>DirtyCleanInterval</CODE> directive specifies the number of
 seconds to wait before updating configuration and state files for printers,
-classes, subscriptions, and jobs. The default is 60 seconds.</P>
+classes, subscriptions, and jobs. The default is 30 seconds.</P>
 
 
 <H2 CLASS="title"><A NAME="DocumentRoot">DocumentRoot</A></H2>
@@ -1177,6 +1197,57 @@ printer.</P>
 </UL>
 
 
+
+<H2 CLASS="title"><SPAN CLASS="info">CUPS 1.4</SPAN><A NAME="FatalErrors">FatalErrors</A></H2>
+
+<H3>Examples</H3>
+
+<PRE CLASS="command">
+FatalErrors none
+FatalErrors all
+FatalErrors browse
+FatalErrors config
+FatalErrors listen
+FatalErrors log
+FatalErrors permissions
+FatalErrors all -permissions
+FatalErrors config permissions log
+</PRE>
+
+<H3>Description</H3>
+
+<P>The <CODE>FatalErrors</CODE> directive determines whether certain kinds of
+errors are fatal. The following kinds of errors are currently recognized:</P>
+
+<UL>
+
+       <LI><CODE>none</CODE> - No errors are fatal</LI>
+
+       <LI><CODE>all</CODE> - All of the errors below are fatal</LI>
+
+       <LI><CODE>browse</CODE> - Browsing initialization errors are fatal,
+       for example failed binding to the CUPS browse port or failed connections
+       to LDAP servers</LI>
+
+       <LI><CODE>config</CODE> - Configuration file syntax errors are
+       fatal</LI>
+
+       <LI><CODE>listen</CODE> - Listen or Port errors are fatal, except for
+       IPv6 failures on the loopback or "any" addresses</LI>
+
+       <LI><CODE>log</CODE> - Log file creation or write errors are fatal</LI>
+
+       <LI><CODE>permissions</CODE> - Bad startup file permissions are
+       fatal, for example shared SSL certificate and key files with world-
+       read permissions</LI>
+
+</UL>
+
+<P>Multiple errors can be listed, and the form "-kind" can be used with
+<CODE>all</CODE> to remove specific kinds of errors. The default setting is
+<CODE>@CUPS_FATAL_ERRORS@</CODE>.</P>
+
+
 <H2 CLASS="title"><SPAN CLASS="info">CUPS 1.1.18</SPAN><A NAME="FileDevice">FileDevice</A></H2>
 
 <H3>Examples</H3>
@@ -1473,7 +1544,7 @@ KeepAliveTimeout 30
 
 <P>The <CODE>KeepAliveTimeout</CODE> directive controls how long
 a persistent HTTP connection will remain open after the last
-request. The default is 60 seconds.</P>
+request. The default is 30 seconds.</P>
 
 
 <H2 CLASS="title"><SPAN CLASS="info">CUPS 1.1.7</SPAN><A NAME="Limit">Limit (Location)</A></H2>
@@ -2414,14 +2485,14 @@ There is no default program.</P>
 
 <PRE CLASS="command">
 ReloadTimeout 0
-ReloadTimeout 60
+ReloadTimeout 30
 </PRE>
 
 <H3>Description</H3>
 
 <P>The <CODE>ReloadTimeout</CODE> directive specifies the number
 of seconds the scheduler will wait for active jobs to complete
-before doing a restart. The default is 60 seconds.</P>
+before doing a restart. The default is 30 seconds.</P>
 
 
 <H2 CLASS="title"><SPAN CLASS="info">CUPS 1.1.3</SPAN><A NAME="RemoteRoot">RemoteRoot</A></H2>
index 6cd767e01aa52dfb6475b0c7c960023560469e28..74a5153dce48a09c229a295da77d35cff2285965 100644 (file)
@@ -293,16 +293,16 @@ translate_messages(cups_array_t *cat,     /* I - Message catalog */
       *bufptr = '\0';
 
      /*
-      * Find the first textarea element - that will have the translation data...
+      * Find the div containing translation
       */
 
-      if ((bufptr = strstr(buffer, "<textarea")) == NULL)
+      if ((bufptr = strstr(buffer, "<div id=result_box")) == NULL)
       {
        /*
         * No textarea, abort!
        */
 
-        puts("NO TEXTAREA!");
+        puts("NO div id=result_box!");
        ret = 0;
        break;
       }
@@ -313,20 +313,20 @@ translate_messages(cups_array_t *cat,     /* I - Message catalog */
         * textarea doesn't end, abort!
        */
 
-        puts("TEXTAREA SHORT DATA!");
+        puts("DIV SHORT DATA!");
        ret = 0;
        break;
       }
 
       bufptr ++;
 
-      if ((bufend = strstr(bufptr, "</textarea>")) == NULL)
+      if ((bufend = strstr(bufptr, "</div>")) == NULL)
       {
        /*
         * textarea doesn't close, abort!
        */
 
-        puts("/TEXTAREA SHORT DATA!");
+        puts("/DIV SHORT DATA!");
        ret = 0;
        break;
       }
index 1e2bb0100526956b9531fb1965590bd69cb609a9..0f686af4fd7dd008326682f72633bd33592610b5 100644 (file)
@@ -53,7 +53,7 @@ MAN7  =       backend.$(MAN7EXT) \
                filter.$(MAN7EXT) \
                rastertoescpx.$(MAN7EXT) \
                rastertopclx.$(MAN7EXT)
-MAN8   =       accept.$(MAN8EXT) \
+MAN8   =       cupsaccept.$(MAN8EXT) \
                cupsaddsmb.$(MAN8EXT) \
                cupsctl.$(MAN8EXT) \
                cupsfilter.$(MAN8EXT) \
@@ -129,7 +129,7 @@ install:    all install-data install-headers install-libs install-exec
 # Install data files...
 #
 
-install-data:
+install-data: all
        $(INSTALL_DIR) -m 755 $(MANDIR)/man1
        for file in $(MAN1); do \
                echo Installing $$file in $(MANDIR)/man1...; \
@@ -150,8 +150,8 @@ install-data:
                echo Installing $$file in $(AMANDIR)/man$(MAN8DIR)...; \
                $(INSTALL_MAN) $$file $(AMANDIR)/man$(MAN8DIR); \
        done
-       $(RM) $(AMANDIR)/man$(MAN8DIR)/reject.$(MAN8EXT)
-       $(LN) accept.$(MAN8EXT) $(AMANDIR)/man$(MAN8DIR)/reject.$(MAN8EXT)
+       $(RM) $(AMANDIR)/man$(MAN8DIR)/cupsreject.$(MAN8EXT)
+       $(LN) cupsaccept.$(MAN8EXT) $(AMANDIR)/man$(MAN8DIR)/cupsreject.$(MAN8EXT)
        $(RM) $(AMANDIR)/man$(MAN8DIR)/cupsdisable.$(MAN8EXT)
        $(LN) cupsenable.$(MAN8EXT) $(AMANDIR)/man$(MAN8DIR)/cupsdisable.$(MAN8EXT)
 
similarity index 94%
rename from man/accept.man
rename to man/cupsaccept.man
index 477d125e9c18025733cc1d0f1217a3c37029c281..36457e351f150eecdfab74d7a00b671b4e67a34e 100644 (file)
@@ -1,5 +1,5 @@
 .\"
-.\" "$Id: accept.man 7600 2008-05-20 21:06:23Z mike $"
+.\" "$Id$"
 .\"
 .\"   accept/reject man page for the Common UNIX Printing System (CUPS).
 .\"
@@ -75,5 +75,5 @@ http://localhost:631/help
 .SH COPYRIGHT
 Copyright 2007 by Apple Inc.
 .\"
-.\" End of "$Id: accept.man 7600 2008-05-20 21:06:23Z mike $".
+.\" End of "$Id$".
 .\"
index 4421c1df482decf1e540d3d7d6aeb02e29a43cee..b3137f74f3a6e648e321fefca6a98bebf6321b2c 100644 (file)
@@ -12,7 +12,7 @@
 .\"   which should have been included with this file.  If this file is
 .\"   file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH cupsd.conf 5 "Common UNIX Printing System" "16 June 2008" "Apple Inc."
+.TH cupsd.conf 5 "Common UNIX Printing System" "8 September 2008" "Apple Inc."
 .SH NAME
 cupsd.conf \- server configuration file for cups
 .SH DESCRIPTION
@@ -254,6 +254,15 @@ DefaultLanguage locale
 .br
 Specifies the default language to use for text and web content.
 .TP 5
+DefaultPaperSize Auto
+.TP 5
+DefaultPaperSize None
+.TP 5
+DefaultPaperSize sizename
+.br
+Specifies the default paper size for new print queues. "Auto" uses a locale-
+specific default, while "None" specifies there is no default paper size.
+.TP 5
 DefaultPolicy policy-name
 .br
 Specifies the default access policy to use.
@@ -303,6 +312,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
index 47294c5a5978a1e113b9aa30f3654e6e64869277..e0bb5935da30cc0c2a7b3028258a02ee143b625a 100644 (file)
@@ -3,7 +3,7 @@
 .\"
 .\"   lpstat man page for the Common UNIX Printing System (CUPS).
 .\"
-.\"   Copyright 2007 by Apple Inc.
+.\"   Copyright 2007-2008 by Apple Inc.
 .\"   Copyright 1997-2006 by Easy Software Products.
 .\"
 .\"   These coded instructions, statements, and computer programs are the
 .\"   which should have been included with this file.  If this file is
 .\"   file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH lpstat 1 "Common UNIX Printing System" "23 March 2006" "Apple Inc."
+.TH lpstat 1 "Common UNIX Printing System" "10 September 2008" "Apple Inc."
 .SH NAME
 lpstat \- print cups status information
 .SH SYNOPSIS
 .B lpstat
-[ -E ] [ -U
+[ -E ] [ -H ] [ -U
 .I username
 ] [ -h
 .I hostname[:port]
@@ -47,6 +47,10 @@ The \fIlpstat\fR command supports the following options:
 .br
 Forces encryption when connecting to the server.
 .TP 5
+-H
+.br
+Shows the server hostname and port.
+.TP 5
 -R
 .br
 Shows the ranking of print jobs.
@@ -133,7 +137,7 @@ The Solaris "-f", "-P", and "-S" options are silently ignored.
 .br
 http://localhost:631/help
 .SH COPYRIGHT
-Copyright 2007 by Apple Inc.
+Copyright 2007-2008 by Apple Inc.
 .\"
 .\" End of "$Id: lpstat.man 7600 2008-05-20 21:06:23Z mike $".
 .\"
index a27cdfea42af5891a8c9518248ffd6def699bc8d..8f5cfed1d4321eafd6b74b9e439949ba597f9fc4 100644 (file)
@@ -1,5 +1,8 @@
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
+dbus.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h
+dbus.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
+dbus.o: ../cups/string.h ../config.h
 mailto.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/versioning.h
 mailto.o: ../cups/ppd.h ../cups/array.h ../cups/file.h ../cups/language.h
 mailto.o: ../cups/i18n.h ../cups/transcode.h ../cups/string.h ../config.h
index 2c80380a6906d47060bd14119c6bd83ba63b5553..1f63c8497a2fef15b353bc4a5d5ad0d310a56a79 100644 (file)
@@ -64,10 +64,6 @@ install:     all install-data install-headers install-libs install-exec
 install-data:
        $(INSTALL_DIR) -m 775 $(CACHEDIR)/rss
        -chgrp $(CUPS_GROUP) $(CACHEDIR)/rss
-       if test "x$(SYMROOT)" != "x"; then \
-               $(INSTALL_DIR) $(SYMROOT); \
-               cp $(NOTIFIERS) $(SYMROOT); \
-       fi
 
 
 #
@@ -80,6 +76,10 @@ install-exec:
        for file in $(NOTIFIERS); do \
                $(INSTALL_BIN) $$file $(SERVERBIN)/notifier; \
        done
+       if test "x$(SYMROOT)" != "x"; then \
+               $(INSTALL_DIR) $(SYMROOT); \
+               cp $(NOTIFIERS) $(SYMROOT); \
+       fi
 
 
 #
@@ -125,10 +125,6 @@ dbus:      dbus.o ../cups/$(LIBCUPS)
        echo Linking $@...
        $(CC) $(LDFLAGS) -o dbus dbus.o $(DBUS_NOTIFIERLIBS) $(LIBS)
 
-dbus.o:        dbus.h
-dbus.h:        dbus-notifier.xml
-       dbus-binding-tool --mode=glib-server $< >$@
-
 
 #
 # mailto
index 1f1c43a21420c8c08279f7c7cf57a78b1465237b..4b51b625854d07e4b18d075c7e9784815dada1a4 100644 (file)
@@ -16,6 +16,8 @@
  *
  * Contents:
  *
+ *   main()         - Read events and send DBUS notifications.
+ *   acquire_lock() - Acquire a lock so we only have a single notifier running.
  */
 
 /*
@@ -154,7 +156,7 @@ enum
  * Local functions...
  */
 
-static int     acquire_lock(int *fd);
+static int     acquire_lock(int *fd, char *lockfile, size_t locksize);
 
 
 /*
@@ -201,7 +203,7 @@ main(int  argc,                             /* I - Number of command-line args */
     return (1);
   }
 
-  if (strcmp(argv[1], "dbus:"))
+  if (strncmp(argv[1], "dbus:", 5))
   {
     fprintf(stderr, "ERROR: Bad URI \"%s\"!\n", argv[1]);
     return (1);
index da364d11d1a96ac81265db7091eabad4b8968552..d908715397366cc1b6b9039cbcdb80d2b7e139aa 100644 (file)
@@ -327,16 +327,18 @@ f 0755 root sys $SERVERBIN/daemon/cups-lpd scheduler/cups-lpd
 d 0755 root sys $BINDIR -
 l 0755 root sys $BINDIR/enable $SBINDIR/accept
 l 0755 root sys $LIBDIR/accept $SBINDIR/accept
-d 0755 root sys $SBINDIR -
-l 0755 root sys $SBINDIR/cupsdisable accept
-l 0755 root sys $SBINDIR/cupsenable accept
 l 0755 root sys $BINDIR/disable $SBINDIR/accept
 d 0755 root sys $LIBDIR -
 l 0755 root sys $LIBDIR/lpadmin $SBINDIR/lpadmin
 l 0755 root sys $LIBDIR/reject accept
+d 0755 root sys $SBINDIR -
 f 0755 root sys $SBINDIR/accept systemv/accept
+l 0755 root sys $SBINDIR/cupsaccept accept
 f 0755 root sys $SBINDIR/cupsaddsmb systemv/cupsaddsmb
 f 0755 root sys $SBINDIR/cupsctl systemv/cupsctl
+l 0755 root sys $SBINDIR/cupsdisable accept
+l 0755 root sys $SBINDIR/cupsenable accept
+l 0755 root sys $SBINDIR/cupsreject accept
 f 0755 root sys $SBINDIR/lpadmin systemv/lpadmin
 f 0755 root sys $SBINDIR/lpc berkeley/lpc
 f 0755 root sys $SBINDIR/lpinfo systemv/lpinfo
@@ -732,8 +734,8 @@ f 0644 root sys $MANDIR/man7/filter.$MAN7EXT man/filter.$MAN7EXT
 f 0644 root sys $MANDIR/man7/rastertoescpx.$MAN7EXT man/rastertoescpx.$MAN7EXT
 f 0644 root sys $MANDIR/man7/rastertopclx.$MAN7EXT man/rastertopclx.$MAN7EXT
 
-f 0644 root sys $AMANDIR/man$MAN8DIR/accept.$MAN8EXT man/accept.$MAN8EXT
-l 0644 root sys $AMANDIR/man$MAN8DIR/reject.$MAN8EXT accept.$MAN8EXT
+f 0644 root sys $AMANDIR/man$MAN8DIR/cupsaccept.$MAN8EXT man/cupsaccept.$MAN8EXT
+l 0644 root sys $AMANDIR/man$MAN8DIR/cupsreject.$MAN8EXT cupsaccept.$MAN8EXT
 f 0644 root sys $AMANDIR/man$MAN8DIR/cupsaddsmb.$MAN8EXT man/cupsaddsmb.$MAN8EXT
 f 0644 root sys $AMANDIR/man$MAN8DIR/cupsctl.$MAN8EXT man/cupsctl.$MAN8EXT
 f 0644 root sys $AMANDIR/man$MAN8DIR/cupsfilter.$MAN8EXT man/cupsfilter.$MAN8EXT
index a4e249790881b47cc6fd94ba438e0c1066136161..3e3845e058094ce5b7e92966350db076a36ec320 100644 (file)
@@ -524,7 +524,8 @@ cupsdCloseAllClients(void)
   for (con = (cupsd_client_t *)cupsArrayFirst(Clients);
        con;
        con = (cupsd_client_t *)cupsArrayNext(Clients))
-    cupsdCloseClient(con);
+    if (cupsdCloseClient(con))
+      cupsdCloseClient(con);
 }
 
 
@@ -1034,8 +1035,11 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client to read from */
 
        con->http.status = HTTP_OK;
 
-        cupsArrayAdd(ActiveClients, con);
-       cupsdSetBusyState();
+        if (!cupsArrayFind(ActiveClients, con))
+       {
+         cupsArrayAdd(ActiveClients, con);
+          cupsdSetBusyState();
+        }
 
     case HTTP_OPTIONS :
     case HTTP_DELETE :
index 51eecb22b6cbf94133f731bc0aba19eee671baaa..1269555a758afc9c10bd6752f8e9e5154713d92a 100644 (file)
@@ -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.
@@ -199,6 +200,7 @@ static int          get_addr_and_mask(const char *value, unsigned *ip,
                                          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);
@@ -223,6 +225,7 @@ cupsdCheckPermissions(
   int          dir_created = 0;        /* Did we create a directory? */
   char         pathname[1024];         /* File name with prefix */
   struct stat  fileinfo;               /* Stat buffer */
+  int          is_symlink;             /* Is "filename" a symlink? */
 
 
  /*
@@ -239,7 +242,7 @@ cupsdCheckPermissions(
   * See if we can stat the file/directory...
   */
 
-  if (stat(filename, &fileinfo))
+  if (lstat(filename, &fileinfo))
   {
     if (errno == ENOENT && create_dir)
     {
@@ -266,8 +269,18 @@ cupsdCheckPermissions(
       return (create_dir ? -1 : 1);
   }
 
+  if ((is_symlink = S_ISLNK(fileinfo.st_mode)) != 0)
+  {
+    if (stat(filename, &fileinfo))
+    {
+      cupsdLogMessage(CUPSD_LOG_ERROR, "\"%s\" is a bad symlink - %s",
+                      filename, strerror(errno));
+      return (-1);
+    }
+  }
+
  /*
-  * Make sure it's a regular file...
+  * Make sure it's a regular file or a directory as needed...
   */
 
   if (!dir_created && !is_dir && !S_ISREG(fileinfo.st_mode))
@@ -286,6 +299,13 @@ cupsdCheckPermissions(
     return (-1);
   }
 
+ /*
+  * If the filename is a symlink, do not change permissions (STR #2937)...
+  */
+
+  if (is_symlink)
+    return (0);
+
  /*
   * Fix owner, group, and mode as needed...
   */
@@ -524,11 +544,12 @@ cupsdReadConfiguration(void)
 
   AccessLogLevel        = CUPSD_ACCESSLOG_ACTIONS;
   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;
 #endif /* HAVE_SSL */
-  DirtyCleanInterval    = 60;
+  DirtyCleanInterval    = DEFAULT_KEEPALIVE;
   JobRetryLimit         = 5;
   JobRetryInterval      = 300;
   FileDevice            = FALSE;
@@ -549,7 +570,7 @@ cupsdReadConfiguration(void)
   MaxLogSize            = 1024 * 1024;
   MaxPrinterHistory     = 10;
   MaxRequestSize        = 0;
-  ReloadTimeout                = 60;
+  ReloadTimeout                = DEFAULT_KEEPALIVE;
   RootCertDuration      = 300;
   Timeout               = DEFAULT_TIMEOUT;
   NumSystemGroups       = 0;
@@ -737,7 +758,8 @@ cupsdReadConfiguration(void)
     */
 
     cupsdLogMessage(CUPSD_LOG_EMERG,
-                    "No valid Listen or Port lines were found in the configuration file!");
+                    "No valid Listen or Port lines were found in the "
+                   "configuration file!");
 
    /*
     * Commit suicide...
@@ -775,21 +797,20 @@ cupsdReadConfiguration(void)
   if (ServerCertificate[0] != '/')
     cupsdSetStringf(&ServerCertificate, "%s/%s", ServerRoot, ServerCertificate);
 
-  if (!strncmp(ServerRoot, ServerCertificate, strlen(ServerRoot)))
-  {
-    chown(ServerCertificate, RunUser, Group);
-    chmod(ServerCertificate, 0600);
-  }
+  if (!strncmp(ServerRoot, ServerCertificate, strlen(ServerRoot)) &&
+      cupsdCheckPermissions(ServerCertificate, NULL, 0600, RunUser, Group,
+                            0, 0) < 0 &&
+      (FatalErrors & CUPSD_FATAL_PERMISSIONS))
+    return (0);
 
 #  if defined(HAVE_LIBSSL) || defined(HAVE_GNUTLS)
   if (ServerKey[0] != '/')
     cupsdSetStringf(&ServerKey, "%s/%s", ServerRoot, ServerKey);
 
-  if (!strncmp(ServerRoot, ServerKey, strlen(ServerRoot)))
-  {
-    chown(ServerKey, RunUser, Group);
-    chmod(ServerKey, 0600);
-  }
+  if (!strncmp(ServerRoot, ServerKey, strlen(ServerRoot)) &&
+      cupsdCheckPermissions(ServerKey, NULL, 0600, RunUser, Group, 0, 0) < 0 &&
+      (FatalErrors & CUPSD_FATAL_PERMISSIONS))
+    return (0);
 #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
 #endif /* HAVE_SSL */
 
@@ -800,30 +821,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);
 
  /*
@@ -873,7 +895,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);
   }
 
@@ -932,8 +955,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;
   }
@@ -1170,7 +1195,8 @@ cupsdReadConfiguration(void)
       cupsdLogMessage(CUPSD_LOG_EMERG,
                       "Unable to load MIME database from \"%s\" or \"%s\"!",
                      mimedir, ServerRoot);
-      exit(errno);
+      if (FatalErrors & CUPSD_FATAL_CONFIG)
+        return (0);
     }
 
     cupsdLogMessage(CUPSD_LOG_INFO,
@@ -1966,6 +1992,86 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */
 }
 
 
+/*
+ * '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.
  */
@@ -2200,6 +2306,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       if (linenum == 0)
        return (0);
     }
+    else if (!strcasecmp(line, "FatalErrors"))
+      FatalErrors = parse_fatal_errors(value);
     else if (!strcasecmp(line, "FaxRetryInterval") && value)
     {
       JobRetryInterval = atoi(value);
@@ -2246,6 +2354,25 @@ read_configuration(cups_file_t *fp)      /* I - File to read from */
 
       for (addr = addrlist; addr; addr = addr->next)
       {
+       /*
+        * See if this address is already present...
+       */
+
+        for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
+            lis;
+            lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
+          if (httpAddrEqual(&(addr->addr), &(lis->address)) &&
+             _httpAddrPort(&(addr->addr)) == _httpAddrPort(&(lis->address)))
+           break;
+
+        if (lis)
+       {
+         httpAddrString(&lis->address, temp, sizeof(temp));
+         cupsdLogMessage(CUPSD_LOG_WARN,
+                         "Duplicate listen address \"%s\" ignored!", temp);
+          continue;
+       }
+
        /*
         * Allocate another listener...
        */
@@ -2799,7 +2926,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        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
@@ -2820,7 +2948,8 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        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 */
@@ -3223,7 +3352,8 @@ read_location(cups_file_t *fp,            /* I - Configuration file */
       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)
@@ -3271,7 +3401,8 @@ read_location(cups_file_t *fp,            /* I - Configuration file */
       cupsdLogMessage(CUPSD_LOG_ERROR,
                       "Unknown Location directive %s on line %d.",
                      line, linenum);
-      return (0);
+      if (FatalErrors & CUPSD_FATAL_CONFIG)
+       return (0);
     }
   }
 
@@ -3279,7 +3410,7 @@ read_location(cups_file_t *fp,            /* I - Configuration file */
                   "Unexpected end-of-file at line %d while reading location!",
                   linenum);
 
-  return (0);
+  return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
 }
 
 
@@ -3361,7 +3492,8 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
       if (!value)
       {
         cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum);
-        return (0);
+        if (FatalErrors & CUPSD_FATAL_CONFIG)
+         return (0);
       }
       
      /*
@@ -3435,7 +3567,8 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
       cupsdLogMessage(CUPSD_LOG_ERROR,
                       "Missing <Limit ops> 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))
     {
@@ -3448,7 +3581,8 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
                        "Unknown Policy directive %s on line %d.",
                        line, linenum);
 
-      return (0);
+      if (FatalErrors & CUPSD_FATAL_CONFIG)
+       return (0);
     }
   }
 
@@ -3456,7 +3590,7 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
                   "Unexpected end-of-file at line %d while reading policy \"%s\"!",
                   linenum, policy);
 
-  return (0);
+  return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
 }
 
 
index 1b3765bd44a3b621f0d279b5507e5768f7a87b2d..e80a24ea996d0984b7fe8686a0792227542a95ab 100644 (file)
@@ -45,6 +45,19 @@ typedef enum
 } cupsd_accesslog_t;
 
 
+/*
+ * 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...
  */
@@ -132,6 +145,8 @@ VAR int                     AccessLogLevel          VALUE(CUPSD_ACCESSLOG_ACTIONS),
                                        /* 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_WARN),
@@ -170,7 +185,7 @@ VAR int                     AccessLogLevel          VALUE(CUPSD_ACCESSLOG_ACTIONS),
                                        /* Current filter level */
                        FilterNice              VALUE(0),
                                        /* Nice value for filters */
-                       ReloadTimeout           VALUE(0),
+                       ReloadTimeout           VALUE(DEFAULT_KEEPALIVE),
                                        /* Timeout before reload from SIGHUP */
                        RootCertDuration        VALUE(300),
                                        /* Root certificate update interval */
@@ -205,7 +220,7 @@ VAR char            *ServerKey              VALUE(NULL);
 #endif /* HAVE_SSL */
 
 #ifdef HAVE_LAUNCHD
-VAR int                        LaunchdTimeout          VALUE(DEFAULT_TIMEOUT);
+VAR int                        LaunchdTimeout          VALUE(DEFAULT_KEEPALIVE);
                                        /* Time after which an idle cupsd will exit */
 VAR char               *LaunchdConf            VALUE(NULL);
                                        /* launchd(8) configuration file */
index b4304ce830ab4d79a4d8ed877ace89507d978806..5b1a4d6452614f269de68fe9c1aff0fb32f1f4cf 100644 (file)
@@ -92,7 +92,7 @@ extern const char *cups_hstrerror(int);
 #define DEFAULT_HISTORY                1       /* Preserve job history? */
 #define DEFAULT_FILES          0       /* Preserve job files? */
 #define DEFAULT_TIMEOUT                300     /* Timeout during requests/updates */
-#define DEFAULT_KEEPALIVE      60      /* Timeout between requests */
+#define DEFAULT_KEEPALIVE      30      /* Timeout between requests */
 #define DEFAULT_INTERVAL       30      /* Interval between browse updates */
 #define DEFAULT_CHARSET                "utf-8" /* Default charset */
 
index e7e2b6e1fa05140eeba79a10410f15831459f27f..82ed305152006c56bea68d1c9f01d46ab171da39 100644 (file)
@@ -1422,9 +1422,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...
       */
@@ -1449,50 +1454,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
@@ -1511,8 +1526,13 @@ cupsdStartBrowsing(void)
 
     if ((error = DNSServiceCreateConnection(&DNSSDRef))
            != kDNSServiceErr_NoError)
+    {
       cupsdLogMessage(CUPSD_LOG_ERROR,
                      "Unable to create master DNS-SD reference: %d", error);
+
+      if (FatalErrors & CUPSD_FATAL_BROWSE)
+       cupsdEndProcess(getpid(), 0);
+    }
     else
     {
      /*
@@ -1579,6 +1599,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;
@@ -1596,11 +1620,19 @@ 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
     {
-      /* Open LDAP handle... */
-      BrowseLDAPHandle = ldap_connect();
+     /*
+      * Open LDAP handle...
+      */
+
+      if ((BrowseLDAPHandle = ldap_connect()) == NULL &&
+          (FatalErrors & CUPSD_FATAL_BROWSE))
+       cupsdEndProcess(getpid(), 0);
     }
 
     BrowseLDAPRefresh = 0;
@@ -2321,7 +2353,7 @@ dnssdBuildTxtRecord(
     }
 
     keyvalue[i  ][0] = "air";
-    keyvalue[i++][1] = air;
+    keyvalue[i++][1] = air_str;
   }
 
  /*
@@ -2573,7 +2605,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
   * Register IPP and (optionally) LPD...
   */
 
-  ipp_len    = 0;                      /* anti-compiler-warning-code */
+  ipp_len = 0;                         /* anti-compiler-warning-code */
   ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0);
 
   if (!p->ipp_ref)
@@ -2654,7 +2686,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
 
   if (BrowseLocalProtocols & BROWSE_LPD)
   {
-    printer_len    = 0;                        /* anti-compiler-warning-code */
+    printer_len = 0;                   /* anti-compiler-warning-code */
     printer_txt = dnssdBuildTxtRecord(&printer_len, p, 1);
 
     if (!p->printer_ref)
index 11fa79bd5c9391716ba262da782541167262c2a4..075ee2407f450ddbc1b626c8ed0422f607b9b0fa 100644 (file)
@@ -9558,11 +9558,7 @@ send_document(cupsd_client_t  *con,      /* I - Client connection */
   else
     filetype = mimeType(MimeDatabase, super, type);
 
-  jformat = ippFindAttribute(job->attrs, "document-format", IPP_TAG_MIMETYPE);
-
-  if (filetype &&
-      (!jformat ||
-       (!strcmp(super, "application") && !strcmp(type, "octet-stream"))))
+  if (filetype)
   {
    /*
     * Replace the document-format attribute value with the auto-typed or
@@ -9572,7 +9568,8 @@ send_document(cupsd_client_t  *con,       /* I - Client connection */
     snprintf(mimetype, sizeof(mimetype), "%s/%s", filetype->super,
              filetype->type);
 
-    if (jformat)
+    if ((jformat = ippFindAttribute(job->attrs, "document-format",
+                                    IPP_TAG_MIMETYPE)) != NULL)
     {
       _cupsStrFree(jformat->values[0].string.text);
 
index 361ff677c2b17ba6566a9b110fb7c6eafe85af93..69fb7fc3ce7d6211d6f5458e09965dafe07abc0e 100644 (file)
@@ -4,7 +4,7 @@
  *   Server listening routines for the Common UNIX Printing System (CUPS)
  *   scheduler.
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -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\"!",
                    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);
   }
 
  /*
index dc2e23297afbea2bef98b934038ba6d8e1060390..a0123bf8a13e2b94544ab2be25ae816232e4725b 100644 (file)
@@ -807,7 +807,20 @@ check_log_file(cups_file_t **lf,   /* IO - Log file */
 
       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");
       }
@@ -816,6 +829,10 @@ check_log_file(cups_file_t **lf,   /* IO - Log file */
       {
        syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
               strerror(errno));
+
+        if (FatalErrors & CUPSD_FATAL_LOG)
+         cupsdEndProcess(getpid(), 0);
+
        return (0);
       }
     }
@@ -855,6 +872,9 @@ check_log_file(cups_file_t **lf,    /* IO - Log file */
       syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
              strerror(errno));
 
+      if (FatalErrors & CUPSD_FATAL_LOG)
+       cupsdEndProcess(getpid(), 0);
+
       return (0);
     }
 
index 417d98ef50e13764f1fa451c4abd086a4a556c67..be77cb0ab090836f74324fde80308bb661730634 100644 (file)
@@ -654,6 +654,23 @@ main(int  argc,                            /* I - Number of command-line args */
   cupsdStartSystemMonitor();
 #endif /* __APPLE__ */
 
+ /*
+  * Send server-started event...
+  */
+
+#ifdef HAVE_LAUNCHD
+  if (Launchd)
+    cupsdAddEvent(CUPSD_EVENT_SERVER_STARTED, NULL, NULL,
+                  "Scheduler started via launchd.");
+  else
+#endif /* HAVE_LAUNCHD */
+  if (fg)
+    cupsdAddEvent(CUPSD_EVENT_SERVER_STARTED, NULL, NULL,
+                  "Scheduler started in foreground.");
+  else
+    cupsdAddEvent(CUPSD_EVENT_SERVER_STARTED, NULL, NULL,
+                  "Scheduler started in background.");
+
  /*
   * Start any pending print jobs...
   */
@@ -762,6 +779,13 @@ main(int  argc,                            /* I - Number of command-line args */
         */
 
         cupsdStartServer();
+
+       /*
+        * Send a server-restarted event...
+       */
+
+        cupsdAddEvent(CUPSD_EVENT_SERVER_RESTARTED, NULL, NULL,
+                      "Scheduler restarted.");
       }
     }
 
@@ -867,10 +891,7 @@ main(int  argc,                            /* I - Number of command-line args */
     */
 
     if (DirtyCleanTime && current_time >= DirtyCleanTime)
-    {
       cupsdCleanDirty();
-      cupsdSetBusyState();
-    }
 
 #ifndef __APPLE__
    /*
@@ -1101,10 +1122,18 @@ main(int  argc,                         /* I - Number of command-line args */
   */
 
   if (stop_scheduler)
+  {
     cupsdLogMessage(CUPSD_LOG_INFO, "Scheduler shutting down normally.");
+    cupsdAddEvent(CUPSD_EVENT_SERVER_STOPPED, NULL, NULL,
+                  "Scheduler shutting down normally.");
+  }
   else
+  {
     cupsdLogMessage(CUPSD_LOG_ERROR,
                     "Scheduler shutting down due to program error.");
+    cupsdAddEvent(CUPSD_EVENT_SERVER_STOPPED, NULL, NULL,
+                  "Scheduler shutting down due to program error.");
+  }
 
  /*
   * Close all network clients...
index d44e4ee7366f332ae09d74d7187808f314f8ad82..650b3b16de6eb884177b967a7b5776e9377e5295 100644 (file)
@@ -111,10 +111,11 @@ cupsdStartServer(void)
   * Mark that the server has started and printers and jobs may be changed...
   */
 
-  LastEvent     = CUPSD_EVENT_PRINTER_CHANGED | CUPSD_EVENT_JOB_STATE_CHANGED |
-                  CUPSD_EVENT_SERVER_STARTED;
+  LastEvent = CUPSD_EVENT_PRINTER_CHANGED | CUPSD_EVENT_JOB_STATE_CHANGED |
+              CUPSD_EVENT_SERVER_STARTED;
+  started   = 1;
 
-  started = 1;
+  cupsdSetBusyState();
 }
 
 
index cffb285a7498396b7c44b723666f8feab5193eed..8933d083eb2e716d0dc8a5ae048c87fd1a52d6be 100644 (file)
@@ -93,6 +93,8 @@ cupsdCleanDirty(void)
 
   DirtyFiles     = CUPSD_DIRTY_NONE;
   DirtyCleanTime = 0;
+
+  cupsdSetBusyState();
 }
 
 
@@ -103,6 +105,9 @@ cupsdCleanDirty(void)
 void
 cupsdMarkDirty(int what)               /* I - What file(s) are dirty? */
 {
+  if (what == CUPSD_DIRTY_PRINTCAP && !Printcap)
+    return;
+
   DirtyFiles |= what;
 
   if (!DirtyCleanTime)
@@ -121,22 +126,28 @@ cupsdSetBusyState(void)
 {
   int          newbusy;                /* New busy state */
   static int   busy = 0;               /* Current busy state */
-
-
-  newbusy = DirtyCleanTime ||
-            cupsArrayCount(PrintingJobs) ||
-           cupsArrayCount(ActiveClients);
+  static const char * const busy_text[] =
+  {                                    /* Text for busy states */
+    "Not busy",
+    "Dirty files",
+    "Printing jobs",
+    "Printing jobs and dirty files",
+    "Active clients",
+    "Active clients and dirty files",
+    "Active clients and printing jobs",
+    "Active clients, printing jobs, and dirty files"
+  };
+
+
+  newbusy = (DirtyCleanTime ? 1 : 0) |
+            (cupsArrayCount(PrintingJobs) ? 2 : 0) |
+           (cupsArrayCount(ActiveClients) ? 4 : 0);
 
   if (newbusy != busy)
   {
     busy = newbusy;
 
-    if (busy)
-      cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                      "cupsdSetBusyState: Server no longer busy...");
-    else
-      cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                      "cupsdSetBusyState: Server is now busy...");
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdSetBusyState: %s", busy_text[busy]);
   }
 }
 
index 282f7b5bc67e4cde264e537524fb691706692ebc..97b9dd2c3be12ed6a93d8945ff92d7119023f2b3 100644 (file)
@@ -31,7 +31,7 @@
 
 VAR int                        DirtyFiles      VALUE(CUPSD_DIRTY_NONE),
                                        /* What files are dirty? */
-                       DirtyCleanInterval VALUE(60);
+                       DirtyCleanInterval VALUE(DEFAULT_KEEPALIVE);
                                        /* How often do we write dirty files? */
 VAR time_t             DirtyCleanTime  VALUE(0);
                                        /* When to clean dirty files next */
index 8d95c1fc16f3de8ec8d250dc95837eafd22c974a..cfa4c7e7f0003b611f1b4c79d3ccec4fc416b6a0 100644 (file)
@@ -48,7 +48,8 @@ unittests:
 #
 
 clean:
-       $(RM) $(OBJS) $(TARGETS) cupsdisable cupsenable reject
+       $(RM) $(OBJS) $(TARGETS)
+       $(RM) cupsaccept cupsdisable cupsenable cupsreject reject
 
 
 #
@@ -91,10 +92,14 @@ install-exec:
        $(INSTALL_BIN) cancel $(BINDIR)
        $(INSTALL_BIN) cupstestdsc $(BINDIR)
        $(INSTALL_BIN) cupstestppd $(BINDIR)
+       $(RM) $(SBINDIR)/cupsaccept
+       $(LN) accept $(SBINDIR)/cupsaccept
        $(RM) $(SBINDIR)/cupsdisable
        $(LN) accept $(SBINDIR)/cupsdisable
        $(RM) $(SBINDIR)/cupsenable
        $(LN) accept $(SBINDIR)/cupsenable
+       $(RM) $(SBINDIR)/cupsreject
+       $(LN) accept $(SBINDIR)/cupsreject
        $(INSTALL_BIN) lp $(BINDIR)
        $(INSTALL_BIN) lpoptions $(BINDIR)
        $(INSTALL_BIN) lpstat $(BINDIR)
@@ -136,8 +141,10 @@ uninstall:
        -$(RMDIR) $(BINDIR)
        $(RM) $(SBINDIR)/accept
        $(RM) $(SBINDIR)/cupsaddsmb
+       $(RM) $(SBINDIR)/cupsaccept
        $(RM) $(SBINDIR)/cupsdisable
        $(RM) $(SBINDIR)/cupsenable
+       $(RM) $(SBINDIR)/cupsreject
        $(RM) $(SBINDIR)/lpadmin
        $(RM) $(SBINDIR)/lpinfo
        $(RM) $(SBINDIR)/lpmove
@@ -152,10 +159,12 @@ uninstall:
 accept:        accept.o ../cups/$(LIBCUPS)
        echo Linking $@...
        $(CC) $(LDFLAGS) -o accept accept.o $(LIBS)
-       $(RM) reject cupsenable cupsdisable
+       $(RM) cupsaccept cupsenable cupsdisable cupsreject reject
        $(LN) accept reject
+       $(LN) accept cupsaccept
        $(LN) accept cupsenable
        $(LN) accept cupsdisable
+       $(LN) accept cupsreject
 
 
 #
index 20e3af373a4e81be8ed9b90a5a3a55b81bf23f75..6d8ba261984906f6b36c609b99ef292e6c891e02 100644 (file)
@@ -62,9 +62,9 @@ main(int  argc,                               /* I - Number of command-line arguments */
 
   cancel = 0;
 
-  if (!strcmp(command, "accept"))
+  if (!strcmp(command, "cupsaccept") || !strcmp(command, "accept"))
     op = CUPS_ACCEPT_JOBS;
-  else if (!strcmp(command, "reject"))
+  else if (!strcmp(command, "cupsreject") || !strcmp(command, "reject"))
     op = CUPS_REJECT_JOBS;
   else if (!strcmp(command, "cupsdisable") || !strcmp(command, "disable"))
     op = IPP_PAUSE_PRINTER;
index ba63ae2c6815a0af78521f8f9e033d4e40d12605..35b76226eed301fd27972029f29d2bee9498b9a6 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   "lpstat" command for the Common UNIX Printing System (CUPS).
  *
- *   Copyright 2007 by Apple Inc.
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -112,6 +112,13 @@ main(int  argc,                            /* I - Number of command-line arguments */
 #endif /* HAVE_SSL */
            break;
 
+       case 'H' : /* Show server and port */
+           if (cupsServer()[0] == '/')
+             _cupsLangPrintf(stdout, "%s\n", cupsServer());
+           else
+             _cupsLangPrintf(stdout, "%s:%d\n", cupsServer(), ippPort());
+            break;
+
         case 'P' : /* Show paper types */
            op = 'P';
            break;