Merge branch 'f21'

This commit is contained in:
Tim Waugh 2014-11-06 14:48:42 +00:00
commit 8955d8cc4e
3 changed files with 491 additions and 316 deletions

View File

@ -1,6 +1,6 @@
diff -up cups-2.0rc1/conf/cups-files.conf.in.journal cups-2.0rc1/conf/cups-files.conf.in
--- cups-2.0rc1/conf/cups-files.conf.in.journal 2014-03-03 17:46:23.000000000 +0100
+++ cups-2.0rc1/conf/cups-files.conf.in 2014-09-12 17:47:14.668190332 +0200
diff -up cups-2.0.0/conf/cups-files.conf.in.journal cups-2.0.0/conf/cups-files.conf.in
--- cups-2.0.0/conf/cups-files.conf.in.journal 2014-03-03 16:46:23.000000000 +0000
+++ cups-2.0.0/conf/cups-files.conf.in 2014-11-06 14:10:21.874448772 +0000
@@ -28,9 +28,10 @@ SystemGroup @CUPS_SYSTEM_GROUPS@
#ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@
#LogFilePerm 0@CUPS_LOG_FILE_PERM@
@ -15,7 +15,7 @@ diff -up cups-2.0rc1/conf/cups-files.conf.in.journal cups-2.0rc1/conf/cups-files
AccessLog @CUPS_LOGDIR@/access_log
# Location of cache files used by the scheduler...
@@ -42,10 +43,10 @@ AccessLog @CUPS_LOGDIR@/access_log
@@ -42,11 +43,11 @@ AccessLog @CUPS_LOGDIR@/access_log
# Location of the static web content served by the scheduler...
#DocumentRoot @CUPS_DOCROOT@
@ -23,13 +23,15 @@ diff -up cups-2.0rc1/conf/cups-files.conf.in.journal cups-2.0rc1/conf/cups-files
-# helper programs; may be the name "syslog". If not an absolute path, the value
-# of ServerRoot is used as the root directory. Also see the "LogLevel"
-# directive in cupsd.conf.
-ErrorLog @CUPS_LOGDIR@/error_log
+# Location of the file logging all messages produced by the scheduler
+# and any helper programs; may be the name "syslog" or "journal". If
+# not an absolute path, the value of ServerRoot is used as the root
+# directory. Also see the "LogLevel" # directive in cupsd.conf.
ErrorLog @CUPS_LOGDIR@/error_log
+ErrorLog journal
# Location of fonts used by older print filters...
#FontPath @CUPS_FONTPATH@
@@ -54,10 +55,10 @@ ErrorLog @CUPS_LOGDIR@/error_log
# Location of LPD configuration
#LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@
@ -45,57 +47,29 @@ diff -up cups-2.0rc1/conf/cups-files.conf.in.journal cups-2.0rc1/conf/cups-files
PageLog @CUPS_LOGDIR@/page_log
# Location of the file listing all of the local printers...
diff -up cups-2.0rc1/config.h.in.journal cups-2.0rc1/config.h.in
--- cups-2.0rc1/config.h.in.journal 2014-08-30 03:51:22.000000000 +0200
+++ cups-2.0rc1/config.h.in 2014-09-12 17:47:14.668190332 +0200
@@ -470,6 +470,13 @@
/*
+ * Do we have systemd-journal support?
+ */
+
+#undef HAVE_JOURNAL
+
+
+/*
* Various scripting languages...
*/
diff -up cups-2.0rc1/config-scripts/cups-startup.m4.journal cups-2.0rc1/config-scripts/cups-startup.m4
--- cups-2.0rc1/config-scripts/cups-startup.m4.journal 2014-03-27 02:15:48.000000000 +0100
+++ cups-2.0rc1/config-scripts/cups-startup.m4 2014-09-12 17:48:58.435737311 +0200
@@ -15,8 +15,10 @@ dnl
ONDEMANDFLAGS=""
ONDEMANDLIBS=""
+SDJLIBS=""
AC_SUBST(ONDEMANDFLAGS)
AC_SUBST(ONDEMANDLIBS)
+AC_SUBST(SDJLIBS)
dnl Launchd is used on OS X/Darwin...
AC_ARG_ENABLE(launchd, [ --disable-launchd disable launchd support])
@@ -71,6 +73,15 @@ if test x$enable_systemd != xno; then
fi
fi
+AC_MSG_CHECKING(for libsystemd-journal)
+if $PKGCONFIG --exists libsystemd-journal; then
+ AC_MSG_RESULT(yes)
+ SDJLIBS=`$PKGCONFIG --libs libsystemd-journal`
+ AC_DEFINE(HAVE_JOURNAL)
+else
+ AC_MSG_RESULT(no)
+fi
+
dnl Solaris uses smf
SMFMANIFESTDIR=""
AC_SUBST(SMFMANIFESTDIR)
diff -up cups-2.0rc1/doc/help/man-cups-files.conf.html.journal cups-2.0rc1/doc/help/man-cups-files.conf.html
--- cups-2.0rc1/doc/help/man-cups-files.conf.html.journal 2014-06-13 02:01:23.000000000 +0200
+++ cups-2.0rc1/doc/help/man-cups-files.conf.html 2014-09-12 17:47:14.669190318 +0200
@@ -24,9 +24,11 @@ The following directives are understood
diff -up cups-2.0.0/config-scripts/cups-startup.m4.journal cups-2.0.0/config-scripts/cups-startup.m4
--- cups-2.0.0/config-scripts/cups-startup.m4.journal 2014-03-27 01:15:48.000000000 +0000
+++ cups-2.0.0/config-scripts/cups-startup.m4 2014-11-06 14:10:00.186328322 +0000
@@ -56,11 +56,11 @@ if test x$enable_systemd != xno; then
AC_MSG_ERROR(Need pkg-config to enable systemd support.)
fi
else
- AC_MSG_CHECKING(for libsystemd-daemon)
- if $PKGCONFIG --exists libsystemd-daemon; then
+ AC_MSG_CHECKING(for libsystemd)
+ if $PKGCONFIG --exists libsystemd; then
AC_MSG_RESULT(yes)
- ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
- ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
+ ONDEMANDFLAGS=`$PKGCONFIG --cflags libsystemd`
+ ONDEMANDLIBS=`$PKGCONFIG --libs libsystemd`
AC_DEFINE(HAVE_SYSTEMD)
if test "x$SYSTEMD_DIR" = x; then
SYSTEMD_DIR="`$PKGCONFIG --variable=systemdsystemunitdir systemd`"
diff -up cups-2.0.0/doc/help/man-cups-files.conf.html.journal cups-2.0.0/doc/help/man-cups-files.conf.html
--- cups-2.0.0/doc/help/man-cups-files.conf.html.journal 2014-06-13 01:01:23.000000000 +0100
+++ cups-2.0.0/doc/help/man-cups-files.conf.html 2014-11-06 14:10:00.187328328 +0000
@@ -24,6 +24,7 @@ The following directives are understood
<dt><b>AccessLog</b>
<dd style="margin-left: 5.0em"><dt><b>AccessLog </b><i>filename</i>
<dd style="margin-left: 5.0em"><dt><b>AccessLog syslog</b>
@ -103,11 +77,7 @@ diff -up cups-2.0rc1/doc/help/man-cups-files.conf.html.journal cups-2.0rc1/doc/h
<dd style="margin-left: 5.0em">Defines the access log filename.
Specifying a blank filename disables access log generation.
The value "syslog" causes log entries to be sent to the system log daemon.
+The value "journal" causes access information to be sent to the system log instead of a plain file.
The server name may be included in filenames using the string "%s", for example:
<pre class="man">
@@ -51,9 +53,12 @@ The default is usually "/usr/share/doc/c
@@ -51,6 +52,7 @@ The default is usually "/usr/share/doc/c
<dt><b>ErrorLog</b>
<dd style="margin-left: 5.0em"><dt><b>ErrorLog </b><i>filename</i>
<dd style="margin-left: 5.0em"><dt><b>ErrorLog syslog</b>
@ -115,38 +85,18 @@ diff -up cups-2.0rc1/doc/help/man-cups-files.conf.html.journal cups-2.0rc1/doc/h
<dd style="margin-left: 5.0em">Defines the error log filename.
Specifying a blank filename disables error log generation.
The value "syslog" causes log entries to be sent to the system log daemon.
+The value "journal" causes error information to be sent to the system journal instead of a plain file.
+Information relating to a specific job is logged with the field <CODE>CUPS_JOB_ID</CODE> filled in.
The server name may be included in filenames using the string "%s", for example:
<pre class="man">
@@ -96,8 +101,11 @@ The default group is operating system sp
@@ -96,6 +98,7 @@ The default group is operating system sp
The default is "0644".
<dt><b>PageLog </b>[ <i>filename</i> ]
<dd style="margin-left: 5.0em"><dt><b>PageLog syslog</b>
+<dd style="margin-left: 5.0em"><dt><b>PageLog journal</b>
<dd style="margin-left: 5.0em">Defines the page log filename.
The value "syslog" causes log entries to be sent to the system log daemon.
+The value "journal" causes the page information to be sent to the system journal instead of a plain file.
+The fields <CODE>CUPS_JOB_ID</CODE> and <CODE>CUPS_PAGE_NUMBER</CODE> will be filled in.
Specifying a blank filename disables page log generation.
The server name may be included in filenames using the string "%s", for example:
<pre class="man">
diff -up cups-2.0rc1/Makedefs.in.journal cups-2.0rc1/Makedefs.in
--- cups-2.0rc1/Makedefs.in.journal 2014-09-12 17:47:14.617191046 +0200
+++ cups-2.0rc1/Makedefs.in 2014-09-12 17:47:14.669190318 +0200
@@ -148,6 +148,7 @@ LINKCUPSIMAGE = @LINKCUPSIMAGE@
LIBS = $(LINKCUPS) $(COMMONLIBS)
ONDEMANDFLAGS = @ONDEMANDFLAGS@
ONDEMANDLIBS = @ONDEMANDLIBS@
+SDJLIBS = @SDJLIBS@
OPTIM = @OPTIM@
OPTIONS =
PAMLIBS = @PAMLIBS@
diff -up cups-2.0rc1/man/cups-files.conf.man.in.journal cups-2.0rc1/man/cups-files.conf.man.in
--- cups-2.0rc1/man/cups-files.conf.man.in.journal 2014-06-13 02:01:23.000000000 +0200
+++ cups-2.0rc1/man/cups-files.conf.man.in 2014-09-12 17:47:14.669190318 +0200
@@ -33,9 +33,12 @@ The following directives are understood
diff -up cups-2.0.0/man/cups-files.conf.man.in.journal cups-2.0.0/man/cups-files.conf.man.in
--- cups-2.0.0/man/cups-files.conf.man.in.journal 2014-06-13 01:01:23.000000000 +0100
+++ cups-2.0.0/man/cups-files.conf.man.in 2014-11-06 14:10:00.187328328 +0000
@@ -33,9 +33,13 @@ The following directives are understood
\fBAccessLog \fIfilename\fR
.TP 5
\fBAccessLog syslog\fR
@ -154,12 +104,14 @@ diff -up cups-2.0rc1/man/cups-files.conf.man.in.journal cups-2.0rc1/man/cups-fil
+\fBAccessLog journal\fR
Defines the access log filename.
Specifying a blank filename disables access log generation.
The value "syslog" causes log entries to be sent to the system log daemon.
+The value "journal" causes access information to be sent to the system log instead of a plain file.
-The value "syslog" causes log entries to be sent to the system log daemon.
+The value "syslog" causes log entries to be sent to the system log
+daemon. The value "journal" causes log entries to be sent to the
+systemd journal.
The server name may be included in filenames using the string "%s", for example:
.nf
@@ -65,9 +68,13 @@ The default is usually "/usr/share/doc/c
@@ -65,9 +69,13 @@ The default is usually "/usr/share/doc/c
\fBErrorLog \fIfilename\fR
.TP 5
\fBErrorLog syslog\fR
@ -167,28 +119,30 @@ diff -up cups-2.0rc1/man/cups-files.conf.man.in.journal cups-2.0rc1/man/cups-fil
+\fBErrorLog journal\fR
Defines the error log filename.
Specifying a blank filename disables error log generation.
The value "syslog" causes log entries to be sent to the system log daemon.
+The value "journal" causes error information to be sent to the system journal instead of a plain file.
+Information relating to a specific job is logged with the field \fICUPS_JOB_ID\fR filled in.
-The value "syslog" causes log entries to be sent to the system log daemon.
+The value "syslog" causes log entries to be sent to the system log
+daemon. The value "journal" causes log entries to be sent to the
+systemd journal.
The server name may be included in filenames using the string "%s", for example:
.nf
@@ -125,8 +132,12 @@ The default is "0644".
@@ -125,8 +133,12 @@ The default is "0644".
\fBPageLog \fR[ \fIfilename\fR ]
.TP 5
\fBPageLog syslog\fR
+.TP 5
+\fBPageLog journal\fR
Defines the page log filename.
The value "syslog" causes log entries to be sent to the system log daemon.
+The value "journal" causes the page information to be sent to the system journal instead of a plain file.
+The fields \fICUPS_JOB_ID\fR and \fICUPS_PAGE_NUMBER\fR will be filled in.
-The value "syslog" causes log entries to be sent to the system log daemon.
+The value "syslog" causes log entries to be sent to the system log
+daemon. The value "journal" causes log entries to be sent to the
+systemd journal.
Specifying a blank filename disables page log generation.
The server name may be included in filenames using the string "%s", for example:
.nf
diff -up cups-2.0rc1/scheduler/conf.c.journal cups-2.0rc1/scheduler/conf.c
--- cups-2.0rc1/scheduler/conf.c.journal 2014-09-12 17:47:14.563191802 +0200
+++ cups-2.0rc1/scheduler/conf.c 2014-09-12 17:47:14.670190304 +0200
diff -up cups-2.0.0/scheduler/conf.c.journal cups-2.0.0/scheduler/conf.c
--- cups-2.0.0/scheduler/conf.c.journal 2014-11-06 14:10:00.132328022 +0000
+++ cups-2.0.0/scheduler/conf.c 2014-11-06 14:10:00.187328328 +0000
@@ -950,9 +950,9 @@ cupsdReadConfiguration(void)
*/
@ -219,68 +173,309 @@ diff -up cups-2.0rc1/scheduler/conf.c.journal cups-2.0rc1/scheduler/conf.c
cupsdCheckLogFile(&PageFile, PageLog);
/*
diff -up cups-2.0rc1/scheduler/conf.h.journal cups-2.0rc1/scheduler/conf.h
--- cups-2.0rc1/scheduler/conf.h.journal 2014-09-12 17:47:14.563191802 +0200
+++ cups-2.0rc1/scheduler/conf.h 2014-09-12 17:47:14.671190290 +0200
@@ -298,6 +298,8 @@ extern int cupsdLogMessage(int level, co
diff -up cups-2.0.0/scheduler/conf.h.journal cups-2.0.0/scheduler/conf.h
--- cups-2.0.0/scheduler/conf.h.journal 2014-11-06 14:10:00.132328022 +0000
+++ cups-2.0.0/scheduler/conf.h 2014-11-06 14:10:00.188328333 +0000
@@ -291,16 +291,69 @@ extern int cupsdLogGSSMessage(int level,
OM_uint32 minor_status,
const char *message, ...);
#endif /* HAVE_GSSAPI */
-extern int cupsdLogJob(cupsd_job_t *job, int level, const char *message,
- ...) __attribute__((__format__(__printf__, 3, 4)));
-extern int cupsdLogMessage(int level, const char *message, ...)
- __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int _cupsdLogJobWithLocation(const char *file,
+ const char *line,
+ const char *func,
+ cupsd_job_t *job,
+ int level,
+ const char *message,
+ ...)
+ __attribute__((__format__(__printf__, 6, 7)));
+extern int _cupsdLogMessageWithLocation(const char *file,
+ const char *line,
+ const char *func,
+ int level,
+ const char *message,
+ ...)
+ __attribute__ ((__format__ (__printf__, 5, 6)));
extern int cupsdLogPage(cupsd_job_t *job, const char *page);
extern int cupsdLogRequest(cupsd_client_t *con, http_status_t code);
extern int cupsdReadConfiguration(void);
+extern int cupsdWriteErrorLogJob(cupsd_job_t *job, int level,
+ const char *message);
extern int cupsdWriteErrorLog(int level, const char *message);
-extern int cupsdWriteErrorLog(int level, const char *message);
+extern int _cupsdWriteErrorLogJobWithLocation(const char *file,
+ const char *line,
+ const char *func,
+ cupsd_job_t *job,
+ int level,
+ const char *message);
+extern int _cupsdWriteErrorLogWithLocation(const char *file,
+ const char *line,
+ const char *func,
+ int level, const char *message);
diff -up cups-2.0rc1/scheduler/log.c.journal cups-2.0rc1/scheduler/log.c
--- cups-2.0rc1/scheduler/log.c.journal 2014-09-12 17:47:14.599191298 +0200
+++ cups-2.0rc1/scheduler/log.c 2014-09-12 17:47:14.671190290 +0200
@@ -23,6 +23,9 @@
+#ifndef _CUPSD_STRINGIFY
+#define _CUPSD_XSTRINGIFY(x) #x
+#define _CUPSD_STRINGIFY(x) _CUPSD_XSTRINGIFY(x)
+#endif /* !defined(_CUPSD_STRINGIFY) */
+
+#define cupsdLogJob(...) \
+ _cupsdLogJobWithLocation("CODE_FILE=" __FILE__, \
+ "CODE_LINE=" \
+ _CUPSD_STRINGIFY(__LINE__), \
+ __func__, \
+ __VA_ARGS__)
+
+#define cupsdLogMessage(...) \
+ _cupsdLogMessageWithLocation("CODE_FILE=" __FILE__, \
+ "CODE_LINE=" \
+ _CUPSD_STRINGIFY(__LINE__), \
+ __func__, \
+ __VA_ARGS__)
+
+#define cupsdWriteErrorLogJob(...) \
+ _cupsdWriteErrorLogJobWithLocation("CODE_FILE=" __FILE__, \
+ "CODE_LINE=" \
+ _CUPSD_STRINGIFY(__LINE__), \
+ __func__, \
+ __VA_ARGS__)
+
+#define cupsdWriteErrorLog(...) \
+ _cupsdWriteErrorLogWithLocation("CODE_FILE=" __FILE__, \
+ "CODE_LINE=" \
+ _CUPSD_STRINGIFY(__LINE__), \
+ __func__, \
+ __VA_ARGS__)
+
/*
* End of "$Id: conf.h 11789 2014-04-02 16:52:53Z msweet $".
*/
diff -up cups-2.0.0/scheduler/log.c.journal cups-2.0.0/scheduler/log.c
--- cups-2.0.0/scheduler/log.c.journal 2014-11-06 14:10:00.154328144 +0000
+++ cups-2.0.0/scheduler/log.c 2014-11-06 14:10:00.188328333 +0000
@@ -23,6 +23,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#ifdef HAVE_JOURNAL
+#include <sys/uio.h>
+#ifdef HAVE_SYSTEMD
+/* We handle location fields ourselves */
+# define SD_JOURNAL_SUPPRESS_LOCATION
+# include <systemd/sd-journal.h>
+#endif /* HAVE_JOURNAL */
+#endif /* HAVE_SYSTEMD */
/*
@@ -603,8 +606,17 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
@@ -509,15 +515,135 @@ cupsdLogClient(cupsd_client_t *con, /* I
}
+#ifdef HAVE_SYSTEMD
+static int
+dup_iovec_string(struct iovec *vec,
+ const char *str)
+{
+ vec->iov_base = strdup (str);
+ vec->iov_len = strlen (str);
+ return (vec->iov_base ? 1 : 0);
+}
+
+
+/*
+ * '_cupsdLogToJournal()' - Log to journal with fields
+ */
+static int /* O - 1 on success, 0 on error */
+_cupsdLogToJournal(const char *file, /* I - Code file */
+ const char *line, /* I - Code line */
+ const char *func, /* I - Code func */
+ cupsd_job_t *job, /* I - Job or NULL */
+ int level, /* I - Log level */
+ const char *message)/* I - Formatted message */
+{
+ size_t n_journal_fields;
+ struct iovec *journal_fields = NULL;
+ char buffer[256];
+ int result = 1;
+
+ /*
+ * There will be at least 5 fields:
+ * CODE_FILE, CODE_LINE, CODE_FUNC, MESSAGE, PRIORITY
+ */
+
+ n_journal_fields = 5;
+
+ if (job)
+ {
+ n_journal_fields++; /* CUPS_JOB_ID */
+
+ if (job->dest)
+ n_journal_fields++; /* CUPS_DEST */
+
+ if (job->printer)
+ n_journal_fields++; /* CUPS_PRINTER */
+ }
+
+ journal_fields = calloc (n_journal_fields, sizeof (struct iovec));
+ if (!journal_fields)
+ return (0);
+
+ n_journal_fields = 0;
+
+ result = dup_iovec_string (&journal_fields[n_journal_fields], file);
+
+ if (result)
+ {
+ n_journal_fields++;
+ result = dup_iovec_string (&journal_fields[n_journal_fields], line);
+ }
+
+ if (result)
+ {
+ n_journal_fields++;
+ snprintf (buffer, sizeof (buffer), "CODE_FUNC=%s", func);
+ result = dup_iovec_string (&journal_fields[n_journal_fields], buffer);
+ }
+
+ if (result)
+ {
+ n_journal_fields++;
+ snprintf (buffer, sizeof (buffer), "MESSAGE=%s", log_line);
+ result = dup_iovec_string (&journal_fields[n_journal_fields], buffer);
+ }
+
+ if (result)
+ {
+ n_journal_fields++;
+ snprintf (buffer, sizeof (buffer), "PRIORITY=%i", syslevels[level]);
+ result = dup_iovec_string (&journal_fields[n_journal_fields], buffer);
+ }
+
+ if (result && job)
+ {
+ n_journal_fields++;
+ snprintf (buffer, sizeof (buffer), "CUPS_JOB_ID=%d", job->id);
+ result = dup_iovec_string (&journal_fields[n_journal_fields], buffer);
+
+ if (result && job->dest)
+ {
+ n_journal_fields++;
+ snprintf (buffer, sizeof (buffer), "CUPS_DEST=%s", job->dest);
+ result = dup_iovec_string (&journal_fields[n_journal_fields], buffer);
+ }
+
+ if (result && job->printer)
+ {
+ n_journal_fields++;
+ snprintf (buffer, sizeof (buffer), "CUPS_PRINTER=%s",
+ job->printer->name);
+ result = dup_iovec_string (&journal_fields[n_journal_fields], buffer);
+ }
+ }
+
+ if (result)
+ {
+ n_journal_fields++;
+ result = sd_journal_sendv (journal_fields, n_journal_fields);
+ }
+
+ while (n_journal_fields > 0)
+ free (journal_fields[--n_journal_fields].iov_base);
+
+ free (journal_fields);
+ return (result);
+}
+#endif /* HAVE_SYSTEMD */
+
+
/*
* 'cupsdLogJob()' - Log a job message.
*/
-int /* O - 1 on success, 0 on error */
-cupsdLogJob(cupsd_job_t *job, /* I - Job */
- int level, /* I - Log level */
- const char *message, /* I - Printf-style message string */
- ...) /* I - Additional arguments as needed */
+int /* O - 1 on success, 0 on error */
+_cupsdLogJobWithLocation(const char *file, /* I - Code file */
+ const char *line, /* I - Code line */
+ const char *func, /* I - Code func */
+ cupsd_job_t *job, /* I - Job */
+ int level, /* I - Log level */
+ const char *message, /* I - Printf-style message string */
+ ...) /* I - Additional arguments as needed */
{
va_list ap, ap2; /* Argument pointers */
char jobmsg[1024]; /* Format string for job message */
@@ -603,8 +729,14 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
}
else if (level <= LogLevel &&
(level != CUPSD_LOG_INFO || LogLevel >= CUPSD_LOG_DEBUG))
- return (cupsdWriteErrorLog(level, log_line));
- else
+ {
+#ifdef HAVE_SYSTEMD
+ if (!strcmp (ErrorLog, "journal"))
+#ifdef HAVE_JOURNAL
+ return (sd_journal_send ("MESSAGE=%s", log_line,
+ "PRIORITY=%d", syslevels[level],
+ "CUPS_JOB_ID=%d", job ? job->id : -1,
+ NULL)) ? 0 : 1;
+ return (_cupsdLogToJournal (file, line, func, job, level, log_line));
+ else
+#endif /* HAVE_JOURNAL */
+#endif /* HAVE_SYSTEMD */
+ return (cupsdWriteErrorLog(level, log_line));
+ } else
return (1);
}
else
@@ -860,6 +872,15 @@ cupsdLogPage(cupsd_job_t *job, /* I - J
@@ -617,10 +749,13 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
* 'cupsdLogMessage()' - Log a message to the error log file.
*/
-int /* O - 1 on success, 0 on error */
-cupsdLogMessage(int level, /* I - Log level */
- const char *message, /* I - printf-style message string */
- ...) /* I - Additional args as needed */
+int /* O - 1 on success, 0 on error */
+_cupsdLogMessageWithLocation(const char *file, /* I - Code file */
+ const char *line, /* I - Code line */
+ const char *func, /* I - Code func */
+ int level, /* I - Log level */
+ const char *message, /* I - printf-style message string */
+ ...) /* I - Additional args as needed */
{
va_list ap, ap2; /* Argument pointers */
int status; /* Formatting status */
@@ -664,10 +799,10 @@ cupsdLogMessage(int level, /* I -
va_end(ap);
if (status > 0)
- return (cupsdWriteErrorLog(level, log_line));
+ return (_cupsdWriteErrorLogWithLocation(file, line, func, level, log_line));
else
- return (cupsdWriteErrorLog(CUPSD_LOG_ERROR,
- "Unable to allocate memory for log line!"));
+ return (_cupsdWriteErrorLogWithLocation(file, line, func, CUPSD_LOG_ERROR,
+ "Unable to allocate memory for log line!"));
}
@@ -860,6 +995,17 @@ cupsdLogPage(cupsd_job_t *job, /* I - J
*bufptr = '\0';
+#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD
+ if (!strcmp(PageLog, "journal"))
+ return (sd_journal_send ("MESSAGE=%s", buffer,
+ "PRIORITY=%d", LOG_INFO,
+ "CUPS_JOB_ID=%d", job->id,
+ "CUPS_DEST=%s", job->dest,
+ "CUPS_PRINTER=%s", job->printer->name,
+ "CUPS_PAGE_NUMBER=%s", number,
+ NULL) ? 0 : 1);
+#endif /* HAVE_JOURNAL */
+#endif /* HAVE_SYSTEMD */
+
#ifdef HAVE_VSYSLOG
/*
* See if we are logging pages via syslog...
@@ -1037,7 +1058,7 @@ cupsdLogRequest(cupsd_client_t *con, /*
@@ -1037,7 +1183,7 @@ cupsdLogRequest(cupsd_client_t *con, /*
* See if we are logging accesses via syslog...
*/
@ -289,46 +484,33 @@ diff -up cups-2.0rc1/scheduler/log.c.journal cups-2.0rc1/scheduler/log.c
{
syslog(LOG_INFO,
"REQUEST %s - %s \"%s %s HTTP/%d.%d\" %d " CUPS_LLFMT " %s %s\n",
@@ -1091,8 +1112,9 @@ cupsdLogRequest(cupsd_client_t *con, /*
@@ -1091,8 +1237,12 @@ cupsdLogRequest(cupsd_client_t *con, /*
*/
int /* O - 1 on success, 0 on failure */
-cupsdWriteErrorLog(int level, /* I - Log level */
- const char *message) /* I - Message string */
+cupsdWriteErrorLogJob(cupsd_job_t *job, /* I - Job or NULL */
+ int level, /* I - Log level */
+ const char *message) /* I - Message string */
+_cupsdWriteErrorLogJobWithLocation(const char *file, /* I - Code file */
+ const char *line, /* I - Code line */
+ const char *func, /* I - Code func */
+ cupsd_job_t *job, /* I - Job or NULL */
+ int level, /* I - Log level */
+ const char *message) /* I - Message string */
{
int ret = 1; /* Return value */
static const char levels[] = /* Log levels... */
@@ -1110,12 +1132,25 @@ cupsdWriteErrorLog(int level, /*
@@ -1110,6 +1260,10 @@ cupsdWriteErrorLog(int level, /*
};
+#ifdef HAVE_JOURNAL
+#ifdef HAVE_SYSTEMD
+ if (!strcmp(ErrorLog, "journal"))
+ {
+ if (job)
+ {
+ return (sd_journal_send ("MESSAGE=%s", message,
+ "PRIORITY=%d", syslevels[level],
+ "CUPS_JOB_ID=%d", job->id,
+ NULL) ? 0 : 1);
+ } else
+ return (sd_journal_print (syslevels[level], "%s", message) ? 0 : 1);
+ }
+#endif /* HAVE_JOURNAL */
+ return (_cupsdLogToJournal (file, line, func, job, level, message));
+#endif /* HAVE_SYSTEMD */
#ifdef HAVE_VSYSLOG
/*
* See if we are logging errors via syslog...
*/
- if (!strcmp(ErrorLog, "syslog"))
+ if (!strcmp(ErrorLog, "syslog") || !strcmp(ErrorLog, "journal"))
{
syslog(syslevels[level], "%s", message);
return (1);
@@ -1149,6 +1184,18 @@ cupsdWriteErrorLog(int level, /*
@@ -1149,6 +1303,22 @@ cupsdWriteErrorLog(int level, /*
}
@ -337,34 +519,17 @@ diff -up cups-2.0rc1/scheduler/log.c.journal cups-2.0rc1/scheduler/log.c
+ */
+
+int /* O - 1 on success, 0 on failure */
+cupsdWriteErrorLog(int level, /* I - Log level */
+ const char *message) /* I - Message string */
+_cupsdWriteErrorLogWithLocation(const char *file, /* I - Code file */
+ const char *line, /* I - Code line */
+ const char *func, /* I - Code func */
+ int level, /* I - Log level */
+ const char *message) /* I - Message string */
+{
+ return (cupsdWriteErrorLogJob(NULL, level, message));
+ return (_cupsdWriteErrorLogJobWithLocation(file, line, func,
+ NULL, level, message));
+}
+
+
/*
* 'format_log_line()' - Format a line for a log file.
*
diff -up cups-2.0rc1/scheduler/Makefile.journal cups-2.0rc1/scheduler/Makefile
--- cups-2.0rc1/scheduler/Makefile.journal 2014-09-12 17:47:14.653190542 +0200
+++ cups-2.0rc1/scheduler/Makefile 2014-09-12 17:47:14.672190276 +0200
@@ -382,7 +382,7 @@ cupsd: $(CUPSDOBJS) $(LIBCUPSMIME) ../cu
$(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \
$(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
$(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(ONDEMANDLIBS) \
- $(DNSSDLIBS) $(LIBS) $(LIBGSSAPI) $(LIBWRAP)
+ $(DNSSDLIBS) $(LIBS) $(LIBGSSAPI) $(LIBWRAP) $(SDJLIBS)
cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
@@ -390,7 +390,7 @@ cupsd-static: $(CUPSDOBJS) libcupsmime.a
$(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \
$(LIBMALLOC) $(SERVERLIBS) $(ONDEMANDLIBS) $(DNSSDLIBS) \
- $(LIBGSSAPI) $(LIBWRAP)
+ $(LIBGSSAPI) $(LIBWRAP) $(SDJLIBS)
#

View File

@ -1,7 +1,7 @@
diff -up cups-2.0rc1/config.h.in.lspp cups-2.0rc1/config.h.in
--- cups-2.0rc1/config.h.in.lspp 2014-09-12 16:54:21.764812716 +0200
+++ cups-2.0rc1/config.h.in 2014-09-12 16:54:21.775812560 +0200
@@ -716,6 +716,13 @@ static __inline int _cups_abs(int i) { r
diff -up cups-2.0.0/config.h.in.lspp cups-2.0.0/config.h.in
--- cups-2.0.0/config.h.in.lspp 2014-08-30 02:51:22.000000000 +0100
+++ cups-2.0.0/config.h.in 2014-11-06 14:39:49.112120299 +0000
@@ -709,6 +709,13 @@ static __inline int _cups_abs(int i) { r
# endif /* __GNUC__ || __STDC_VERSION__ */
#endif /* !HAVE_ABS && !abs */
@ -15,9 +15,9 @@ diff -up cups-2.0rc1/config.h.in.lspp cups-2.0rc1/config.h.in
#endif /* !_CUPS_CONFIG_H_ */
/*
diff -up cups-2.0rc1/config-scripts/cups-lspp.m4.lspp cups-2.0rc1/config-scripts/cups-lspp.m4
--- cups-2.0rc1/config-scripts/cups-lspp.m4.lspp 2014-09-12 16:54:21.776812546 +0200
+++ cups-2.0rc1/config-scripts/cups-lspp.m4 2014-09-12 16:54:21.776812546 +0200
diff -up cups-2.0.0/config-scripts/cups-lspp.m4.lspp cups-2.0.0/config-scripts/cups-lspp.m4
--- cups-2.0.0/config-scripts/cups-lspp.m4.lspp 2014-11-06 14:39:49.112120299 +0000
+++ cups-2.0.0/config-scripts/cups-lspp.m4 2014-11-06 14:39:49.112120299 +0000
@@ -0,0 +1,36 @@
+dnl
+dnl LSPP code for the Common UNIX Printing System (CUPS).
@ -55,9 +55,9 @@ diff -up cups-2.0rc1/config-scripts/cups-lspp.m4.lspp cups-2.0rc1/config-scripts
+ ;;
+ esac
+fi
diff -up cups-2.0rc1/configure.ac.lspp cups-2.0rc1/configure.ac
--- cups-2.0rc1/configure.ac.lspp 2014-04-21 14:22:03.000000000 +0200
+++ cups-2.0rc1/configure.ac 2014-09-12 16:54:21.776812546 +0200
diff -up cups-2.0.0/configure.ac.lspp cups-2.0.0/configure.ac
--- cups-2.0.0/configure.ac.lspp 2014-04-21 13:22:03.000000000 +0100
+++ cups-2.0.0/configure.ac 2014-11-06 14:39:49.112120299 +0000
@@ -36,6 +36,8 @@ sinclude(config-scripts/cups-startup.m4)
sinclude(config-scripts/cups-defaults.m4)
sinclude(config-scripts/cups-scripting.m4)
@ -67,9 +67,9 @@ diff -up cups-2.0rc1/configure.ac.lspp cups-2.0rc1/configure.ac
INSTALL_LANGUAGES=""
UNINSTALL_LANGUAGES=""
LANGFILES=""
diff -up cups-2.0rc1/filter/common.c.lspp cups-2.0rc1/filter/common.c
--- cups-2.0rc1/filter/common.c.lspp 2014-02-06 19:33:34.000000000 +0100
+++ cups-2.0rc1/filter/common.c 2014-09-12 16:54:21.776812546 +0200
diff -up cups-2.0.0/filter/common.c.lspp cups-2.0.0/filter/common.c
--- cups-2.0.0/filter/common.c.lspp 2014-02-06 18:33:34.000000000 +0000
+++ cups-2.0.0/filter/common.c 2014-11-06 14:39:49.112120299 +0000
@@ -19,6 +19,12 @@
* Include necessary headers...
*/
@ -238,9 +238,9 @@ diff -up cups-2.0rc1/filter/common.c.lspp cups-2.0rc1/filter/common.c
/*
diff -up cups-2.0rc1/filter/pstops.c.lspp cups-2.0rc1/filter/pstops.c
--- cups-2.0rc1/filter/pstops.c.lspp 2014-02-06 19:33:34.000000000 +0100
+++ cups-2.0rc1/filter/pstops.c 2014-09-12 16:54:21.778812518 +0200
diff -up cups-2.0.0/filter/pstops.c.lspp cups-2.0.0/filter/pstops.c
--- cups-2.0.0/filter/pstops.c.lspp 2014-02-06 18:33:34.000000000 +0000
+++ cups-2.0.0/filter/pstops.c 2014-11-06 14:39:49.113120305 +0000
@@ -3173,6 +3173,18 @@ write_label_prolog(pstops_doc_t *doc, /*
{
const char *classification; /* CLASSIFICATION environment variable */
@ -396,9 +396,9 @@ diff -up cups-2.0rc1/filter/pstops.c.lspp cups-2.0rc1/filter/pstops.c
/*
diff -up cups-2.0rc1/Makedefs.in.lspp cups-2.0rc1/Makedefs.in
--- cups-2.0rc1/Makedefs.in.lspp 2014-09-12 16:54:21.778812518 +0200
+++ cups-2.0rc1/Makedefs.in 2014-09-12 16:55:09.761134739 +0200
diff -up cups-2.0.0/Makedefs.in.lspp cups-2.0.0/Makedefs.in
--- cups-2.0.0/Makedefs.in.lspp 2014-11-06 14:39:49.072120084 +0000
+++ cups-2.0.0/Makedefs.in 2014-11-06 14:39:49.129120391 +0000
@@ -145,7 +145,7 @@ LDFLAGS = -L../cgi-bin -L../cups -L../f
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(LIBZ)
@ -407,32 +407,32 @@ diff -up cups-2.0rc1/Makedefs.in.lspp cups-2.0rc1/Makedefs.in
+LIBS = $(LINKCUPS) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@
ONDEMANDFLAGS = @ONDEMANDFLAGS@
ONDEMANDLIBS = @ONDEMANDLIBS@
SDJLIBS = @SDJLIBS@
diff -up cups-2.0rc1/scheduler/client.c.lspp cups-2.0rc1/scheduler/client.c
--- cups-2.0rc1/scheduler/client.c.lspp 2014-08-28 17:37:22.000000000 +0200
+++ cups-2.0rc1/scheduler/client.c 2014-09-12 16:59:59.193046343 +0200
@@ -24,6 +24,8 @@
OPTIM = @OPTIM@
diff -up cups-2.0.0/scheduler/client.c.lspp cups-2.0.0/scheduler/client.c
--- cups-2.0.0/scheduler/client.c.lspp 2014-08-28 16:37:22.000000000 +0100
+++ cups-2.0.0/scheduler/client.c 2014-11-06 14:47:11.530298121 +0000
@@ -24,12 +24,20 @@
#define _HTTP_NO_PRIVATE
#include "cupsd.h"
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+
+#endif /* !defined(_GNU_SOURCE) */
#ifdef __APPLE__
# include <libproc.h>
#endif /* __APPLE__ */
@@ -31,6 +33,11 @@
#ifdef HAVE_TCPD_H
# include <tcpd.h>
#endif /* HAVE_TCPD_H */
+#ifdef WITH_LSPP
+#include <selinux/selinux.h>
+#include <selinux/context.h>
+#include <fcntl.h>
+# include <selinux/selinux.h>
+# include <selinux/context.h>
+# include <fcntl.h>
+#endif /* WITH_LSPP */
/*
* Local functions...
@@ -265,6 +272,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
@@ -265,6 +273,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
}
#endif /* HAVE_TCPD_H */
@ -490,7 +490,7 @@ diff -up cups-2.0rc1/scheduler/client.c.lspp cups-2.0rc1/scheduler/client.c
#ifdef AF_LOCAL
if (httpAddrFamily(httpGetAddress(con->http)) == AF_LOCAL)
{
@@ -555,6 +613,13 @@ cupsdReadClient(cupsd_client_t *con) /*
@@ -555,6 +614,13 @@ cupsdReadClient(cupsd_client_t *con) /*
mime_type_t *type; /* MIME type of file */
cupsd_printer_t *p; /* Printer */
static unsigned request_id = 0; /* Request ID for temp files */
@ -504,75 +504,81 @@ diff -up cups-2.0rc1/scheduler/client.c.lspp cups-2.0rc1/scheduler/client.c
status = HTTP_STATUS_CONTINUE;
@@ -1921,6 +1986,67 @@ cupsdReadClient(cupsd_client_t *con) /*
fchmod(con->file, 0640);
fchown(con->file, RunUser, Group);
@@ -1923,6 +1989,73 @@ cupsdReadClient(cupsd_client_t *con) /*
fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC);
+#ifdef WITH_LSPP
+ if (strncmp(con->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) != 0)
+ {
+ if (getfilecon(con->filename, &spoolcon) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ return (cupsdCloseClient(con));
+ }
+ clicon = context_new(con->scon);
+ tmpcon = context_new(spoolcon);
+ freecon(spoolcon);
+ if (!clicon || !tmpcon)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ if (clicon)
+ context_free(clicon);
+ if (tmpcon)
+ context_free(tmpcon);
+ return (cupsdCloseClient(con));
+ }
+ clirange = context_range_get(clicon);
+ if (clirange)
+ {
+ clirange = strdup(clirange);
+ if ((cliclearance = strtok(clirange, "-")) != NULL)
+ {
+ if (context_range_set(tmpcon, cliclearance) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ free(clirange);
+ context_free(tmpcon);
+ context_free(clicon);
+ return (cupsdCloseClient(con));
+ }
+ }
+ else
+ {
+ if (context_range_set(tmpcon, (context_range_get(clicon))) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ free(clirange);
+ context_free(tmpcon);
+ context_free(clicon);
+ return (cupsdCloseClient(con));
+ }
+ }
+ free(clirange);
+ }
+ if (setfilecon(con->filename, context_str(tmpcon)) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ context_free(tmpcon);
+ context_free(clicon);
+ return (cupsdCloseClient(con));
+ }
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdReadClient: %s set to %s",
+ con->filename, context_str(tmpcon));
+ context_free(tmpcon);
+ context_free(clicon);
+ }
+#endif /* WITH_LSPP */
}
+#ifdef WITH_LSPP
+ if (strncmp(con->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) != 0)
+ {
+ if (getfilecon(con->filename, &spoolcon) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ cupsdCloseClient(con);
+ return;
+ }
+ clicon = context_new(con->scon);
+ tmpcon = context_new(spoolcon);
+ freecon(spoolcon);
+ if (!clicon || !tmpcon)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ if (clicon)
+ context_free(clicon);
+ if (tmpcon)
+ context_free(tmpcon);
+ cupsdCloseClient(con);
+ return;
+ }
+ clirange = (char *) context_range_get(clicon);
+ if (clirange)
+ {
+ clirange = strdup(clirange);
+ if ((cliclearance = strtok(clirange, "-")) != NULL)
+ {
+ if (context_range_set(tmpcon, cliclearance) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ free(clirange);
+ context_free(tmpcon);
+ context_free(clicon);
+ cupsdCloseClient(con);
+ return;
+ }
+ }
+ else
+ {
+ if (context_range_set(tmpcon, (context_range_get(clicon))) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ free(clirange);
+ context_free(tmpcon);
+ context_free(clicon);
+ cupsdCloseClient(con);
+ return;
+ }
+ }
+ free(clirange);
+ }
+ if (setfilecon(con->filename, context_str(tmpcon)) == -1)
+ {
+ cupsdSendError(con, HTTP_STATUS_SERVER_ERROR, CUPSD_AUTH_NONE);
+ context_free(tmpcon);
+ context_free(clicon);
+ cupsdCloseClient(con);
+ return;
+ }
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdReadClient: %s set to %s",
+ con->filename, context_str(tmpcon));
+ context_free(tmpcon);
+ context_free(clicon);
+ }
+#endif /* WITH_LSPP */
+
if (httpGetState(con->http) != HTTP_STATE_POST_SEND)
@@ -3423,6 +3549,49 @@ is_path_absolute(const char *path) /* I
{
if (!httpWait(con->http, 0))
@@ -3423,6 +3556,49 @@ is_path_absolute(const char *path) /* I
return (1);
}
@ -596,7 +602,7 @@ diff -up cups-2.0rc1/scheduler/client.c.lspp cups-2.0rc1/scheduler/client.c
+ in = open(fname, O_NOFOLLOW|O_RDONLY);
+
+ if (in < 0)
+ return -1;
+ return (uid_t) -1;
+
+ errno = 0;
+
@ -607,14 +613,14 @@ diff -up cups-2.0rc1/scheduler/client.c.lspp cups-2.0rc1/scheduler/client.c
+ close(in);
+
+ if (len < 0 || len >= sizeof(buf))
+ return -1;
+ return (uid_t) -1;
+
+ errno = 0;
+ buf[len] = 0;
+ uid = strtol(buf, 0, 10);
+
+ if (errno != 0)
+ return -1;
+ return (uid_t) -1;
+ else
+ return uid;
+}
@ -622,9 +628,9 @@ diff -up cups-2.0rc1/scheduler/client.c.lspp cups-2.0rc1/scheduler/client.c
/*
* 'pipe_command()' - Pipe the output of a command to the remote client.
diff -up cups-2.0rc1/scheduler/client.h.lspp cups-2.0rc1/scheduler/client.h
--- cups-2.0rc1/scheduler/client.h.lspp 2014-03-21 17:42:53.000000000 +0100
+++ cups-2.0rc1/scheduler/client.h 2014-09-12 17:00:39.110482947 +0200
diff -up cups-2.0.0/scheduler/client.h.lspp cups-2.0.0/scheduler/client.h
--- cups-2.0.0/scheduler/client.h.lspp 2014-03-21 16:42:53.000000000 +0000
+++ cups-2.0.0/scheduler/client.h 2014-11-06 14:39:49.114120310 +0000
@@ -18,6 +18,13 @@
#endif /* HAVE_AUTHORIZATION_H */
@ -660,9 +666,9 @@ diff -up cups-2.0rc1/scheduler/client.h.lspp cups-2.0rc1/scheduler/client.h
#ifdef HAVE_SSL
extern int cupsdEndTLS(cupsd_client_t *con);
diff -up cups-2.0rc1/scheduler/conf.c.lspp cups-2.0rc1/scheduler/conf.c
--- cups-2.0rc1/scheduler/conf.c.lspp 2014-09-12 16:54:21.772812603 +0200
+++ cups-2.0rc1/scheduler/conf.c 2014-09-12 16:54:21.781812475 +0200
diff -up cups-2.0.0/scheduler/conf.c.lspp cups-2.0.0/scheduler/conf.c
--- cups-2.0.0/scheduler/conf.c.lspp 2014-11-06 14:39:49.106120267 +0000
+++ cups-2.0.0/scheduler/conf.c 2014-11-06 14:39:49.114120310 +0000
@@ -36,6 +36,9 @@
# define INADDR_NONE 0xffffffff
#endif /* !INADDR_NONE */
@ -740,7 +746,7 @@ diff -up cups-2.0rc1/scheduler/conf.c.lspp cups-2.0rc1/scheduler/conf.c
/*
* Check the MaxClients setting, and then allocate memory for it...
@@ -3646,6 +3687,18 @@ read_location(cups_file_t *fp, /* I - C
@@ -3652,6 +3693,18 @@ read_location(cups_file_t *fp, /* I - C
return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
}
@ -759,9 +765,9 @@ diff -up cups-2.0rc1/scheduler/conf.c.lspp cups-2.0rc1/scheduler/conf.c
/*
* 'read_policy()' - Read a <Policy name> definition.
diff -up cups-2.0rc1/scheduler/conf.h.lspp cups-2.0rc1/scheduler/conf.h
--- cups-2.0rc1/scheduler/conf.h.lspp 2014-09-12 16:54:21.766812687 +0200
+++ cups-2.0rc1/scheduler/conf.h 2014-09-12 17:01:30.718755326 +0200
diff -up cups-2.0.0/scheduler/conf.h.lspp cups-2.0.0/scheduler/conf.h
--- cups-2.0.0/scheduler/conf.h.lspp 2014-11-06 14:39:49.103120251 +0000
+++ cups-2.0.0/scheduler/conf.h 2014-11-06 14:39:49.114120310 +0000
@@ -248,6 +248,13 @@ VAR char *ServerKeychain VALUE(NULL);
/* Keychain holding cert + key */
#endif /* HAVE_SSL */
@ -786,9 +792,9 @@ diff -up cups-2.0rc1/scheduler/conf.h.lspp cups-2.0rc1/scheduler/conf.h
/*
* Prototypes...
diff -up cups-2.0rc1/scheduler/cupsd.h.lspp cups-2.0rc1/scheduler/cupsd.h
--- cups-2.0rc1/scheduler/cupsd.h.lspp 2014-09-12 16:54:21.746812970 +0200
+++ cups-2.0rc1/scheduler/cupsd.h 2014-09-12 17:02:02.351309341 +0200
diff -up cups-2.0.0/scheduler/cupsd.h.lspp cups-2.0.0/scheduler/cupsd.h
--- cups-2.0.0/scheduler/cupsd.h.lspp 2014-11-06 14:39:49.095120208 +0000
+++ cups-2.0.0/scheduler/cupsd.h 2014-11-06 14:39:49.115120315 +0000
@@ -13,6 +13,8 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -820,9 +826,9 @@ diff -up cups-2.0rc1/scheduler/cupsd.h.lspp cups-2.0rc1/scheduler/cupsd.h
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
diff -up cups-2.0rc1/scheduler/ipp.c.lspp cups-2.0rc1/scheduler/ipp.c
--- cups-2.0rc1/scheduler/ipp.c.lspp 2014-09-12 16:54:21.686813817 +0200
+++ cups-2.0rc1/scheduler/ipp.c 2014-09-12 16:54:21.785812419 +0200
diff -up cups-2.0.0/scheduler/ipp.c.lspp cups-2.0.0/scheduler/ipp.c
--- cups-2.0.0/scheduler/ipp.c.lspp 2014-11-06 14:39:49.057120004 +0000
+++ cups-2.0.0/scheduler/ipp.c 2014-11-06 14:39:49.117120326 +0000
@@ -16,6 +16,9 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -935,7 +941,7 @@ diff -up cups-2.0rc1/scheduler/ipp.c.lspp cups-2.0rc1/scheduler/ipp.c
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Printer is not a character device or regular file"));
+ return (NULL);
+ }
+ static avc_initialized = 0;
+ static int avc_initialized = 0;
+ if (!avc_initialized++)
+ avc_init("cupsd_enqueue_", NULL, NULL, NULL, NULL);
+ avc_entry_ref_init(&avcref);
@ -1178,7 +1184,7 @@ diff -up cups-2.0rc1/scheduler/ipp.c.lspp cups-2.0rc1/scheduler/ipp.c
+ * Initialize the avc engine...
+ */
+
+ static avc_initialized = 0;
+ static int avc_initialized = 0;
+ if (! avc_initialized++)
+ {
+ if (avc_init("cupsd", NULL, NULL, NULL, NULL) < 0)
@ -1291,7 +1297,7 @@ diff -up cups-2.0rc1/scheduler/ipp.c.lspp cups-2.0rc1/scheduler/ipp.c
+ job->num_files --;
+ return (0);
+ }
+ jobrange = context_range_get(jobcon);
+ jobrange = (char *) context_range_get(jobcon);
+ if (jobrange)
+ {
+ jobrange = strdup(jobrange);
@ -1416,9 +1422,9 @@ diff -up cups-2.0rc1/scheduler/ipp.c.lspp cups-2.0rc1/scheduler/ipp.c
/*
* Check the username against the owner...
*/
diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
--- cups-2.0rc1/scheduler/job.c.lspp 2014-09-12 16:54:21.761812758 +0200
+++ cups-2.0rc1/scheduler/job.c 2014-09-12 17:03:06.012411787 +0200
diff -up cups-2.0.0/scheduler/job.c.lspp cups-2.0.0/scheduler/job.c
--- cups-2.0.0/scheduler/job.c.lspp 2014-11-06 14:39:49.068120063 +0000
+++ cups-2.0.0/scheduler/job.c 2014-11-06 14:39:49.118120331 +0000
@@ -13,6 +13,9 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -1459,7 +1465,7 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
cupsdLogMessage(CUPSD_LOG_DEBUG2,
@@ -1059,6 +1078,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I
@@ -1064,6 +1083,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I
if (final_content_type[0])
envp[envc ++] = final_content_type;
@ -1527,7 +1533,7 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
if (Classification && !banner_page)
{
if ((attr = ippFindAttribute(job->attrs, "job-sheets",
@@ -1852,6 +1932,20 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J
@@ -1857,6 +1937,20 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J
ippSetString(job->attrs, &job->reasons, 0, "none");
}
@ -1548,7 +1554,7 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed",
IPP_TAG_INTEGER);
job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
@@ -2253,6 +2347,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
@@ -2258,6 +2352,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
{
char filename[1024]; /* Job control filename */
cups_file_t *fp; /* Job file */
@ -1563,7 +1569,7 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p(%d)): job->attrs=%p",
@@ -2265,6 +2367,76 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
@@ -2270,6 +2372,76 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
fchown(cupsFileNumber(fp), RunUser, Group);
@ -1640,7 +1646,7 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
job->attrs->state = IPP_IDLE;
if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL,
@@ -3847,6 +4019,18 @@ get_options(cupsd_job_t *job, /* I - Jo
@@ -3852,6 +4024,18 @@ get_options(cupsd_job_t *job, /* I - Jo
banner_page)
continue;
@ -1659,7 +1665,7 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
/*
* Otherwise add them to the list...
*/
@@ -4596,6 +4780,19 @@ start_job(cupsd_job_t *job, /* I -
@@ -4601,6 +4785,18 @@ start_job(cupsd_job_t *job, /* I -
cupsd_printer_t *printer) /* I - Printer to print job */
{
const char *filename; /* Support filename */
@ -1675,11 +1681,10 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
+ security_class_t tclass; /* Object class for the SELinux check */
+ access_vector_t avr; /* Access method being requested */
+#endif /* WITH_LSPP */
+
ipp_attribute_t *cancel_after = ippFindAttribute(job->attrs,
"job-cancel-after",
IPP_TAG_INTEGER);
@@ -4772,6 +4969,108 @@ start_job(cupsd_job_t *job, /* I -
@@ -4777,6 +4973,108 @@ start_job(cupsd_job_t *job, /* I -
fcntl(job->side_pipes[1], F_SETFD,
fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC);
@ -1728,7 +1733,7 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
+ cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_DEFAULT, NULL);
+ return ;
+ }
+ static avc_initialized = 0;
+ static int avc_initialized = 0;
+ if (!avc_initialized++)
+ avc_init("cupsd_dequeue_", NULL, NULL, NULL, NULL);
+ avc_entry_ref_init(&avcref);
@ -1788,9 +1793,9 @@ diff -up cups-2.0rc1/scheduler/job.c.lspp cups-2.0rc1/scheduler/job.c
/*
* Now start the first file in the job...
*/
diff -up cups-2.0rc1/scheduler/job.h.lspp cups-2.0rc1/scheduler/job.h
--- cups-2.0rc1/scheduler/job.h.lspp 2014-07-31 02:02:30.000000000 +0200
+++ cups-2.0rc1/scheduler/job.h 2014-09-12 17:03:32.752034787 +0200
diff -up cups-2.0.0/scheduler/job.h.lspp cups-2.0.0/scheduler/job.h
--- cups-2.0.0/scheduler/job.h.lspp 2014-07-31 01:02:30.000000000 +0100
+++ cups-2.0.0/scheduler/job.h 2014-11-06 14:39:49.118120331 +0000
@@ -13,6 +13,13 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -1816,9 +1821,9 @@ diff -up cups-2.0rc1/scheduler/job.h.lspp cups-2.0rc1/scheduler/job.h
};
typedef struct cupsd_joblog_s /**** Job log message ****/
diff -up cups-2.0rc1/scheduler/main.c.lspp cups-2.0rc1/scheduler/main.c
--- cups-2.0rc1/scheduler/main.c.lspp 2014-09-12 16:54:21.748812942 +0200
+++ cups-2.0rc1/scheduler/main.c 2014-09-12 16:54:21.788812377 +0200
diff -up cups-2.0.0/scheduler/main.c.lspp cups-2.0.0/scheduler/main.c
--- cups-2.0.0/scheduler/main.c.lspp 2014-11-06 14:39:49.096120213 +0000
+++ cups-2.0.0/scheduler/main.c 2014-11-06 14:39:49.118120331 +0000
@@ -56,6 +56,9 @@ extern int launch_activate_socket(const
# include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
@ -1877,9 +1882,9 @@ diff -up cups-2.0rc1/scheduler/main.c.lspp cups-2.0rc1/scheduler/main.c
return (!stop_scheduler);
}
diff -up cups-2.0rc1/scheduler/printers.c.lspp cups-2.0rc1/scheduler/printers.c
--- cups-2.0rc1/scheduler/printers.c.lspp 2014-09-12 16:54:21.655814255 +0200
+++ cups-2.0rc1/scheduler/printers.c 2014-09-12 16:54:21.789812362 +0200
diff -up cups-2.0.0/scheduler/printers.c.lspp cups-2.0.0/scheduler/printers.c
--- cups-2.0.0/scheduler/printers.c.lspp 2014-11-06 14:39:49.039119907 +0000
+++ cups-2.0.0/scheduler/printers.c 2014-11-06 14:39:49.119120337 +0000
@@ -13,6 +13,8 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -1900,7 +1905,7 @@ diff -up cups-2.0rc1/scheduler/printers.c.lspp cups-2.0rc1/scheduler/printers.c
/*
* Local functions...
@@ -2026,6 +2032,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
@@ -2025,6 +2031,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
ipp_attribute_t *attr; /* Attribute data */
char *name, /* Current user/group name */
*filter; /* Current filter */
@ -1914,7 +1919,7 @@ diff -up cups-2.0rc1/scheduler/printers.c.lspp cups-2.0rc1/scheduler/printers.c
DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
@@ -2146,6 +2159,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
@@ -2145,6 +2158,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
attr->values[1].string.text = _cupsStrAlloc(Classification ?
Classification : p->job_sheets[1]);
}

View File

@ -11,7 +11,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.0.0
Release: 9%{?dist}
Release: 10%{?dist}
License: GPLv2
Url: http://www.cups.org/
Source: http://www.cups.org/software/%{version}/cups-%{version}-source.tar.bz2
@ -614,6 +614,11 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz
%changelog
* Thu Nov 6 2014 Tim Waugh <twaugh@redhat.com> - 1:2.0.0-10
- Fixed some warnings in cups-lspp.patch.
- New systemd journal fields CUPS_DEST and CUPS_PRINTER, as well as
accurate code location fields.
* Wed Oct 22 2014 Tim Waugh <twaugh@redhat.com> - 1:2.0.0-9
- Upstream fix for cupsd crash on restart when colord not available
- (STR #4496).