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
-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
include Makedefs
+
+#
+# Don't run top-level build targets in parallel...
+#
+
+.NOTPARALLEL:
+
+
#
# Directories to make...
#
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
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
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 \
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",
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
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...
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
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")
#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?
*/
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
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
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
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
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
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
# 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 */
* 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 */
/*
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));
#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
{
/*
* 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
{
* 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);
#include "debug.h"
#include <stdlib.h>
#include <errno.h>
+#ifdef HAVE_RESOLV_H
+# include <resolv.h>
+#endif /* HAVE_RESOLV_H */
/*
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
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...
*/
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...
}
}
- if (!getaddrinfo(hostname, service, &hints, &results))
+ if ((error = getaddrinfo(hostname, service, &hints, &results)) == 0)
{
/*
* Copy the results to our own address list structure...
freeaddrinfo(results);
}
+ else if (error == EAI_FAIL)
+ cg->need_res_init = 1;
+
#else
if (hostname)
{
addr = temp;
}
}
+ else if (h_errno == NO_RECOVERY)
+ cg->need_res_init = 1;
}
#endif /* HAVE_GETADDRINFO */
}
[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 網頁介面
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 \
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>
<H3>Examples</H3>
<PRE CLASS="command">
-DirtyCleanInterval 60
+DirtyCleanInterval 30
DirtyCleanInterval 0
</PRE>
<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>
</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>
<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>
<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>
*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;
}
* 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;
}
filter.$(MAN7EXT) \
rastertoescpx.$(MAN7EXT) \
rastertopclx.$(MAN7EXT)
-MAN8 = accept.$(MAN8EXT) \
+MAN8 = cupsaccept.$(MAN8EXT) \
cupsaddsmb.$(MAN8EXT) \
cupsctl.$(MAN8EXT) \
cupsfilter.$(MAN8EXT) \
# 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...; \
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)
.\"
-.\" "$Id: accept.man 7600 2008-05-20 21:06:23Z mike $"
+.\" "$Id$"
.\"
.\" accept/reject man page for the Common UNIX Printing System (CUPS).
.\"
.SH COPYRIGHT
Copyright 2007 by Apple Inc.
.\"
-.\" End of "$Id: accept.man 7600 2008-05-20 21:06:23Z mike $".
+.\" End of "$Id$".
.\"
.\" 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
.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.
.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
.\"
.\" 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]
.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.
.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 $".
.\"
# 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
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
#
for file in $(NOTIFIERS); do \
$(INSTALL_BIN) $$file $(SERVERBIN)/notifier; \
done
+ if test "x$(SYMROOT)" != "x"; then \
+ $(INSTALL_DIR) $(SYMROOT); \
+ cp $(NOTIFIERS) $(SYMROOT); \
+ fi
#
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
*
* Contents:
*
+ * main() - Read events and send DBUS notifications.
+ * acquire_lock() - Acquire a lock so we only have a single notifier running.
*/
/*
* Local functions...
*/
-static int acquire_lock(int *fd);
+static int acquire_lock(int *fd, char *lockfile, size_t locksize);
/*
return (1);
}
- if (strcmp(argv[1], "dbus:"))
+ if (strncmp(argv[1], "dbus:", 5))
{
fprintf(stderr, "ERROR: Bad URI \"%s\"!\n", argv[1]);
return (1);
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
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
for (con = (cupsd_client_t *)cupsArrayFirst(Clients);
con;
con = (cupsd_client_t *)cupsArrayNext(Clients))
- cupsdCloseClient(con);
+ if (cupsdCloseClient(con))
+ cupsdCloseClient(con);
}
con->http.status = HTTP_OK;
- cupsArrayAdd(ActiveClients, con);
- cupsdSetBusyState();
+ if (!cupsArrayFind(ActiveClients, con))
+ {
+ cupsArrayAdd(ActiveClients, con);
+ cupsdSetBusyState();
+ }
case HTTP_OPTIONS :
case HTTP_DELETE :
* 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.
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);
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? */
/*
* See if we can stat the file/directory...
*/
- if (stat(filename, &fileinfo))
+ if (lstat(filename, &fileinfo))
{
if (errno == ENOENT && create_dir)
{
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))
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...
*/
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;
MaxLogSize = 1024 * 1024;
MaxPrinterHistory = 10;
MaxRequestSize = 0;
- ReloadTimeout = 60;
+ ReloadTimeout = DEFAULT_KEEPALIVE;
RootCertDuration = 300;
Timeout = DEFAULT_TIMEOUT;
NumSystemGroups = 0;
*/
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...
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 */
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);
/*
* 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);
}
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;
}
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,
}
+/*
+ * '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.
*/
if (linenum == 0)
return (0);
}
+ else if (!strcasecmp(line, "FatalErrors"))
+ FatalErrors = parse_fatal_errors(value);
else if (!strcasecmp(line, "FaxRetryInterval") && value)
{
JobRetryInterval = atoi(value);
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...
*/
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
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 */
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)
cupsdLogMessage(CUPSD_LOG_ERROR,
"Unknown Location directive %s on line %d.",
line, linenum);
- return (0);
+ if (FatalErrors & CUPSD_FATAL_CONFIG)
+ return (0);
}
}
"Unexpected end-of-file at line %d while reading location!",
linenum);
- return (0);
+ return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
}
if (!value)
{
cupsdLogMessage(CUPSD_LOG_ERROR, "Syntax error on line %d.", linenum);
- return (0);
+ if (FatalErrors & CUPSD_FATAL_CONFIG)
+ return (0);
}
/*
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))
{
"Unknown Policy directive %s on line %d.",
line, linenum);
- return (0);
+ if (FatalErrors & CUPSD_FATAL_CONFIG)
+ return (0);
}
}
"Unexpected end-of-file at line %d while reading policy \"%s\"!",
linenum, policy);
- return (0);
+ return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
}
} 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...
*/
/* 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),
/* 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 */
#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 */
#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 */
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...
*/
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
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
{
/*
"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;
"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;
}
keyvalue[i ][0] = "air";
- keyvalue[i++][1] = air;
+ keyvalue[i++][1] = air_str;
}
/*
* 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)
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)
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
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);
* 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
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...
*/
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;
}
s, p, strerror(errno));
close(lis->fd);
lis->fd = -1;
+
+ if (FatalErrors & CUPSD_FATAL_LISTEN)
+ cupsdEndProcess(getpid(), 0);
+
continue;
}
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;
}
}
"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);
}
/*
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");
}
{
syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
strerror(errno));
+
+ if (FatalErrors & CUPSD_FATAL_LOG)
+ cupsdEndProcess(getpid(), 0);
+
return (0);
}
}
syslog(LOG_ERR, "Unable to open log file \"%s\" - %s", filename,
strerror(errno));
+ if (FatalErrors & CUPSD_FATAL_LOG)
+ cupsdEndProcess(getpid(), 0);
+
return (0);
}
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...
*/
*/
cupsdStartServer();
+
+ /*
+ * Send a server-restarted event...
+ */
+
+ cupsdAddEvent(CUPSD_EVENT_SERVER_RESTARTED, NULL, NULL,
+ "Scheduler restarted.");
}
}
*/
if (DirtyCleanTime && current_time >= DirtyCleanTime)
- {
cupsdCleanDirty();
- cupsdSetBusyState();
- }
#ifndef __APPLE__
/*
*/
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...
* 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();
}
DirtyFiles = CUPSD_DIRTY_NONE;
DirtyCleanTime = 0;
+
+ cupsdSetBusyState();
}
void
cupsdMarkDirty(int what) /* I - What file(s) are dirty? */
{
+ if (what == CUPSD_DIRTY_PRINTCAP && !Printcap)
+ return;
+
DirtyFiles |= what;
if (!DirtyCleanTime)
{
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]);
}
}
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 */
#
clean:
- $(RM) $(OBJS) $(TARGETS) cupsdisable cupsenable reject
+ $(RM) $(OBJS) $(TARGETS)
+ $(RM) cupsaccept cupsdisable cupsenable cupsreject reject
#
$(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)
-$(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
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
#
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;
*
* "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
#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;