#
-# "$Id: Makedefs.in 4999 2006-01-26 23:36:22Z mike $"
+# "$Id: Makedefs.in 5008 2006-01-27 19:30:34Z mike $"
#
# Common makefile definitions for the Common UNIX Printing System (CUPS).
#
#
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -m 755 -s
+INSTALL_CONFIG = $(INSTALL) -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -d
INSTALL_LIB = $(LIBTOOL) $(INSTALL) -m 755
INSTALL_SCRIPT = $(INSTALL) -m 755
#
-# Default user and group for the scheduler...
+# Default user, group, and system groups for the scheduler...
#
CUPS_USER = @CUPS_USER@
CUPS_GROUP = @CUPS_GROUP@
+CUPS_SYSTEM_GROUPS = @CUPS_SYSTEM_GROUPS@
+
+#
+# Default permissions...
+#
+
+CUPS_CONFIG_FILE_PERM = @CUPS_CONFIG_FILE_PERM@
+CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@
#
# Libraries...
CFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CFLAGS@ \
@LARGEFILE@ $(OPTIONS)
COMMONLIBS = @LIBS@
+CUPSDLIBS = @CUPSDLIBS@
CXXFLAGS = -I.. $(RC_CFLAGS) $(SSLFLAGS) @CPPFLAGS@ @CXXFLAGS@ \
@LARGEFILE@ $(OPTIONS)
CXXLIBS = @CXXLIBS@
#
-# End of "$Id: Makedefs.in 4999 2006-01-26 23:36:22Z mike $"
+# End of "$Id: Makedefs.in 5008 2006-01-27 19:30:34Z mike $"
#
#
-# "$Id: Makefile 4971 2006-01-24 14:33:18Z mike $"
+# "$Id: Makefile 5003 2006-01-27 02:33:36Z mike $"
#
# Top-level Makefile for the Common UNIX Printing System (CUPS).
#
# Directories to make...
#
-DIRS = cups backend berkeley cgi-bin filter man pdftops \
+DIRS = cups backend berkeley cgi-bin filter locale man pdftops \
notifier scheduler systemv
#
(cd doc; $(MAKE) $(MFLAGS) install)
echo Installing in fonts...
(cd fonts; $(MAKE) $(MFLAGS) install)
- echo Installing in locale...
- (cd locale; $(MAKE) $(MFLAGS) install)
echo Installing in ppd...
(cd ppd; $(MAKE) $(MFLAGS) install)
echo Installing in templates...
epm $(EPMFLAGS) -f tardist cups packaging/cups.list
#
-# End of "$Id: Makefile 4971 2006-01-24 14:33:18Z mike $".
+# End of "$Id: Makefile 5003 2006-01-27 02:33:36Z mike $".
#
#
-# "$Id: Makefile 4972 2006-01-24 14:48:12Z mike $"
+# "$Id: Makefile 5008 2006-01-27 19:30:34Z mike $"
#
# Configuration file makefile for the Common UNIX Printing System (CUPS).
#
$(INSTALL_DIR) $(SERVERROOT)
for file in $(KEEP); do \
if test -r $(SERVERROOT)/$$file ; then \
- $(INSTALL_DATA) $$file $(SERVERROOT)/$$file.N ; \
+ $(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \
else \
- $(INSTALL_DATA) $$file $(SERVERROOT) ; \
+ $(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
fi ; \
done
- $(INSTALL_DATA) cupsd.conf $(SERVERROOT)/cupsd.conf.default
+ $(INSTALL_CONFIG) cupsd.conf $(SERVERROOT)/cupsd.conf.default
for file in $(REPLACE); do \
if test -r $(SERVERROOT)/$$file ; then \
$(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \
fi ; \
- $(INSTALL_DATA) $$file $(SERVERROOT) ; \
+ $(INSTALL_CONFIG) $$file $(SERVERROOT) ; \
done
-if test x$(PAMDIR) != x$(BUILDROOT); then \
$(INSTALL_DIR) $(PAMDIR); \
#
-# End of "$Id: Makefile 4972 2006-01-24 14:48:12Z mike $".
+# End of "$Id: Makefile 5008 2006-01-27 19:30:34Z mike $".
#
dnl
-dnl "$Id: cups-common.m4 4999 2006-01-26 23:36:22Z mike $"
+dnl "$Id: cups-common.m4 5007 2006-01-27 18:25:42Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
case $uname in
Darwin*)
BACKLIBS="-framework IOKit"
+ CUPSDLIBS="-framework IOKit -framework SystemConfiguration"
LIBS="-framework CoreFoundation $LIBS"
dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString...
;;
*)
BACKLIBS=""
+ CUPSDLIBS=""
;;
esac
AC_SUBST(BACKLIBS)
+AC_SUBST(CUPSDLIBS)
dnl New default port definition for IPP...
AC_ARG_WITH(ipp-port, [ --with-ipp-port set default port number for IPP ],
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl
-dnl End of "$Id: cups-common.m4 4999 2006-01-26 23:36:22Z mike $".
+dnl End of "$Id: cups-common.m4 5007 2006-01-27 18:25:42Z mike $".
dnl
--- /dev/null
+dnl
+dnl "$Id$"
+dnl
+dnl Default cupsd configuration settings for the Common UNIX Printing System
+dnl (CUPS).
+dnl
+dnl Copyright 2006 by Easy Software Products, all rights reserved.
+dnl
+dnl These coded instructions, statements, and computer programs are the
+dnl property of Easy Software Products and are protected by Federal
+dnl copyright law. Distribution and use rights are outlined in the file
+dnl "LICENSE.txt" which should have been included with this file. If this
+dnl file is missing or damaged please contact Easy Software Products
+dnl at:
+dnl
+dnl Attn: CUPS Licensing Information
+dnl Easy Software Products
+dnl 44141 Airport View Drive, Suite 204
+dnl Hollywood, Maryland 20636 USA
+dnl
+dnl Voice: (301) 373-9600
+dnl EMail: cups-info@cups.org
+dnl WWW: http://www.cups.org
+dnl
+
+dnl Default ConfigFilePerm
+AC_ARG_WITH(config_perm, [ --with-config-file-perm set default ConfigFilePerm value, default=0640],
+ CUPS_CONFIG_FILE_PERM="$withval",
+ CUPS_CONFIG_FILE_PERM="0640")
+AC_SUBST(CUPS_CONFIG_FILE_PERM)
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, $CUPS_CONFIG_FILE_PERM)
+
+dnl Default LogFilePerm
+AC_ARG_WITH(log_perm, [ --with-log-file-perm set default LogFilePerm value, default=0644],
+ CUPS_LOG_FILE_PERM="$withval",
+ CUPS_LOG_FILE_PERM="0644")
+AC_SUBST(CUPS_LOG_FILE_PERM)
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LOG_FILE_PERM, $CUPS_LOG_FILE_PERM)
+
+dnl Default Browsing
+AC_ARG_ENABLE(browsing, [ --enable-browsing enable Browsing by default, default=yes])
+if test "x$enable_browsing" = xno; then
+ CUPS_BROWSING="No"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 0)
+else
+ CUPS_BROWSING="Yes"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSING, 1)
+fi
+AC_SUBST(CUPS_BROWSING)
+
+dnl Default BrowseLocalProtocols
+AC_ARG_WITH(browse_local, [ --with-local-protocols set default BrowseLocalProtocols, default="CUPS"],
+ CUPS_BROWSE_LOCAL_PROTOCOLS="$withval",
+ CUPS_BROWSE_LOCAL_PROTOCOLS="CUPS")
+AC_SUBST(CUPS_BROWSE_LOCAL_PROTOCOLS)
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS,
+ "$CUPS_BROWSE_LOCAL_PROTOCOLS")
+
+dnl Default BrowseRemoteProtocols
+AC_ARG_WITH(browse_remote, [ --with-remote-protocols set default BrowseRemoteProtocols, default="CUPS"],
+ CUPS_BROWSE_REMOTE_PROTOCOLS="$withval",
+ CUPS_BROWSE_REMOTE_PROTOCOLS="CUPS")
+AC_SUBST(CUPS_BROWSE_REMOTE_PROTOCOLS)
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS,
+ "$CUPS_BROWSE_REMOTE_PROTOCOLS")
+
+dnl Default BrowseShortNames
+AC_ARG_ENABLE(browse_short, [ --enable-browse-short-names
+ enable BrowseShortNames by default, default=yes])
+if test "x$enable_browse_short" = xno; then
+ CUPS_BROWSE_SHORT_NAMES="No"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 0)
+else
+ CUPS_BROWSE_SHORT_NAMES="Yes"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_BROWSE_SHORT_NAMES, 1)
+fi
+AC_SUBST(CUPS_BROWSE_SHORT_NAMES)
+
+dnl Default DefaultShared
+AC_ARG_ENABLE(default_shared, [ --enable-default-shared enable DefaultShared by default, default=yes])
+if test "x$enable_default_shared" = xno; then
+ CUPS_DEFAULT_SHARED="No"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 0)
+else
+ CUPS_DEFAULT_SHARED="Yes"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_DEFAULT_SHARED, 1)
+fi
+AC_SUBST(CUPS_DEFAULT_SHARED)
+
+dnl Default ImplicitClasses
+AC_ARG_ENABLE(implicit, [ --enable-implicit-classes
+ enable ImplicitClasses by default, default=yes])
+if test "x$enable_implicit" = xno; then
+ CUPS_IMPLICIT_CLASSES="No"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 0)
+else
+ CUPS_IMPLICIT_CLASSES="Yes"
+ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IMPLICIT_CLASSES, 1)
+fi
+AC_SUBST(CUPS_IMPLICIT_CLASSES)
+
+
+dnl
+dnl End of "$Id$".
+dnl
dnl
-dnl "$Id: cups-sharedlibs.m4 4800 2005-10-18 18:06:20Z mike $"
+dnl "$Id: cups-sharedlibs.m4 5007 2006-01-27 18:25:42Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
LIBCUPS="libcups.2.dylib"
LIBCUPSIMAGE="libcupsimage.2.dylib"
DSO="\$(CC)"
- DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -lc"
+ DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -single_module -lc"
;;
AIX*)
LIBCUPS="libcups_s.a"
AC_SUBST(EXPORT_LDFLAGS)
dnl
-dnl End of "$Id: cups-sharedlibs.m4 4800 2005-10-18 18:06:20Z mike $".
+dnl End of "$Id: cups-sharedlibs.m4 5007 2006-01-27 18:25:42Z mike $".
dnl
/*
- * "$Id: config.h.in 4979 2006-01-25 17:47:43Z mike $"
+ * "$Id: config.h.in 5008 2006-01-27 19:30:34Z mike $"
*
* Configuration file for the Common UNIX Printing System (CUPS).
*
* @configure_input@
*
- * Copyright 1997-2005 by Easy Software Products.
+ * Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
/*
- * Default user and group...
+ * Default user and groups...
*/
#define CUPS_DEFAULT_USER "lp"
#define CUPS_DEFAULT_GROUP "sys"
+#define CUPS_DEFAULT_SYSTEM_GROUPS "sys root system"
+
+
+/*
+ * Default file permissions...
+ */
+
+#define CUPS_DEFAULT_CONFIG_FILE_PERM 0640
+#define CUPS_DEFAULT_LOG_FILE_PERM 0644
+
+
+/*
+ * Default browsing settings...
+ */
+
+#define CUPS_DEFAULT_BROWSING 1
+#define CUPS_DEFAULT_BROWSE_LOCAL_PROTOCOLS "CUPS"
+#define CUPS_DEFAULT_BROWSE_REMOTE_PROTOCOLS "CUPS"
+#define CUPS_DEFAULT_BROWSE_SHORT_NAMES 1
+#define CUPS_DEFAULT_DEFAULT_SHARED 1
+#define CUPS_DEFAULT_IMPLICIT_CLASSES 1
/*
#endif /* !_CUPS_CONFIG_H_ */
/*
- * End of "$Id: config.h.in 4979 2006-01-25 17:47:43Z mike $".
+ * End of "$Id: config.h.in 5008 2006-01-27 19:30:34Z mike $".
*/
dnl
-dnl "$Id: configure.in 4971 2006-01-24 14:33:18Z mike $"
+dnl "$Id: configure.in 5008 2006-01-27 19:30:34Z mike $"
dnl
dnl Configuration script for the Common UNIX Printing System (CUPS).
dnl
sinclude(config-scripts/cups-opsys.m4)
sinclude(config-scripts/cups-common.m4)
+sinclude(config-scripts/cups-defaults.m4)
sinclude(config-scripts/cups-directories.m4)
sinclude(config-scripts/cups-manpages.m4)
AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh cups-config
conf/cupsd.conf conf/pam.std doc/index.html
- doc/help/standard.html templates/edit-config.tmpl)
+ doc/help/standard.html templates/edit-config.tmpl
+ templates/header.tmpl)
chmod +x cups-config
dnl
-dnl End of "$Id: configure.in 4971 2006-01-24 14:33:18Z mike $".
+dnl End of "$Id: configure.in 5008 2006-01-27 19:30:34Z mike $".
dnl
</BLOCKQUOTE>
-<H2><A NAME="CUPSD">cupsd Configuration</A></H2>
+<H2 CLASS="title"><A NAME="CUPSD">cupsd Configuration</A></H2>
<P><CODE>cupsd(8)</CODE> is configured by default to show
printers shared by other systems and only allow local access to
(<VAR>@CUPS_DEFAULT_DOMAINSOCKET@</VAR>) or "localhost"
(127.0.0.1).</P>
+<H3><A NAME="SETTINGS">Settings</A></H3>
+
+<DIV CLASS="table"><TABLE WIDTH="80%">
+<TR>
+ <TH>Directive</TH>
+ <TH>Value</TH>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#Browsing">Browsing</A></CODE></TD>
+ <TD><CODE>@CUPS_BROWSING@</CODE></TD>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#BrowseLocalProtocols">BrowseLocalProtocols</A></CODE></TD>
+ <TD><CODE>@CUPS_BROWSE_LOCAL_PROTOCOLS@</CODE></TD>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#BrowseRemoteProtocols">BrowseRemoteProtocols</A></CODE></TD>
+ <TD><CODE>@CUPS_BROWSE_REMOTE_PROTOCOLS@</CODE></TD>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#BrowseShortNames">BrowseShortNames</A></CODE></TD>
+ <TD><CODE>@CUPS_BROWSE_SHORT_NAMES@</CODE></TD>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#ConfigFilePerm">ConfigFilePerm</A></CODE></TD>
+ <TD><CODE>@CUPS_CONFIG_FILE_PERM@</CODE></TD>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#DefaultShared">DefaultShared</A></CODE></TD>
+ <TD><CODE>@CUPS_DEFAULT_SHARED@</CODE></TD>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#ImplicitClasses">ImplicitClasses</A></CODE></TD>
+ <TD><CODE>@CUPS_IMPLICIT_CLASSES@</CODE></TD>
+</TR>
+<TR>
+ <TD><CODE><A HREF="cupsd-conf-reference.html#LogFilePerm">LogFilePerm</A></CODE></TD>
+ <TD><CODE>@CUPS_LOG_FILE_PERM@</CODE></TD>
+</TR>
+</TABLE></DIV>
-<H2><A NAME="DIRECTORIES">Directories</A></H2>
+
+<H2 CLASS="title"><A NAME="DIRECTORIES">Directories</A></H2>
<DIV CLASS="table"><TABLE WIDTH="80%">
<TR>
</TR>
</TABLE></DIV>
-
</BODY>
</HTML>
.\"
-.\" "$Id: lp.man 4948 2006-01-19 03:23:41Z mike $"
+.\" "$Id: lp.man 5010 2006-01-27 19:53:55Z mike $"
.\"
.\" lp/cancel man page for the Common UNIX Printing System (CUPS).
.\"
.br
Forces encryption when connecting to the server.
.TP 5
+\-U
+.br
+Specifies the username to use when connecting to the server.
+.TP 5
\-c
.br
This option is provided for backwards-compatibility only. On
Specifies an existing job to modify.
.TP 5
\-m
+.TP 5
+\-p
+.TP 5
+\-w
.br
-Send email when the job is completed (not supported CUPS 1.1.)
+Send email when the job is completed.
.TP 5
\-n \fIcopies\fR
.br
any printable character except SPACE and TAB. Also, printer and class names are
\fBnot\fR case-sensitive.
.LP
-The "m" option is not functional in CUPS 1.1.
-.LP
The "q" option accepts a different range of values than the
-Solaris lp command, matching the IPP job priority values (1-100)
-instead of the Solaris values (0-39).
+Solaris lp command, matching the IPP job priority values (1-100, 100 is
+highest priority) instead of the Solaris values (0-39, 0 is highest
+priority).
.SH NOTES
Administrators wishing to prevent unauthorized cancellation of
-jobs via the \fI-u\fR option should password-protect the /jobs
-location in \fIcupsd.conf(5)\fR.
+jobs via the \fI-u\fR option should require authentication for
+Cancel-Jobs operations in \fIcupsd.conf(5)\fR.
.SH SEE ALSO
lpstat(1),
.br
.SH COPYRIGHT
Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
.\"
-.\" End of "$Id: lp.man 4948 2006-01-19 03:23:41Z mike $".
+.\" End of "$Id: lp.man 5010 2006-01-27 19:53:55Z mike $".
.\"
.\"
-.\" "$Id: lprm.man 4948 2006-01-19 03:23:41Z mike $"
+.\" "$Id: lprm.man 5010 2006-01-27 19:53:55Z mike $"
.\"
.\" lprm man page for the Common UNIX Printing System (CUPS).
.\"
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
-.TH lprm 1 "Common UNIX Printing System" "18 January 2006" "Easy Software Products"
+.TH lprm 1 "Common UNIX Printing System" "27 January 2006" "Easy Software Products"
.SH NAME
lprm \- cancel print jobs
.SH SYNOPSIS
.I hostname[:port]
] [ -P
.I destination
-] [ - ] [
+] [ - ] [
.I job ID(s)
]
.SH DESCRIPTION
or use the \fI\-\fR option to cancel all jobs.
.LP
The \fI-E\fR option forces encryption when connecting to the server.
+.LP
+The \fI-U\fR option specifies the username to use when connecting to the server.
+.LP
+The \fI-h\fR option an alternate server to use.
.SH COMPATIBILITY
The CUPS version of \fIlprm\fR is compatible with the standard Berkeley
\fIlprm\fR command.
.SH COPYRIGHT
Copyright 1993-2006 by Easy Software Products, All Rights Reserved.
.\"
-.\" End of "$Id: lprm.man 4948 2006-01-19 03:23:41Z mike $".
+.\" End of "$Id: lprm.man 5010 2006-01-27 19:53:55Z mike $".
.\"
/usr/share/man/man8/reject.8.gz
%dir /var/cache/cups
-%dir /var/cache/cups/ppd
%dir /var/log/cups
%dir /var/run/cups
%attr(0711,lp,root) %dir /var/run/cups/certs
-%attr(0700,lp,root) %dir /var/spool/cups
-%attr(1700,lp,root) %dir /var/spool/cups/tmp
+%attr(0710,lp,root) %dir /var/spool/cups
+%attr(1770,lp,root) %dir /var/spool/cups/tmp
%files devel
%defattr(-,root,root)
/usr/bin/cups-config
%dir /usr/include/cups
/usr/include/cups/*
-/usr/lib/*.a
+#/usr/lib/*.a
/usr/lib/*.so
%dir /usr/share/doc/cups/help
#
-# "$Id: Makefile 5000 2006-01-26 23:38:43Z mike $"
+# "$Id: Makefile 5007 2006-01-27 18:25:42Z mike $"
#
# Scheduler Makefile for the Common UNIX Printing System (CUPS).
#
quotas.o \
server.o \
statbuf.o \
- subscriptions.o
+ subscriptions.o \
+ sysman.o
MIMEOBJS = \
filter.o \
mime.o \
cupsd: $(CUPSDOBJS) libmime.a ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) libmime.a \
- $(LIBZ) $(SSLLIBS) $(LIBSLP) $(PAMLIBS) $(LIBS) \
- $(LIBPAPER) $(LIBMALLOC)
+ $(LIBZ) $(SSLLIBS) $(LIBSLP) $(PAMLIBS) \
+ $(LIBPAPER) $(LIBMALLOC) $(CUPSDLIBS) $(LIBS)
cupsd-static: $(CUPSDOBJS) libmime.a ../cups/libcups.a
echo Linking $@...
$(CC) $(LDFLAGS) -o cupsd-static $(CUPSDOBJS) libmime.a \
$(LIBZ) $(SSLLIBS) $(LIBSLP) $(PAMLIBS) ../cups/libcups.a \
- $(COMMONLIBS) $(LIBZ) $(LIBPAPER) $(LIBMALLOC)
+ $(COMMONLIBS) $(LIBZ) $(LIBPAPER) $(LIBMALLOC) $(CUPSDLIBS)
#
#
-# End of "$Id: Makefile 5000 2006-01-26 23:38:43Z mike $".
+# End of "$Id: Makefile 5007 2006-01-27 18:25:42Z mike $".
#
/*
- * "$Id: conf.c 5001 2006-01-26 23:39:23Z mike $"
+ * "$Id: conf.c 5008 2006-01-27 19:30:34Z mike $"
*
* Configuration routines for the Common UNIX Printing System (CUPS).
*
* Numeric options...
*/
- ConfigFilePerm = 0640; /* TODO: Add configure option */
+ ConfigFilePerm = CUPS_DEFAULT_CONFIG_FILE_PERM;
DefaultAuthType = AUTH_BASIC;
JobRetryLimit = 5;
JobRetryInterval = 300;
FilterLimit = 0;
FilterNice = 0;
HostNameLookups = FALSE;
- ImplicitClasses = TRUE;
+ ImplicitClasses = CUPS_DEFAULT_IMPLICIT_CLASSES;
ImplicitAnyClasses = FALSE;
HideImplicitMembers = TRUE;
KeepAlive = TRUE;
KeepAliveTimeout = DEFAULT_KEEPALIVE;
ListenBackLog = SOMAXCONN;
- LogFilePerm = 0644;
+ LogFilePerm = CUPS_DEFAULT_LOG_FILE_PERM;
LogLevel = CUPSD_LOG_ERROR;
MaxClients = 100;
MaxClientsPerHost = 0;
BrowseInterval = DEFAULT_INTERVAL;
BrowsePort = ippPort();
- BrowseLocalProtocols = BROWSE_CUPS;
- BrowseRemoteProtocols = BROWSE_CUPS;
- BrowseShortNames = TRUE;
+ BrowseLocalProtocols = BROWSE_CUPS; /* TODO: Use configure option */
+ BrowseRemoteProtocols = BROWSE_CUPS; /* TODO: Use configure option */
+ BrowseShortNames = CUPS_DEFAULT_BROWSE_SHORT_NAMES;
BrowseTimeout = DEFAULT_TIMEOUT;
- Browsing = TRUE;
- DefaultShared = TRUE; /* TODO: Add configure option */
+ Browsing = CUPS_DEFAULT_BROWSING;
+ DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED;
cupsdClearString(&BrowseLocalOptions);
cupsdClearString(&BrowseRemoteOptions);
/*
- * End of "$Id: conf.c 5001 2006-01-26 23:39:23Z mike $".
+ * End of "$Id: conf.c 5008 2006-01-27 19:30:34Z mike $".
*/
/*
- * "$Id: cupsd.h 4903 2006-01-10 20:02:46Z mike $"
+ * "$Id: cupsd.h 5007 2006-01-27 18:25:42Z mike $"
*
* Main header file for the Common UNIX Printing System (CUPS) scheduler.
*
* Other stuff for the scheduler...
*/
+#include "sysman.h"
#include "statbuf.h"
#include "cert.h"
#include "auth.h"
/*
- * End of "$Id: cupsd.h 4903 2006-01-10 20:02:46Z mike $".
+ * End of "$Id: cupsd.h 5007 2006-01-27 18:25:42Z mike $".
*/
/*
- * "$Id: dirsvc.c 4906 2006-01-10 20:53:28Z mike $"
+ * "$Id: dirsvc.c 5008 2006-01-27 19:30:34Z mike $"
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)
{
- /*
- * Create the broadcast socket...
- */
-
- if ((BrowseSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if (BrowseSocket < 0)
{
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "cupsdStartBrowsing: Unable to create broadcast socket - %s.",
- strerror(errno));
- BrowseLocalProtocols &= ~BROWSE_CUPS;
- BrowseRemoteProtocols &= ~BROWSE_CUPS;
- return;
- }
+ /*
+ * Create the broadcast socket...
+ */
- /*
- * Set the "broadcast" flag...
- */
+ if ((BrowseSocket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "cupsdStartBrowsing: Unable to create broadcast "
+ "socket - %s.", strerror(errno));
+ BrowseLocalProtocols &= ~BROWSE_CUPS;
+ BrowseRemoteProtocols &= ~BROWSE_CUPS;
+ return;
+ }
- val = 1;
- if (setsockopt(BrowseSocket, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
- {
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "cupsdStartBrowsing: Unable to set broadcast mode - %s.",
- strerror(errno));
+ /*
+ * Bind the socket to browse port...
+ */
+
+ memset(&addr, 0, sizeof(addr));
+ addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ addr.sin_family = AF_INET;
+ addr.sin_port = htons(BrowsePort);
+
+ if (bind(BrowseSocket, (struct sockaddr *)&addr, sizeof(addr)))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "cupsdStartBrowsing: Unable to bind broadcast "
+ "socket - %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;
+ return;
+ }
}
/*
- * Bind the socket to browse port...
+ * Set the "broadcast" flag...
*/
- memset(&addr, 0, sizeof(addr));
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
- addr.sin_family = AF_INET;
- addr.sin_port = htons(BrowsePort);
-
- if (bind(BrowseSocket, (struct sockaddr *)&addr, sizeof(addr)))
+ val = 1;
+ if (setsockopt(BrowseSocket, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
{
cupsdLogMessage(CUPSD_LOG_ERROR,
- "cupsdStartBrowsing: Unable to bind broadcast socket - %s.",
+ "cupsdStartBrowsing: Unable to set broadcast mode - %s.",
strerror(errno));
#ifdef WIN32
if (!Browsing || !(BrowseLocalProtocols | BrowseRemoteProtocols))
return;
- if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS)
+ if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_CUPS) &&
+ BrowseSocket >= 0)
{
/*
* Close the socket and remove it from the input selection set.
*/
- if (BrowseSocket >= 0)
- {
#ifdef WIN32
- closesocket(BrowseSocket);
+ closesocket(BrowseSocket);
#else
- close(BrowseSocket);
+ close(BrowseSocket);
#endif /* WIN32 */
- cupsdLogMessage(CUPSD_LOG_DEBUG2,
- "cupsdStopBrowsing: Removing fd %d from InputSet...",
- BrowseSocket);
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdStopBrowsing: Removing fd %d from InputSet...",
+ BrowseSocket);
- FD_CLR(BrowseSocket, InputSet);
- BrowseSocket = -1;
- }
+ FD_CLR(BrowseSocket, InputSet);
+ BrowseSocket = -1;
}
#ifdef HAVE_LIBSLP
packet[bytes] = '\0';
+ /*
+ * If we're about to sleep, ignore incoming browse packets.
+ */
+
+ if (Sleeping)
+ return;
+
/*
* Figure out where it came from...
*/
/*
- * End of "$Id: dirsvc.c 4906 2006-01-10 20:53:28Z mike $".
+ * End of "$Id: dirsvc.c 5008 2006-01-27 19:30:34Z mike $".
*/
/*
- * "$Id: job.c 4992 2006-01-26 17:50:58Z mike $"
+ * "$Id: job.c 5007 2006-01-27 18:25:42Z mike $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
* Start pending jobs if the destination is available...
*/
- if (job->state->values[0].integer == IPP_JOB_PENDING && !NeedReload)
+ if (job->state->values[0].integer == IPP_JOB_PENDING && !NeedReload &&
+ !Sleeping)
{
printer = cupsdFindDest(job->dest);
pclass = NULL;
/*
- * End of "$Id: job.c 4992 2006-01-26 17:50:58Z mike $".
+ * End of "$Id: job.c 5007 2006-01-27 18:25:42Z mike $".
*/
/*
- * "$Id: main.c 4997 2006-01-26 21:43:54Z mike $"
+ * "$Id: main.c 5007 2006-01-27 18:25:42Z mike $"
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
* Relative directory...
*/
- char current[1024]; /* Current directory */
+ char *current; /* Current directory */
- getcwd(current, sizeof(current));
+ /*
+ * Allocate a buffer for the current working directory to
+ * reduce run-time stack usage; this approximates the
+ * behavior of some implementations of getcwd() when they
+ * are passed a NULL pointer.
+ */
+
+ current = malloc(1024);
+ getcwd(current, 1024);
+
cupsdSetStringf(&ConfigurationFile, "%s/%s", current, argv[i]);
+
+ free(current);
}
break;
kill(i, SIGUSR1);
}
+ /*
+ * Start power management framework...
+ */
+
+ cupsdStartSystemMonitor();
+
/*
* If the administrator has configured the server to run as an unpriviledged
* user, change to that user now...
cupsdLogMessage(CUPSD_LOG_EMERG, "CGIPipes[0] = %d", CGIPipes[0]);
+#ifdef __APPLE__
+ cupsdLogMessage(CUPSD_LOG_EMERG, "SysEventPipes[0] = %d",
+ SysEventPipes[0]);
+#endif /* __APPLE__ */
+
for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs);
job;
job = (cupsd_job_t *)cupsArrayNext(ActiveJobs))
if (CGIPipes[0] >= 0 && FD_ISSET(CGIPipes[0], input))
cupsdUpdateCGI();
+ /*
+ * Handle system management events as needed...
+ */
+
+#ifdef __APPLE__
+ if (SysEventPipes[0] >= 0 && FD_ISSET(SysEventPipes[0], input))
+ cupsdUpdateSystemMonitor();
+#endif /* __APPLE__ */
+
/*
* Update notifier messages as needed...
*/
cupsdStopAllJobs();
+ cupsdStopSystemMonitor();
+
#ifdef __sgi
/*
* Remove the fake IRIX lpsched lock file, but only if the existing
/*
- * End of "$Id: main.c 4997 2006-01-26 21:43:54Z mike $".
+ * End of "$Id: main.c 5007 2006-01-27 18:25:42Z mike $".
*/
--- /dev/null
+/*
+ * "$Id: sysman.c 5007 2006-01-27 18:25:42Z mike $"
+ *
+ * System management definitions for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636 USA
+ *
+ * Voice: (301) 373-9600
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ *
+ * Contents:
+ *
+ * cupsdStartSystemMonitor() - Start monitoring for system change.
+ * cupsdStopSystemMonitor() - Stop monitoring for system change.
+ * cupsdUpdateSystemMonitor() - Update the current system state.
+ * sysEventThreadEntry() - A thread to receive power and computer
+ * name change notifications.
+ * sysEventPowerNotifier() - Handle power notification events.
+ * sysEventConfigurationNotifier() - Computer name changed notification
+ * callback.
+ * sysEventTimerNotifier() - Handle delayed event notifications.
+ */
+
+
+/*
+ * Include necessary headers...
+ */
+
+#include "cupsd.h"
+
+
+/*
+ * Power management is a new addition to CUPS. Right now it is only
+ * implemented on MacOS X, but essentially we use these three functions
+ * to let the OS know when it is OK to put the system to sleep, typically
+ * when we are not in the middle of printing a job.
+ *
+ * Once put to sleep, we invalidate all remote printers since it is
+ * common to wake up in a new location.
+ */
+
+#ifndef __APPLE__
+/*
+ * 'cupsdStartSystemMonitor()' - Start monitoring for system change.
+ */
+
+void
+cupsdStartSystemMonitor(void)
+{
+}
+
+
+/*
+ * 'cupsdStopSystemMonitor()' - Stop monitoring for system change.
+ */
+
+void
+cupsdStopSystemMonitor(void)
+{
+}
+
+
+/*
+ * 'cupsdUpdateSystemMonitor()' - Update the current system state.
+ */
+
+void
+cupsdUpdateSystemMonitor(void)
+{
+}
+#endif /* !__APPLE__ */
+
+
+#ifdef __APPLE__
+/*
+ * This is the Apple-specific system event code. It works by creating
+ * a worker thread that waits for events from the OS and relays them
+ * to the main thread via a traditional pipe.
+ */
+
+/*
+ * Include MacOS-specific headers...
+ */
+
+# include <IOKit/IOKitLib.h>
+# include <IOKit/IOMessage.h>
+# include <IOKit/pwr_mgt/IOPMLib.h>
+# include <SystemConfiguration/SystemConfiguration.h>
+# include <pthread.h>
+
+
+/*
+ * Constants...
+ */
+
+#define SYSEVENT_CANSLEEP 0x1 /* Decide whether to allow sleep or not */
+#define SYSEVENT_WILLSLEEP 0x2 /* Computer will go to sleep */
+#define SYSEVENT_WOKE 0x4 /* Computer woke from sleep */
+#define SYSEVENT_NETCHANGED 0x8 /* Network changed */
+#define SYSEVENT_NAMECHANGED 0x10 /* Computer name changed */
+
+
+/*
+ * Structures...
+ */
+
+typedef struct cupsd_sysevent_s /*** System event data ****/
+{
+ unsigned char event; /* Event bit field */
+ io_connect_t powerKernelPort; /* Power context data */
+ long powerNotificationID; /* Power event data */
+} cupsd_sysevent_t;
+
+
+typedef struct cupsd_thread_data_s /*** Thread context data ****/
+{
+ cupsd_sysevent_t sysevent; /* System event */
+ CFRunLoopTimerRef timerRef; /* Timer to delay some change *
+ * notifications */
+} cupsd_thread_data_t;
+
+
+/*
+ * Local globals...
+ */
+
+static pthread_t SysEventThread = NULL;
+ /* Thread to host a runloop */
+static pthread_mutex_t SysEventThreadMutex = { 0 };
+ /* Coordinates access to shared gloabals */
+static pthread_cond_t SysEventThreadCond = { 0 };
+ /* Thread initialization complete condition */
+static CFRunLoopRef SysEventRunloop = NULL;
+ /* The runloop. Access must be protected! */
+static CFStringRef ComputerNameKey = NULL,
+ /* Computer name key */
+ NetworkGlobalKey = NULL,
+ /* Network global key */
+ HostNamesKey = NULL,
+ /* Host name key */
+ NetworkInterfaceKey = NULL;
+ /* Netowrk interface key */
+
+
+/*
+ * Local functions...
+ */
+
+static void *sysEventThreadEntry(void);
+static void sysEventPowerNotifier(void *context, io_service_t service,
+ natural_t messageType,
+ void *messageArgument);
+static void sysEventConfigurationNotifier(SCDynamicStoreRef store,
+ CFArrayRef changedKeys,
+ void *context);
+static void sysEventTimerNotifier(CFRunLoopTimerRef timer, void *context);
+#endif /* __APPLE__ */
+
+
+/*
+ * 'cupsdStartSystemMonitor()' - Start monitoring for system change.
+ */
+
+void
+cupsdStartSystemMonitor(void)
+{
+ int flags; /* fcntl flags on pipe */
+
+
+ if (cupsdOpenPipe(SysEventPipes))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "System event monitor pipe() failed - %s!",
+ strerror(errno));
+ return;
+ }
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdStartSystemMonitor: Adding fd %d to InputSet...",
+ SysEventPipes[0]);
+ FD_SET(SysEventPipes[0], InputSet);
+
+ /*
+ * Set non-blocking mode on the descriptor we will be receiving notification
+ * events on.
+ */
+
+ flags = fcntl(SysEventPipes[0], F_GETFL, 0);
+ fcntl(SysEventPipes[0], F_SETFL, flags | O_NONBLOCK);
+
+ /*
+ * Start the thread that runs the runloop...
+ */
+
+ pthread_mutex_init(&SysEventThreadMutex, NULL);
+ pthread_cond_init(&SysEventThreadCond, NULL);
+ pthread_create(&SysEventThread, NULL, (void *(*)())sysEventThreadEntry, NULL);
+}
+
+
+/*
+ * 'cupsdStopSystemMonitor()' - Stop monitoring for system change.
+ */
+
+void
+cupsdStopSystemMonitor(void)
+{
+ CFRunLoopRef rl; /* The event handler runloop */
+
+
+ if (SysEventThread)
+ {
+ /*
+ * Make sure the thread has completed it's initialization and
+ * stored it's runloop reference in the shared global.
+ */
+
+ pthread_mutex_lock(&SysEventThreadMutex);
+
+ if (!SysEventRunloop)
+ pthread_cond_wait(&SysEventThreadCond, &SysEventThreadMutex);
+
+ rl = SysEventRunloop;
+ SysEventRunloop = NULL;
+
+ pthread_mutex_unlock(&SysEventThreadMutex);
+
+ if (rl)
+ CFRunLoopStop(rl);
+
+ pthread_join(SysEventThread, NULL);
+ pthread_mutex_destroy(&SysEventThreadMutex);
+ pthread_cond_destroy(&SysEventThreadCond);
+ }
+
+ if (SysEventPipes[0] >= 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG2,
+ "cupsdStopSystemMonitor: Removing fd %d from InputSet...",
+ SysEventPipes[0]);
+
+ FD_CLR(SysEventPipes[0], InputSet);
+
+ cupsdClosePipe(SysEventPipes);
+ }
+}
+
+
+/*
+ * 'cupsdUpdateSystemMonitor()' - Update the current system state.
+ */
+
+void
+cupsdUpdateSystemMonitor(void)
+{
+ cupsd_sysevent_t sysevent; /* The system event */
+ cupsd_printer_t *p; /* Printer information */
+
+
+ /*
+ * Drain the event pipe...
+ */
+
+ while (read((int)SysEventPipes[0], &sysevent, sizeof(sysevent))
+ == sizeof(sysevent))
+ {
+ if (sysevent.event & SYSEVENT_CANSLEEP)
+ {
+ /*
+ * If there are any active printers cancel the sleep request...
+ */
+
+ for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
+ p;
+ p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ if (p->job)
+ break;
+
+ if (p)
+ {
+ cupsdLogMessage(CUPSD_LOG_INFO,
+ "System sleep canceled because printer %s is active",
+ p->name);
+ IOCancelPowerChange(sysevent.powerKernelPort,
+ sysevent.powerNotificationID);
+ }
+ else
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "System wants to sleep");
+ IOAllowPowerChange(sysevent.powerKernelPort,
+ sysevent.powerNotificationID);
+ }
+ }
+
+ if (sysevent.event & SYSEVENT_WILLSLEEP)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "System going to sleep");
+
+ Sleeping = 1;
+
+ cupsdStopAllJobs();
+
+ for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
+ p;
+ p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ {
+ if (p->type & CUPS_PRINTER_REMOTE)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "Deleting remote destination \"%s\"", p->name);
+ cupsArraySave(Printers);
+ cupsdDeletePrinter(p, 0);
+ cupsArrayRestore(Printers);
+ }
+ else
+ {
+ /* TODO: Possibly update when MDNS support is added? */
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "Deregistering local printer \"%s\"", p->name);
+ cupsdSendBrowseDelete(p);
+ }
+ }
+
+ IOAllowPowerChange(sysevent.powerKernelPort,
+ sysevent.powerNotificationID);
+ }
+
+ if (sysevent.event & SYSEVENT_WOKE)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "System woke from sleep");
+ IOAllowPowerChange(sysevent.powerKernelPort,
+ sysevent.powerNotificationID);
+ Sleeping = 0;
+ cupsdCheckJobs();
+ }
+
+ if (sysevent.event & SYSEVENT_NETCHANGED)
+ {
+ if (!Sleeping)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "System network configuration changed");
+
+ /*
+ * Force an update of the list of network interfaces in 2 seconds.
+ */
+
+ NetIFTime = time(NULL) - 58;
+
+ /*
+ * Resetting browse_time before calling cupsdSendBrowseList causes
+ * browse packets to be sent for local shared printers.
+ */
+
+ for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
+ p;
+ p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ p->browse_time = 0;
+
+ cupsdSendBrowseList();
+ }
+ else
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "System network configuration changed; "
+ "ignored while sleeping");
+ }
+
+ if (sysevent.event & SYSEVENT_NAMECHANGED)
+ {
+ if (!Sleeping)
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Computer name changed");
+
+ /*
+ * De-register the individual printers...
+ */
+
+ for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
+ p;
+ p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ cupsdSendBrowseDelete(p);
+
+ /*
+ * Now re-register them...
+ *
+ * TODO: This might need updating for MDNS.
+ */
+
+ for (p = (cupsd_printer_t *)cupsArrayFirst(Printers);
+ p;
+ p = (cupsd_printer_t *)cupsArrayNext(Printers))
+ p->browse_time = 0;
+ }
+ else
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "Computer name changed; ignored while sleeping");
+ }
+ }
+}
+
+
+/*
+ * 'sysEventThreadEntry()' - A thread to receive power and computer name
+ * change notifications.
+ */
+
+static void * /* O - Return status/value */
+sysEventThreadEntry(void)
+{
+ io_object_t powerNotifierObj;
+ /* Power notifier object */
+ IONotificationPortRef powerNotifierPort;
+ /* Power notifier port */
+ SCDynamicStoreRef store = NULL;/* System Config dynamic store */
+ CFRunLoopSourceRef powerRLS = NULL,/* Power runloop source */
+ storeRLS = NULL;/* System Config runloop source */
+ CFStringRef key[3], /* System Config keys */
+ pattern[1]; /* System Config patterns */
+ CFArrayRef keys = NULL, /* System Config key array*/
+ patterns = NULL;/* System Config pattern array */
+ SCDynamicStoreContext storeContext; /* Dynamic store context */
+ CFRunLoopTimerContext timerContext; /* Timer context */
+ cupsd_thread_data_t threadData; /* Thread context data for the *
+ * runloop notifiers */
+
+
+ /*
+ * Register for power state change notifications
+ */
+
+ bzero(&threadData, sizeof(threadData));
+
+ threadData.sysevent.powerKernelPort =
+ IORegisterForSystemPower(&threadData, &powerNotifierPort,
+ sysEventPowerNotifier, &powerNotifierObj);
+
+ if (threadData.sysevent.powerKernelPort)
+ {
+ powerRLS = IONotificationPortGetRunLoopSource(powerNotifierPort);
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), powerRLS, kCFRunLoopDefaultMode);
+ }
+ else
+ DEBUG_puts("sysEventThreadEntry: error registering for system power "
+ "notifications");
+
+ /*
+ * Register for system configuration change notifications
+ */
+
+ bzero(&storeContext, sizeof(storeContext));
+ storeContext.info = &threadData;
+
+ store = SCDynamicStoreCreate(NULL, CFSTR("cupsd"),
+ sysEventConfigurationNotifier, &storeContext);
+
+ if (!ComputerNameKey)
+ ComputerNameKey = SCDynamicStoreKeyCreateComputerName(NULL);
+
+ if (!NetworkGlobalKey)
+ NetworkGlobalKey =
+ SCDynamicStoreKeyCreateNetworkGlobalEntity(NULL,
+ kSCDynamicStoreDomainState,
+ kSCEntNetIPv4);
+
+ if (!HostNamesKey)
+ HostNamesKey = SCDynamicStoreKeyCreateHostNames(NULL);
+
+ if (!NetworkInterfaceKey)
+ NetworkInterfaceKey =
+ SCDynamicStoreKeyCreateNetworkInterfaceEntity(NULL,
+ kSCDynamicStoreDomainState,
+ kSCCompAnyRegex,
+ kSCEntNetIPv4);
+
+ if (store && ComputerNameKey && NetworkGlobalKey && HostNamesKey &&
+ NetworkInterfaceKey)
+ {
+ key[0] = ComputerNameKey;
+ key[1] = NetworkGlobalKey;
+ key[2] = HostNamesKey;
+ pattern[0] = NetworkInterfaceKey;
+
+ keys = CFArrayCreate(NULL, (const void **)key,
+ sizeof(key) / sizeof(key[0]),
+ &kCFTypeArrayCallBacks);
+ patterns = CFArrayCreate(NULL, (const void **)pattern,
+ sizeof(pattern) / sizeof(pattern[0]),
+ &kCFTypeArrayCallBacks);
+
+ if (keys && patterns &&
+ SCDynamicStoreSetNotificationKeys(store, keys, patterns))
+ {
+ if ((storeRLS = SCDynamicStoreCreateRunLoopSource(NULL, store, 0))
+ != NULL)
+ {
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), storeRLS,
+ kCFRunLoopDefaultMode);
+ }
+ else
+ DEBUG_printf(("sysEventThreadEntry: SCDynamicStoreCreateRunLoopSource "
+ "failed: %s\n", SCErrorString(SCError())));
+ }
+ else
+ DEBUG_printf(("sysEventThreadEntry: SCDynamicStoreSetNotificationKeys "
+ "failed: %s\n", SCErrorString(SCError())));
+ }
+ else
+ DEBUG_printf(("sysEventThreadEntry: SCDynamicStoreCreate failed: %s\n",
+ SCErrorString(SCError())));
+
+ if (keys)
+ CFRelease(keys);
+
+ if (patterns)
+ CFRelease(patterns);
+
+ /*
+ * Set up a timer to delay the wake change notifications.
+ *
+ * The initial time is set a decade or so into the future, we'll adjust
+ * this later.
+ */
+
+ bzero(&timerContext, sizeof(timerContext));
+ timerContext.info = &threadData;
+
+ threadData.timerRef =
+ CFRunLoopTimerCreate(NULL,
+ CFAbsoluteTimeGetCurrent() + (86400L * 365L * 10L),
+ 86400L * 365L * 10L, 0, 0, sysEventTimerNotifier,
+ &timerContext);
+ CFRunLoopAddTimer(CFRunLoopGetCurrent(), threadData.timerRef,
+ kCFRunLoopDefaultMode);
+
+ /*
+ * Store our runloop in a global so the main thread can use it to stop us.
+ */
+
+ pthread_mutex_lock(&SysEventThreadMutex);
+
+ SysEventRunloop = CFRunLoopGetCurrent();
+
+ pthread_cond_signal(&SysEventThreadCond);
+ pthread_mutex_unlock(&SysEventThreadMutex);
+
+ /*
+ * Disappear into the runloop until it's stopped by the main thread.
+ */
+
+ CFRunLoopRun();
+
+ /*
+ * Clean up before exiting.
+ */
+
+ if (threadData.timerRef)
+ {
+ CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), threadData.timerRef,
+ kCFRunLoopDefaultMode);
+ CFRelease(threadData.timerRef);
+ }
+
+ if (threadData.sysevent.powerKernelPort)
+ {
+ CFRunLoopRemoveSource(CFRunLoopGetCurrent(), powerRLS,
+ kCFRunLoopDefaultMode);
+ IODeregisterForSystemPower(&powerNotifierObj);
+ IOServiceClose(threadData.sysevent.powerKernelPort);
+ IONotificationPortDestroy(powerNotifierPort);
+ }
+
+ if (storeRLS)
+ {
+ CFRunLoopRemoveSource(CFRunLoopGetCurrent(), storeRLS,
+ kCFRunLoopDefaultMode);
+ CFRunLoopSourceInvalidate(storeRLS);
+ CFRelease(storeRLS);
+ }
+
+ if (store)
+ CFRelease(store);
+
+ pthread_exit(NULL);
+}
+
+
+/*
+ * 'sysEventPowerNotifier()' - Handle power notification events.
+ */
+
+static void
+sysEventPowerNotifier(
+ void *context, /* I - Thread context data */
+ io_service_t service, /* I - Unused service info */
+ natural_t messageType, /* I - Type of message */
+ void *messageArgument) /* I - Message data */
+{
+ int sendit = 1; /* Send event to main thread? *
+ * (0 = no, 1 = yes, 2 = delayed */
+ cupsd_thread_data_t *threadData; /* Thread context data */
+
+
+ threadData = (cupsd_thread_data_t *)context;
+
+ (void)service; /* anti-compiler-warning-code */
+
+ switch (messageType)
+ {
+ case kIOMessageCanSystemPowerOff:
+ case kIOMessageCanSystemSleep:
+ threadData->sysevent.event |= SYSEVENT_CANSLEEP;
+ break;
+
+ case kIOMessageSystemWillRestart:
+ case kIOMessageSystemWillPowerOff:
+ case kIOMessageSystemWillSleep:
+ threadData->sysevent.event |= SYSEVENT_WILLSLEEP;
+ break;
+
+ case kIOMessageSystemHasPoweredOn:
+ /*
+ * Because powered on is followed by a net-changed event, delay
+ * before sending it.
+ */
+
+ sendit = 2;
+ threadData->sysevent.event |= SYSEVENT_WOKE;
+ break;
+
+ case kIOMessageSystemWillNotPowerOff:
+ case kIOMessageSystemWillNotSleep:
+ case kIOMessageSystemWillPowerOn:
+ default:
+ sendit = 0;
+ break;
+ }
+
+ if (sendit == 0)
+ IOAllowPowerChange(threadData->sysevent.powerKernelPort,
+ (long)messageArgument);
+ else
+ {
+ threadData->sysevent.powerNotificationID = (long)messageArgument;
+
+ if (sendit == 1)
+ {
+ /*
+ * Send the event to the main thread now.
+ */
+
+ write(SysEventPipes[1], &threadData->sysevent,
+ sizeof(threadData->sysevent));
+ threadData->sysevent.event = 0;
+ }
+ else
+ {
+ /*
+ * Send the event to the main thread after 1 to 2 seconds.
+ */
+
+ CFRunLoopTimerSetNextFireDate(threadData->timerRef,
+ CFAbsoluteTimeGetCurrent() + 2);
+ }
+ }
+}
+
+
+/*
+ * 'sysEventConfigurationNotifier()' - Computer name changed notification
+ * callback.
+ */
+
+static void
+sysEventConfigurationNotifier(
+ SCDynamicStoreRef store, /* I - System data (unused) */
+ CFArrayRef changedKeys, /* I - Changed data */
+ void *context) /* I - Thread context data */
+{
+ cupsd_thread_data_t *threadData; /* Thread context data */
+
+
+ threadData = (cupsd_thread_data_t *)context;
+
+ (void)store; /* anti-compiler-warning-code */
+
+ CFRange range = CFRangeMake(0, CFArrayGetCount(changedKeys));
+
+ if (CFArrayContainsValue(changedKeys, range, ComputerNameKey))
+ threadData->sysevent.event |= SYSEVENT_NAMECHANGED;
+
+ if (CFArrayContainsValue(changedKeys, range, NetworkGlobalKey) ||
+ CFArrayContainsValue(changedKeys, range, HostNamesKey) ||
+ CFArrayContainsValue(changedKeys, range, NetworkInterfaceKey))
+ threadData->sysevent.event |= SYSEVENT_NETCHANGED;
+
+ /*
+ * Because we registered for several different kinds of change notifications
+ * this callback usually gets called several times in a row. We use a timer to
+ * de-bounce these so we only end up generating one event for the main thread.
+ */
+
+ CFRunLoopTimerSetNextFireDate(threadData->timerRef,
+ CFAbsoluteTimeGetCurrent() + 2);
+}
+
+
+/*
+ * 'sysEventTimerNotifier()' - Handle delayed event notifications.
+ */
+
+static void
+sysEventTimerNotifier(
+ CFRunLoopTimerRef timer, /* I - Timer information */
+ void *context) /* I - Thread context data */
+{
+ cupsd_thread_data_t *threadData; /* Thread context data */
+
+
+ threadData = (cupsd_thread_data_t *)context;
+
+ /*
+ * If an event is still pending send it to the main thread.
+ */
+
+ if (threadData->sysevent.event)
+ {
+ write(SysEventPipes[1], &threadData->sysevent,
+ sizeof(threadData->sysevent));
+ threadData->sysevent.event = 0;
+ }
+}
+
+
+/*
+ * End of "$Id: sysman.c 5007 2006-01-27 18:25:42Z mike $".
+ */
--- /dev/null
+/*
+ * "$Id: sysman.h 5007 2006-01-27 18:25:42Z mike $"
+ *
+ * System management definitions for the Common UNIX Printing System (CUPS).
+ *
+ * Copyright 2006 by Easy Software Products.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Easy Software Products and are protected by Federal
+ * copyright law. Distribution and use rights are outlined in the file
+ * "LICENSE.txt" which should have been included with this file. If this
+ * file is missing or damaged please contact Easy Software Products
+ * at:
+ *
+ * Attn: CUPS Licensing Information
+ * Easy Software Products
+ * 44141 Airport View Drive, Suite 204
+ * Hollywood, Maryland 20636 USA
+ *
+ * Voice: (301) 373-9600
+ * EMail: cups-info@cups.org
+ * WWW: http://www.cups.org
+ */
+
+/*
+ * Globals...
+ */
+
+VAR int Sleeping VALUE(0);
+ /* Non-zero if machine is entering or *
+ * in a sleep state... */
+#ifdef __APPLE__
+VAR int SysEventPipes[2] VALUE2(-1,-1);
+ /* System event notification pipes */
+#endif /* __APPLE__ */
+
+
+/*
+ * Prototypes...
+ */
+
+extern void cupsdStartSystemMonitor(void);
+extern void cupsdStopSystemMonitor(void);
+extern void cupsdUpdateSystemMonitor(void);
+
+
+/*
+ * End of "$Id: sysman.h 5007 2006-01-27 18:25:42Z mike $".
+ */
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
- <TITLE>{title} - {cups_version}</TITLE>
+ <TITLE>{title} - @CUPS_VERSION@</TITLE>
<!-- Prevent caching of CGI content -->
<META HTTP-EQUIV="Expires" CONTENT="now">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
mkdir -p $pkgdir/Package
mkdir -p $pkgdir/Resources
-# Install CUPS into the Package directory...
-#make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
-make BUILDROOT=$pkgdir/Package install
-
# Install resource files into the Resources directory...
echo Installing resource files...
cp packaging/LICENSE.rtf $pkgdir/Resources/ReadMe.rtf
<packaging/cups-info.plist.in >packaging/cups-info.plist
sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
<doc/index.html.in >doc/index.html
+sed -e '1,$s/@CUPS_VERSION@/1.2svn-r'$rev'/g' \
+ <templates/header.tmpl.in >templates/header.tmpl
+
+# Install CUPS into the Package directory...
+#make INSTALL=$topdir/install-sh BUILDROOT=$pkgdir/Package install
+make BUILDROOT=$pkgdir/Package install
# Figure out where PackageMaker is installled...
if test -d /Developer/Applications/Utilities/PackageMaker.app; then