This commit is contained in:
Jiri Popelka 2015-06-29 13:47:50 +02:00
parent d3aa890d88
commit 8d1f53d4a7
8 changed files with 162 additions and 683 deletions

2
.gitignore vendored
View File

@ -68,3 +68,5 @@ cups-1.4.4-source.tar.bz2
/cups-2.0.2-source.tar.bz2
/cups-2.0.3-source.tar.bz2
/cups-2.0.4-source.tar.bz2
/cups-2.1b1-source.tar.bz2
/cups-2.1rc1-source.tar.bz2

View File

@ -1,9 +1,9 @@
diff -up cups-1.7b1/backend/ipp.c.eggcups cups-1.7b1/backend/ipp.c
--- cups-1.7b1/backend/ipp.c.eggcups 2013-04-01 20:49:19.000000000 +0200
+++ cups-1.7b1/backend/ipp.c 2013-04-19 12:01:05.022934745 +0200
@@ -160,6 +160,70 @@ static cups_array_t *state_reasons; /* A
static char tmpfilename[1024] = "";
/* Temporary spool file name */
diff -up cups-2.1b1/backend/ipp.c.eggcups cups-2.1b1/backend/ipp.c
--- cups-2.1b1/backend/ipp.c.eggcups 2015-05-28 03:19:14.000000000 +0200
+++ cups-2.1b1/backend/ipp.c 2015-06-29 12:56:54.872807227 +0200
@@ -149,6 +149,70 @@ static char tmpfilename[1024] = "";
static char mandatory_attrs[1024] = "";
/* cupsMandatory value */
+#if HAVE_DBUS
+#include <dbus/dbus.h>
@ -21,7 +21,7 @@ diff -up cups-1.7b1/backend/ipp.c.eggcups cups-1.7b1/backend/ipp.c
+ dbus_connection_unref (dbus_connection);
+ dbus_connection = NULL;
+ }
+
+
+ dbus_error_init (&error);
+ connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error);
+ if (connection == NULL) {
@ -65,14 +65,14 @@ diff -up cups-1.7b1/backend/ipp.c.eggcups cups-1.7b1/backend/ipp.c
+ dbus_connection_send (dbus_connection, message, NULL);
+ dbus_connection_flush (dbus_connection);
+ dbus_message_unref (message);
+
+
+ return 0;
+}
+#endif /* HAVE_DBUS */
/*
* Local functions...
@@ -1665,6 +1729,15 @@ main(int argc, /* I - Number of comm
@@ -1700,6 +1764,15 @@ main(int argc, /* I - Number of comm
fprintf(stderr, "DEBUG: Print job accepted - job ID %d.\n", job_id);
}
@ -88,10 +88,10 @@ diff -up cups-1.7b1/backend/ipp.c.eggcups cups-1.7b1/backend/ipp.c
ippDelete(response);
if (job_canceled)
diff -up cups-1.7b1/backend/Makefile.eggcups cups-1.7b1/backend/Makefile
--- cups-1.7b1/backend/Makefile.eggcups 2012-12-07 22:45:35.000000000 +0100
+++ cups-1.7b1/backend/Makefile 2013-04-19 11:27:33.914224959 +0200
@@ -245,7 +245,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac
diff -up cups-2.1b1/backend/Makefile.eggcups cups-2.1b1/backend/Makefile
--- cups-2.1b1/backend/Makefile.eggcups 2014-05-09 00:42:44.000000000 +0200
+++ cups-2.1b1/backend/Makefile 2015-06-29 12:54:55.753026774 +0200
@@ -264,7 +264,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
@ -100,10 +100,10 @@ diff -up cups-1.7b1/backend/Makefile.eggcups cups-1.7b1/backend/Makefile
$(RM) http
$(LN) ipp http
diff -up cups-1.7b1/scheduler/subscriptions.c.eggcups cups-1.7b1/scheduler/subscriptions.c
--- cups-1.7b1/scheduler/subscriptions.c.eggcups 2012-02-11 23:10:54.000000000 +0100
+++ cups-1.7b1/scheduler/subscriptions.c 2013-04-19 11:27:33.916224934 +0200
@@ -1314,13 +1314,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
diff -up cups-2.1b1/scheduler/subscriptions.c.eggcups cups-2.1b1/scheduler/subscriptions.c
--- cups-2.1b1/scheduler/subscriptions.c.eggcups 2014-02-06 19:33:34.000000000 +0100
+++ cups-2.1b1/scheduler/subscriptions.c 2015-06-29 12:54:55.753026774 +0200
@@ -1293,13 +1293,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
what = "PrinterAdded";
else if (event & CUPSD_EVENT_PRINTER_DELETED)
what = "PrinterRemoved";
@ -119,7 +119,7 @@ diff -up cups-1.7b1/scheduler/subscriptions.c.eggcups cups-1.7b1/scheduler/subsc
else
return;
@@ -1356,7 +1356,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
@@ -1335,7 +1335,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
dbus_message_append_iter_init(message, &iter);
if (dest)
dbus_message_iter_append_string(&iter, dest->name);

View File

@ -1,535 +1,12 @@
diff -up cups-2.0.2/conf/cups-files.conf.in.rMbEsH cups-2.0.2/conf/cups-files.conf.in
--- cups-2.0.2/conf/cups-files.conf.in.rMbEsH 2014-12-05 18:25:55.000000000 +0100
+++ cups-2.0.2/conf/cups-files.conf.in 2015-02-10 13:51:24.912193296 +0100
@@ -29,9 +29,10 @@ SystemGroup @CUPS_SYSTEM_GROUPS@
#ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@
#LogFilePerm 0@CUPS_LOG_FILE_PERM@
diff -up cups-2.1rc1/scheduler/log.c.journal cups-2.1rc1/scheduler/log.c
--- cups-2.1rc1/scheduler/log.c.journal 2015-08-10 15:06:15.000000000 +0200
+++ cups-2.1rc1/scheduler/log.c 2015-08-10 15:07:30.046368863 +0200
@@ -690,7 +690,7 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
-# Location of the file logging all access to the scheduler; may be the name
-# "syslog". If not an absolute path, the value of ServerRoot is used as the
-# root directory. Also see the "AccessLogLevel" directive in cupsd.conf.
+# Location of the file logging all access to the scheduler; 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
+# "AccessLogLevel" directive in cupsd.conf.
AccessLog @CUPS_LOGDIR@/access_log
va_end(ap);
# Location of cache files used by the scheduler...
@@ -43,11 +44,11 @@ AccessLog @CUPS_LOGDIR@/access_log
# Location of the static web content served by the scheduler...
#DocumentRoot @CUPS_DOCROOT@
-# Location of the file logging all messages produced by the scheduler and any
-# 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 journal
# Location of fonts used by older print filters...
#FontPath @CUPS_FONTPATH@
@@ -55,10 +56,10 @@ ErrorLog @CUPS_LOGDIR@/error_log
# Location of LPD configuration
#LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@
-# Location of the file logging all pages printed by the scheduler and any
-# 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 "PageLogFormat"
-# directive in cupsd.conf.
+# Location of the file logging all pages printed 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 "PageLogFormat" directive in cupsd.conf.
PageLog @CUPS_LOGDIR@/page_log
# Location of the file listing all of the local printers...
diff -up cups-2.0.2/config-scripts/cups-startup.m4.rMbEsH cups-2.0.2/config-scripts/cups-startup.m4
--- cups-2.0.2/config-scripts/cups-startup.m4.rMbEsH 2014-12-09 23:18:45.000000000 +0100
+++ cups-2.0.2/config-scripts/cups-startup.m4 2015-02-10 13:51:24.912193296 +0100
@@ -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.2/doc/help/man-cups-files.conf.html.rMbEsH cups-2.0.2/doc/help/man-cups-files.conf.html
--- cups-2.0.2/doc/help/man-cups-files.conf.html.rMbEsH 2015-02-10 13:51:24.977192375 +0100
+++ cups-2.0.2/doc/help/man-cups-files.conf.html 2015-02-10 13:52:36.839175089 +0100
@@ -24,6 +24,7 @@ The following directives are understood
<dt><a name="AccessLog"></a><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>
+<dd style="margin-left: 5.0em"><dt><b>AccessLog journal</b>
<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.
@@ -51,6 +52,7 @@ The default is usually "/usr/share/doc/c
<dt><a name="ErrorLog"></a><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>
+<dd style="margin-left: 5.0em"><dt><b>ErrorLog journal</b>
<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.
@@ -96,6 +98,7 @@ The default group is operating system sp
The default is "0644".
<dt><a name="PageLog"></a><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.
Specifying a blank filename disables page log generation.
diff -up cups-2.0.2/man/cups-files.conf.man.in.rMbEsH cups-2.0.2/man/cups-files.conf.man.in
--- cups-2.0.2/man/cups-files.conf.man.in.rMbEsH 2015-02-02 19:38:25.000000000 +0100
+++ cups-2.0.2/man/cups-files.conf.man.in 2015-02-10 13:51:24.980192333 +0100
@@ -34,9 +34,13 @@ The following directives are understood
\fBAccessLog \fIfilename\fR
.TP 5
\fBAccessLog syslog\fR
+.TP 5
+\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 "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
@@ -70,9 +74,13 @@ The default is usually "/usr/share/doc/c
\fBErrorLog \fIfilename\fR
.TP 5
\fBErrorLog syslog\fR
+.TP 5
+\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 "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
@@ -135,8 +143,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 "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.0.2/scheduler/conf.c.rMbEsH cups-2.0.2/scheduler/conf.c
--- cups-2.0.2/scheduler/conf.c.rMbEsH 2015-02-10 13:40:24.057548432 +0100
+++ cups-2.0.2/scheduler/conf.c 2015-02-10 13:51:24.991192177 +0100
@@ -952,9 +952,9 @@ cupsdReadConfiguration(void)
*/
#ifdef HAVE_VSYSLOG
- if (!strcmp(AccessLog, "syslog") ||
- !strcmp(ErrorLog, "syslog") ||
- !strcmp(PageLog, "syslog"))
+ if (!strcmp(AccessLog, "syslog") || !strcmp(AccessLog, "journal") ||
+ !strcmp(ErrorLog, "syslog") || !strcmp(ErrorLog, "journal") ||
+ !strcmp(PageLog, "syslog") || !strcmp(PageLog, "journal"))
openlog("cupsd", LOG_PID | LOG_NOWAIT | LOG_NDELAY, LOG_LPR);
#endif /* HAVE_VSYSLOG */
@@ -962,13 +962,13 @@ cupsdReadConfiguration(void)
* Make sure each of the log files exists and gets rotated as necessary...
*/
- if (strcmp(AccessLog, "syslog"))
+ if (strcmp(AccessLog, "syslog") && strcmp(AccessLog, "journal"))
cupsdCheckLogFile(&AccessFile, AccessLog);
- if (strcmp(ErrorLog, "syslog"))
+ if (strcmp(ErrorLog, "syslog") && strcmp(ErrorLog, "journal"))
cupsdCheckLogFile(&ErrorFile, ErrorLog);
- if (strcmp(PageLog, "syslog"))
+ if (strcmp(PageLog, "syslog") && strcmp(PageLog, "journal"))
cupsdCheckLogFile(&PageFile, PageLog);
/*
diff -up cups-2.0.2/scheduler/conf.h.rMbEsH cups-2.0.2/scheduler/conf.h
--- cups-2.0.2/scheduler/conf.h.rMbEsH 2015-02-10 13:40:24.057548432 +0100
+++ cups-2.0.2/scheduler/conf.h 2015-02-10 13:51:24.999192064 +0100
@@ -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 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);
+#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.2/scheduler/log.c.rMbEsH cups-2.0.2/scheduler/log.c
--- cups-2.0.2/scheduler/log.c.rMbEsH 2015-02-10 13:40:24.173546790 +0100
+++ cups-2.0.2/scheduler/log.c 2015-02-10 13:51:25.008191937 +0100
@@ -23,6 +23,12 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <sys/uio.h>
+#ifdef HAVE_SYSTEMD
+/* We handle location fields ourselves */
+# define SD_JOURNAL_SUPPRESS_LOCATION
+# include <systemd/sd-journal.h>
+#endif /* HAVE_SYSTEMD */
/*
@@ -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"))
+ return (_cupsdLogToJournal (file, line, func, job, level, log_line));
+ else
+#endif /* HAVE_SYSTEMD */
+ return (cupsdWriteErrorLog(level, log_line));
+ } else
return (1);
}
else
@@ -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_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_SYSTEMD */
+
#ifdef HAVE_VSYSLOG
/*
* See if we are logging pages via syslog...
@@ -1037,7 +1183,7 @@ cupsdLogRequest(cupsd_client_t *con, /*
* See if we are logging accesses via syslog...
*/
- if (!strcmp(AccessLog, "syslog"))
+ if (!strcmp(AccessLog, "syslog") || !strcmp(AccessLog, "journal"))
{
syslog(LOG_INFO,
"REQUEST %s - %s \"%s %s HTTP/%d.%d\" %d " CUPS_LLFMT " %s %s\n",
@@ -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 */
+_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,6 +1260,10 @@ cupsdWriteErrorLog(int level, /*
};
+#ifdef HAVE_SYSTEMD
+ if (!strcmp(ErrorLog, "journal"))
+ return (_cupsdLogToJournal (file, line, func, job, level, message));
+#endif /* HAVE_SYSTEMD */
#ifdef HAVE_VSYSLOG
/*
* See if we are logging errors via syslog...
@@ -1149,6 +1303,22 @@ cupsdWriteErrorLog(int level, /*
}
+/*
+ * 'cupsdWriteErrorLog()' - Write a line to the ErrorLog.
+ */
+
+int /* O - 1 on success, 0 on failure */
+_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 (_cupsdWriteErrorLogJobWithLocation(file, line, func,
+ NULL, level, message));
+}
+
+
/*
* 'format_log_line()' - Format a line for a log file.
*
- if (job)
+ if (job && printer)
sd_journal_send("MESSAGE=%s", log_line,
"PRIORITY=%i", log_levels[level],
PWG_Event"=JobStateChanged",

View File

@ -1,9 +1,9 @@
diff -up cups-1.5b1/scheduler/log.c.logrotate cups-1.5b1/scheduler/log.c
--- cups-1.5b1/scheduler/log.c.logrotate 2011-05-14 01:04:16.000000000 +0200
+++ cups-1.5b1/scheduler/log.c 2011-05-24 15:47:20.000000000 +0200
@@ -32,6 +32,9 @@
#include "cupsd.h"
#include <stdarg.h>
diff -up cups-2.1b1/scheduler/log.c.logrotate cups-2.1b1/scheduler/log.c
--- cups-2.1b1/scheduler/log.c.logrotate 2015-06-04 20:00:31.000000000 +0200
+++ cups-2.1b1/scheduler/log.c 2015-06-29 13:25:09.623350218 +0200
@@ -26,6 +26,9 @@
# include <systemd/sd-journal.h>
#endif /* HAVE_ASL_H */
#include <syslog.h>
+#include <sys/types.h>
+#include <sys/stat.h>
@ -11,8 +11,8 @@ diff -up cups-1.5b1/scheduler/log.c.logrotate cups-1.5b1/scheduler/log.c
/*
@@ -71,12 +74,10 @@ cupsdCheckLogFile(cups_file_t **lf, /* I
return (1);
@@ -135,12 +138,10 @@ cupsdCheckLogFile(cups_file_t **lf, /* I
}
/*
- * Format the filename as needed...
@ -26,10 +26,17 @@ diff -up cups-1.5b1/scheduler/log.c.logrotate cups-1.5b1/scheduler/log.c
{
/*
* Handle format strings...
@@ -186,6 +187,34 @@ cupsdCheckLogFile(cups_file_t **lf, /* I
}
/*
@@ -254,6 +255,34 @@ cupsdCheckLogFile(cups_file_t **lf, /* I
/*
* Change ownership and permissions of non-device logs...
*/
+
+ fchown(cupsFileNumber(*lf), RunUser, Group);
+ fchmod(cupsFileNumber(*lf), LogFilePerm);
+ }
+ }
+
+ /*
+ * Has someone else (i.e. logrotate) already rotated the log for us?
+ */
+ else if (strncmp(filename, "/dev/", 5))
@ -51,13 +58,6 @@ diff -up cups-1.5b1/scheduler/log.c.logrotate cups-1.5b1/scheduler/log.c
+ /*
+ * Change ownership and permissions of non-device logs...
+ */
+
+ fchown(cupsFileNumber(*lf), RunUser, Group);
+ fchmod(cupsFileNumber(*lf), LogFilePerm);
+ }
+ }
+
+ /*
* Do we need to rotate the log?
*/
fchown(cupsFileNumber(*lf), RunUser, Group);
fchmod(cupsFileNumber(*lf), LogFilePerm);

View File

@ -1,7 +1,7 @@
diff -up cups-2.0.3/config.h.in.lspp cups-2.0.3/config.h.in
--- cups-2.0.3/config.h.in.lspp 2014-12-09 21:50:51.000000000 +0100
+++ cups-2.0.3/config.h.in 2015-06-09 17:38:42.803451529 +0200
@@ -716,6 +716,13 @@ static __inline int _cups_abs(int i) { r
diff -up cups-2.1b1/config.h.in.lspp cups-2.1b1/config.h.in
--- cups-2.1b1/config.h.in.lspp 2015-06-03 19:19:04.000000000 +0200
+++ cups-2.1b1/config.h.in 2015-06-29 13:32:27.084427729 +0200
@@ -737,6 +737,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.0.3/config.h.in.lspp cups-2.0.3/config.h.in
#endif /* !_CUPS_CONFIG_H_ */
/*
diff -up cups-2.0.3/config-scripts/cups-lspp.m4.lspp cups-2.0.3/config-scripts/cups-lspp.m4
--- cups-2.0.3/config-scripts/cups-lspp.m4.lspp 2015-06-09 17:38:42.803451529 +0200
+++ cups-2.0.3/config-scripts/cups-lspp.m4 2015-06-09 17:38:42.803451529 +0200
diff -up cups-2.1b1/config-scripts/cups-lspp.m4.lspp cups-2.1b1/config-scripts/cups-lspp.m4
--- cups-2.1b1/config-scripts/cups-lspp.m4.lspp 2015-06-29 13:32:27.084427729 +0200
+++ cups-2.1b1/config-scripts/cups-lspp.m4 2015-06-29 13:32:27.084427729 +0200
@@ -0,0 +1,36 @@
+dnl
+dnl LSPP code for the Common UNIX Printing System (CUPS).
@ -55,9 +55,9 @@ diff -up cups-2.0.3/config-scripts/cups-lspp.m4.lspp cups-2.0.3/config-scripts/c
+ ;;
+ esac
+fi
diff -up cups-2.0.3/configure.ac.lspp cups-2.0.3/configure.ac
--- cups-2.0.3/configure.ac.lspp 2014-10-21 13:55:01.000000000 +0200
+++ cups-2.0.3/configure.ac 2015-06-09 17:38:42.803451529 +0200
diff -up cups-2.1b1/configure.ac.lspp cups-2.1b1/configure.ac
--- cups-2.1b1/configure.ac.lspp 2014-12-01 14:53:56.000000000 +0100
+++ cups-2.1b1/configure.ac 2015-06-29 13:32:27.084427729 +0200
@@ -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.0.3/configure.ac.lspp cups-2.0.3/configure.ac
INSTALL_LANGUAGES=""
UNINSTALL_LANGUAGES=""
LANGFILES=""
diff -up cups-2.0.3/filter/common.c.lspp cups-2.0.3/filter/common.c
--- cups-2.0.3/filter/common.c.lspp 2014-02-06 19:33:34.000000000 +0100
+++ cups-2.0.3/filter/common.c 2015-06-09 17:38:42.804451526 +0200
diff -up cups-2.1b1/filter/common.c.lspp cups-2.1b1/filter/common.c
--- cups-2.1b1/filter/common.c.lspp 2014-02-06 19:33:34.000000000 +0100
+++ cups-2.1b1/filter/common.c 2015-06-29 13:32:27.084427729 +0200
@@ -19,6 +19,12 @@
* Include necessary headers...
*/
@ -238,9 +238,9 @@ diff -up cups-2.0.3/filter/common.c.lspp cups-2.0.3/filter/common.c
/*
diff -up cups-2.0.3/filter/pstops.c.lspp cups-2.0.3/filter/pstops.c
--- cups-2.0.3/filter/pstops.c.lspp 2015-05-22 19:27:37.000000000 +0200
+++ cups-2.0.3/filter/pstops.c 2015-06-09 17:38:42.804451526 +0200
diff -up cups-2.1b1/filter/pstops.c.lspp cups-2.1b1/filter/pstops.c
--- cups-2.1b1/filter/pstops.c.lspp 2015-05-22 19:26:40.000000000 +0200
+++ cups-2.1b1/filter/pstops.c 2015-06-29 13:32:27.085427726 +0200
@@ -3178,6 +3178,18 @@ write_label_prolog(pstops_doc_t *doc, /*
{
const char *classification; /* CLASSIFICATION environment variable */
@ -396,9 +396,9 @@ diff -up cups-2.0.3/filter/pstops.c.lspp cups-2.0.3/filter/pstops.c
/*
diff -up cups-2.0.3/Makedefs.in.lspp cups-2.0.3/Makedefs.in
--- cups-2.0.3/Makedefs.in.lspp 2015-06-09 17:38:42.762451666 +0200
+++ cups-2.0.3/Makedefs.in 2015-06-09 17:38:42.804451526 +0200
diff -up cups-2.1b1/Makedefs.in.lspp cups-2.1b1/Makedefs.in
--- cups-2.1b1/Makedefs.in.lspp 2015-06-29 13:32:27.040427821 +0200
+++ cups-2.1b1/Makedefs.in 2015-06-29 13:32:27.085427726 +0200
@@ -145,7 +145,7 @@ LDFLAGS = -L../cgi-bin -L../cups -L../f
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(LIBZ)
@ -408,9 +408,9 @@ diff -up cups-2.0.3/Makedefs.in.lspp cups-2.0.3/Makedefs.in
ONDEMANDFLAGS = @ONDEMANDFLAGS@
ONDEMANDLIBS = @ONDEMANDLIBS@
OPTIM = @OPTIM@
diff -up cups-2.0.3/scheduler/client.c.lspp cups-2.0.3/scheduler/client.c
--- cups-2.0.3/scheduler/client.c.lspp 2015-06-08 20:33:44.000000000 +0200
+++ cups-2.0.3/scheduler/client.c 2015-06-09 17:38:42.806451519 +0200
diff -up cups-2.1b1/scheduler/client.c.lspp cups-2.1b1/scheduler/client.c
--- cups-2.1b1/scheduler/client.c.lspp 2015-06-29 13:32:26.998427910 +0200
+++ cups-2.1b1/scheduler/client.c 2015-06-29 13:32:27.085427726 +0200
@@ -24,12 +24,20 @@
#define _HTTP_NO_PRIVATE
#include "cupsd.h"
@ -580,7 +580,7 @@ diff -up cups-2.0.3/scheduler/client.c.lspp cups-2.0.3/scheduler/client.c
if (httpGetState(con->http) != HTTP_STATE_POST_SEND)
{
if (!httpWait(con->http, 0))
@@ -3433,6 +3568,49 @@ is_path_absolute(const char *path) /* I
@@ -3440,6 +3575,49 @@ is_path_absolute(const char *path) /* I
return (1);
}
@ -630,9 +630,9 @@ diff -up cups-2.0.3/scheduler/client.c.lspp cups-2.0.3/scheduler/client.c
/*
* 'pipe_command()' - Pipe the output of a command to the remote client.
diff -up cups-2.0.3/scheduler/client.h.lspp cups-2.0.3/scheduler/client.h
--- cups-2.0.3/scheduler/client.h.lspp 2014-03-21 17:42:53.000000000 +0100
+++ cups-2.0.3/scheduler/client.h 2015-06-09 17:38:42.806451519 +0200
diff -up cups-2.1b1/scheduler/client.h.lspp cups-2.1b1/scheduler/client.h
--- cups-2.1b1/scheduler/client.h.lspp 2014-03-21 17:42:53.000000000 +0100
+++ cups-2.1b1/scheduler/client.h 2015-06-29 13:32:27.085427726 +0200
@@ -18,6 +18,13 @@
#endif /* HAVE_AUTHORIZATION_H */
@ -668,10 +668,10 @@ diff -up cups-2.0.3/scheduler/client.h.lspp cups-2.0.3/scheduler/client.h
#ifdef HAVE_SSL
extern int cupsdEndTLS(cupsd_client_t *con);
diff -up cups-2.0.3/scheduler/conf.c.lspp cups-2.0.3/scheduler/conf.c
--- cups-2.0.3/scheduler/conf.c.lspp 2015-06-09 17:38:42.802451532 +0200
+++ cups-2.0.3/scheduler/conf.c 2015-06-09 17:38:42.807451516 +0200
@@ -36,6 +36,9 @@
diff -up cups-2.1b1/scheduler/conf.c.lspp cups-2.1b1/scheduler/conf.c
--- cups-2.1b1/scheduler/conf.c.lspp 2015-06-29 13:32:27.082427733 +0200
+++ cups-2.1b1/scheduler/conf.c 2015-06-29 13:32:27.086427724 +0200
@@ -42,6 +42,9 @@
# define INADDR_NONE 0xffffffff
#endif /* !INADDR_NONE */
@ -681,7 +681,7 @@ diff -up cups-2.0.3/scheduler/conf.c.lspp cups-2.0.3/scheduler/conf.c
/*
* Configuration variable structure...
@@ -127,6 +130,10 @@ static const cupsd_var_t cupsd_vars[] =
@@ -133,6 +136,10 @@ static const cupsd_var_t cupsd_vars[] =
{ "ServerName", &ServerName, CUPSD_VARTYPE_STRING },
{ "StrictConformance", &StrictConformance, CUPSD_VARTYPE_BOOLEAN },
{ "Timeout", &Timeout, CUPSD_VARTYPE_TIME },
@ -692,7 +692,7 @@ diff -up cups-2.0.3/scheduler/conf.c.lspp cups-2.0.3/scheduler/conf.c
{ "WebInterface", &WebInterface, CUPSD_VARTYPE_BOOLEAN }
};
static const cupsd_var_t cupsfiles_vars[] =
@@ -524,6 +531,9 @@ cupsdReadConfiguration(void)
@@ -579,6 +586,9 @@ cupsdReadConfiguration(void)
const char *tmpdir; /* TMPDIR environment variable */
struct stat tmpinfo; /* Temporary directory info */
cupsd_policy_t *p; /* Policy */
@ -702,7 +702,7 @@ diff -up cups-2.0.3/scheduler/conf.c.lspp cups-2.0.3/scheduler/conf.c
/*
@@ -831,6 +841,25 @@ cupsdReadConfiguration(void)
@@ -933,6 +943,25 @@ cupsdReadConfiguration(void)
RunUser = getuid();
@ -728,7 +728,7 @@ diff -up cups-2.0.3/scheduler/conf.c.lspp cups-2.0.3/scheduler/conf.c
cupsdLogMessage(CUPSD_LOG_INFO, "Remote access is %s.",
RemotePort ? "enabled" : "disabled");
@@ -1225,7 +1254,19 @@ cupsdReadConfiguration(void)
@@ -1352,7 +1381,19 @@ cupsdReadConfiguration(void)
cupsdClearString(&Classification);
if (Classification)
@ -748,7 +748,7 @@ diff -up cups-2.0.3/scheduler/conf.c.lspp cups-2.0.3/scheduler/conf.c
/*
* Check the MaxClients setting, and then allocate memory for it...
@@ -3702,6 +3743,18 @@ read_location(cups_file_t *fp, /* I - C
@@ -3829,6 +3870,18 @@ read_location(cups_file_t *fp, /* I - C
return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
}
@ -767,10 +767,10 @@ diff -up cups-2.0.3/scheduler/conf.c.lspp cups-2.0.3/scheduler/conf.c
/*
* 'read_policy()' - Read a <Policy name> definition.
diff -up cups-2.0.3/scheduler/conf.h.lspp cups-2.0.3/scheduler/conf.h
--- cups-2.0.3/scheduler/conf.h.lspp 2015-06-09 17:38:42.799451542 +0200
+++ cups-2.0.3/scheduler/conf.h 2015-06-09 17:38:42.807451516 +0200
@@ -248,6 +248,13 @@ VAR char *ServerKeychain VALUE(NULL);
diff -up cups-2.1b1/scheduler/conf.h.lspp cups-2.1b1/scheduler/conf.h
--- cups-2.1b1/scheduler/conf.h.lspp 2015-06-29 13:32:27.002427901 +0200
+++ cups-2.1b1/scheduler/conf.h 2015-06-29 13:32:27.086427724 +0200
@@ -250,6 +250,13 @@ VAR char *ServerKeychain VALUE(NULL);
/* Keychain holding cert + key */
#endif /* HAVE_SSL */
@ -784,7 +784,7 @@ diff -up cups-2.0.3/scheduler/conf.h.lspp cups-2.0.3/scheduler/conf.h
#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
VAR int IdleExitTimeout VALUE(60);
/* Time after which an idle cupsd will exit */
@@ -266,6 +273,9 @@ int HaveServerCreds VALUE(0);
@@ -268,6 +275,9 @@ int HaveServerCreds VALUE(0);
gss_cred_id_t ServerCreds; /* Server's GSS credentials */
#endif /* HAVE_GSSAPI */
@ -794,9 +794,9 @@ diff -up cups-2.0.3/scheduler/conf.h.lspp cups-2.0.3/scheduler/conf.h
/*
* Prototypes...
diff -up cups-2.0.3/scheduler/cupsd.h.lspp cups-2.0.3/scheduler/cupsd.h
--- cups-2.0.3/scheduler/cupsd.h.lspp 2015-06-09 17:38:42.791451569 +0200
+++ cups-2.0.3/scheduler/cupsd.h 2015-06-09 17:38:42.807451516 +0200
diff -up cups-2.1b1/scheduler/cupsd.h.lspp cups-2.1b1/scheduler/cupsd.h
--- cups-2.1b1/scheduler/cupsd.h.lspp 2015-06-29 13:32:27.072427754 +0200
+++ cups-2.1b1/scheduler/cupsd.h 2015-06-29 13:32:27.086427724 +0200
@@ -13,6 +13,8 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -828,9 +828,9 @@ diff -up cups-2.0.3/scheduler/cupsd.h.lspp cups-2.0.3/scheduler/cupsd.h
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
--- cups-2.0.3/scheduler/ipp.c.lspp 2015-06-09 17:38:42.740451739 +0200
+++ cups-2.0.3/scheduler/ipp.c 2015-06-09 17:41:48.818829874 +0200
diff -up cups-2.1b1/scheduler/ipp.c.lspp cups-2.1b1/scheduler/ipp.c
--- cups-2.1b1/scheduler/ipp.c.lspp 2015-06-29 13:32:27.025427853 +0200
+++ cups-2.1b1/scheduler/ipp.c 2015-06-29 13:32:27.088427720 +0200
@@ -16,6 +16,9 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -866,7 +866,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
static int check_quotas(cupsd_client_t *con, cupsd_printer_t *p);
static void close_job(cupsd_client_t *con, ipp_attribute_t *uri);
static void copy_attrs(ipp_t *to, ipp_t *from, cups_array_t *ra,
@@ -1214,6 +1228,21 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1236,6 +1250,21 @@ add_job(cupsd_client_t *con, /* I - Cl
"time-at-creation",
"time-at-processing"
};
@ -888,7 +888,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %p(%s), %p(%s/%s))",
@@ -1530,6 +1559,106 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1547,6 +1576,106 @@ add_job(cupsd_client_t *con, /* I - Cl
return (NULL);
}
@ -995,7 +995,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
if ((job = cupsdAddJob(priority, printer->name)) == NULL)
{
send_ipp_status(con, IPP_INTERNAL_ERROR,
@@ -1538,6 +1667,32 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1555,6 +1684,32 @@ add_job(cupsd_client_t *con, /* I - Cl
return (NULL);
}
@ -1028,7 +1028,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
job->dtype = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
job->attrs = con->request;
job->dirty = 1;
@@ -1711,6 +1866,29 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1727,6 +1882,29 @@ add_job(cupsd_client_t *con, /* I - Cl
ippSetString(job->attrs, &attr, 0, printer->job_sheets[0]);
ippSetString(job->attrs, &attr, 1, printer->job_sheets[1]);
}
@ -1058,7 +1058,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
job->job_sheets = attr;
@@ -1741,6 +1919,9 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1757,6 +1935,9 @@ add_job(cupsd_client_t *con, /* I - Cl
"job-sheets=\"%s,none\", "
"job-originating-user-name=\"%s\"",
Classification, job->username);
@ -1068,7 +1068,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
}
else if (attr->num_values == 2 &&
strcmp(attr->values[0].string.text,
@@ -1759,6 +1940,9 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1775,6 +1956,9 @@ add_job(cupsd_client_t *con, /* I - Cl
"job-originating-user-name=\"%s\"",
attr->values[0].string.text,
attr->values[1].string.text, job->username);
@ -1078,7 +1078,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
}
else if (strcmp(attr->values[0].string.text, Classification) &&
strcmp(attr->values[0].string.text, "none") &&
@@ -1779,6 +1963,9 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1795,6 +1979,9 @@ add_job(cupsd_client_t *con, /* I - Cl
"job-originating-user-name=\"%s\"",
attr->values[0].string.text,
attr->values[1].string.text, job->username);
@ -1088,7 +1088,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
}
}
else if (strcmp(attr->values[0].string.text, Classification) &&
@@ -1819,8 +2006,52 @@ add_job(cupsd_client_t *con, /* I - Cl
@@ -1835,8 +2022,52 @@ add_job(cupsd_client_t *con, /* I - Cl
"job-sheets=\"%s\", "
"job-originating-user-name=\"%s\"",
Classification, job->username);
@ -1141,7 +1141,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
/*
* See if we need to add the starting sheet...
@@ -3591,6 +3822,128 @@ check_rss_recipient(
@@ -3619,6 +3850,128 @@ check_rss_recipient(
}
@ -1270,7 +1270,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
/*
* 'check_quotas()' - Check quotas for a printer and user.
*/
@@ -4047,6 +4400,15 @@ copy_banner(cupsd_client_t *con, /* I -
@@ -4075,6 +4428,15 @@ copy_banner(cupsd_client_t *con, /* I -
char attrname[255], /* Name of attribute */
*s; /* Pointer into name */
ipp_attribute_t *attr; /* Attribute */
@ -1286,7 +1286,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
cupsdLogMessage(CUPSD_LOG_DEBUG2,
@@ -4082,6 +4444,85 @@ copy_banner(cupsd_client_t *con, /* I -
@@ -4110,6 +4472,85 @@ copy_banner(cupsd_client_t *con, /* I -
fchmod(cupsFileNumber(out), 0640);
fchown(cupsFileNumber(out), RunUser, Group);
@ -1372,7 +1372,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
/*
* Try the localized banner file under the subdirectory...
@@ -4176,6 +4617,24 @@ copy_banner(cupsd_client_t *con, /* I -
@@ -4204,6 +4645,24 @@ copy_banner(cupsd_client_t *con, /* I -
else
s = attrname;
@ -1397,7 +1397,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
if (!strcmp(s, "printer-name"))
{
cupsFilePuts(out, job->dest);
@@ -6086,6 +6545,22 @@ get_job_attrs(cupsd_client_t *con, /* I
@@ -6130,6 +6589,22 @@ get_job_attrs(cupsd_client_t *con, /* I
exclude = cupsdGetPrivateAttrs(policy, con, printer, job->username);
@ -1420,7 +1420,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
/*
* Copy attributes...
*/
@@ -6485,6 +6960,11 @@ get_jobs(cupsd_client_t *con, /* I - C
@@ -6529,6 +7004,11 @@ get_jobs(cupsd_client_t *con, /* I - C
if (username[0] && _cups_strcasecmp(username, job->username))
continue;
@ -1432,7 +1432,7 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
if (count > 0)
ippAddSeparator(con->response);
@@ -11044,6 +11524,11 @@ validate_user(cupsd_job_t *job, /* I
@@ -11145,6 +11625,11 @@ validate_user(cupsd_job_t *job, /* I
strlcpy(username, get_username(con), userlen);
@ -1444,9 +1444,9 @@ diff -up cups-2.0.3/scheduler/ipp.c.lspp cups-2.0.3/scheduler/ipp.c
/*
* Check the username against the owner...
*/
diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
--- cups-2.0.3/scheduler/job.c.lspp 2015-06-09 17:38:42.757451683 +0200
+++ cups-2.0.3/scheduler/job.c 2015-06-09 17:38:42.810451506 +0200
diff -up cups-2.1b1/scheduler/job.c.lspp cups-2.1b1/scheduler/job.c
--- cups-2.1b1/scheduler/job.c.lspp 2015-06-29 13:32:27.053427794 +0200
+++ cups-2.1b1/scheduler/job.c 2015-06-29 13:33:56.985238152 +0200
@@ -13,6 +13,9 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -1472,7 +1472,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
/*
* Design Notes for Job Management
@@ -528,6 +539,14 @@ cupsdContinueJob(cupsd_job_t *job) /* I
@@ -530,6 +541,14 @@ cupsdContinueJob(cupsd_job_t *job) /* I
/* PRINTER_STATE_REASONS env var */
rip_max_cache[255];
/* RIP_MAX_CACHE env variable */
@ -1487,7 +1487,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
cupsdLogMessage(CUPSD_LOG_DEBUG2,
@@ -1064,6 +1083,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I
@@ -1066,6 +1085,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I
if (final_content_type[0])
envp[envc ++] = final_content_type;
@ -1555,7 +1555,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
if (Classification && !banner_page)
{
if ((attr = ippFindAttribute(job->attrs, "job-sheets",
@@ -1857,6 +1937,22 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J
@@ -1889,6 +1969,22 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J
ippSetString(job->attrs, &job->reasons, 0, "none");
}
@ -1575,10 +1575,10 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
+ }
+#endif /* WITH_LSPP */
+
job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed",
IPP_TAG_INTEGER);
job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
@@ -2258,6 +2354,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
job->impressions = ippFindAttribute(job->attrs, "job-impressions-completed", IPP_TAG_INTEGER);
job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed", IPP_TAG_INTEGER);
job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
@@ -2293,6 +2389,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
{
char filename[1024]; /* Job control filename */
cups_file_t *fp; /* Job file */
@ -1593,7 +1593,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p(%d)): job->attrs=%p",
@@ -2270,6 +2374,78 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
@@ -2305,6 +2409,78 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
fchown(cupsFileNumber(fp), RunUser, Group);
@ -1663,7 +1663,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
+ return;
+ }
+ cupsdLogJob(job, CUPSD_LOG_DEBUG2, "New spool file context=%s",
+ job, context_str(tmpcon));
+ context_str(tmpcon));
+ context_free(tmpcon);
+ context_free(jobcon);
+ }
@ -1672,7 +1672,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
job->attrs->state = IPP_IDLE;
if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL,
@@ -3852,6 +4028,19 @@ get_options(cupsd_job_t *job, /* I - Jo
@@ -3887,6 +4063,19 @@ get_options(cupsd_job_t *job, /* I - Jo
banner_page)
continue;
@ -1692,7 +1692,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
/*
* Otherwise add them to the list...
*/
@@ -4596,6 +4785,18 @@ start_job(cupsd_job_t *job, /* I -
@@ -4640,6 +4829,18 @@ start_job(cupsd_job_t *job, /* I -
cupsd_printer_t *printer) /* I - Printer to print job */
{
const char *filename; /* Support filename */
@ -1711,7 +1711,7 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
ipp_attribute_t *cancel_after = ippFindAttribute(job->attrs,
"job-cancel-after",
IPP_TAG_INTEGER);
@@ -4772,6 +4973,113 @@ start_job(cupsd_job_t *job, /* I -
@@ -4816,6 +5017,113 @@ start_job(cupsd_job_t *job, /* I -
fcntl(job->side_pipes[1], F_SETFD,
fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC);
@ -1825,9 +1825,9 @@ diff -up cups-2.0.3/scheduler/job.c.lspp cups-2.0.3/scheduler/job.c
/*
* Now start the first file in the job...
*/
diff -up cups-2.0.3/scheduler/job.h.lspp cups-2.0.3/scheduler/job.h
--- cups-2.0.3/scheduler/job.h.lspp 2014-07-31 02:02:30.000000000 +0200
+++ cups-2.0.3/scheduler/job.h 2015-06-09 17:38:42.810451506 +0200
diff -up cups-2.1b1/scheduler/job.h.lspp cups-2.1b1/scheduler/job.h
--- cups-2.1b1/scheduler/job.h.lspp 2015-05-27 21:30:32.000000000 +0200
+++ cups-2.1b1/scheduler/job.h 2015-06-29 13:32:27.092427712 +0200
@@ -13,6 +13,13 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -1842,7 +1842,7 @@ diff -up cups-2.0.3/scheduler/job.h.lspp cups-2.0.3/scheduler/job.h
/*
* Constants...
*/
@@ -89,6 +96,10 @@ struct cupsd_job_s /**** Job request *
@@ -90,6 +97,10 @@ struct cupsd_job_s /**** Job request *
int progress; /* Printing progress */
int num_keywords; /* Number of PPD keywords */
cups_option_t *keywords; /* PPD keywords */
@ -1853,10 +1853,10 @@ diff -up cups-2.0.3/scheduler/job.h.lspp cups-2.0.3/scheduler/job.h
};
typedef struct cupsd_joblog_s /**** Job log message ****/
diff -up cups-2.0.3/scheduler/main.c.lspp cups-2.0.3/scheduler/main.c
--- cups-2.0.3/scheduler/main.c.lspp 2015-06-09 17:38:42.792451566 +0200
+++ cups-2.0.3/scheduler/main.c 2015-06-09 17:38:42.810451506 +0200
@@ -56,6 +56,9 @@ extern int launch_activate_socket(const
diff -up cups-2.1b1/scheduler/main.c.lspp cups-2.1b1/scheduler/main.c
--- cups-2.1b1/scheduler/main.c.lspp 2015-06-29 13:32:27.073427752 +0200
+++ cups-2.1b1/scheduler/main.c 2015-06-29 13:32:27.093427710 +0200
@@ -62,6 +62,9 @@ extern int launch_activate_socket(const
# include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
@ -1866,7 +1866,7 @@ diff -up cups-2.0.3/scheduler/main.c.lspp cups-2.0.3/scheduler/main.c
/*
* Local functions...
@@ -120,6 +123,9 @@ main(int argc, /* I - Number of comm
@@ -126,6 +129,9 @@ main(int argc, /* I - Number of comm
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
@ -1876,7 +1876,7 @@ diff -up cups-2.0.3/scheduler/main.c.lspp cups-2.0.3/scheduler/main.c
#ifdef __APPLE__
int use_sysman = 1; /* Use system management functions? */
#else
@@ -498,6 +504,25 @@ main(int argc, /* I - Number of comm
@@ -506,6 +512,25 @@ main(int argc, /* I - Number of comm
exit(errno);
}
@ -1902,7 +1902,7 @@ diff -up cups-2.0.3/scheduler/main.c.lspp cups-2.0.3/scheduler/main.c
/*
* Set the timezone info...
*/
@@ -1161,6 +1186,11 @@ main(int argc, /* I - Number of comm
@@ -1180,6 +1205,11 @@ main(int argc, /* I - Number of comm
cupsdStopSelect();
@ -1914,9 +1914,9 @@ diff -up cups-2.0.3/scheduler/main.c.lspp cups-2.0.3/scheduler/main.c
return (!stop_scheduler);
}
diff -up cups-2.0.3/scheduler/printers.c.lspp cups-2.0.3/scheduler/printers.c
--- cups-2.0.3/scheduler/printers.c.lspp 2015-06-09 17:38:42.727451783 +0200
+++ cups-2.0.3/scheduler/printers.c 2015-06-09 17:38:42.811451502 +0200
diff -up cups-2.1b1/scheduler/printers.c.lspp cups-2.1b1/scheduler/printers.c
--- cups-2.1b1/scheduler/printers.c.lspp 2015-06-29 13:32:27.004427897 +0200
+++ cups-2.1b1/scheduler/printers.c 2015-06-29 13:32:27.095427705 +0200
@@ -13,6 +13,8 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@ -1937,7 +1937,7 @@ diff -up cups-2.0.3/scheduler/printers.c.lspp cups-2.0.3/scheduler/printers.c
/*
* Local functions...
@@ -2025,6 +2031,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
@@ -2155,6 +2161,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
ipp_attribute_t *attr; /* Attribute data */
char *name, /* Current user/group name */
*filter; /* Current filter */
@ -1951,7 +1951,7 @@ diff -up cups-2.0.3/scheduler/printers.c.lspp cups-2.0.3/scheduler/printers.c
DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
@@ -2145,6 +2158,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
@@ -2280,6 +2293,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
attr->values[1].string.text = _cupsStrAlloc(Classification ?
Classification : p->job_sheets[1]);
}

View File

@ -1,15 +1,3 @@
diff -up cups-2.0.2/cups/usersys.c.ustTJg cups-2.0.2/cups/usersys.c
--- cups-2.0.2/cups/usersys.c.ustTJg 2015-02-10 13:40:24.294545077 +0100
+++ cups-2.0.2/cups/usersys.c 2015-02-10 13:46:56.763989233 +0100
@@ -1017,7 +1017,7 @@ cups_finalize_client_conf(
struct stat sockinfo; /* Domain socket information */
if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
- (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
+ (sockinfo.st_mode & (S_IROTH | S_IWOTH)) == (S_IROTH | S_IWOTH))
cups_set_server_name(cc, CUPS_DEFAULT_DOMAINSOCKET);
else
#endif /* CUPS_DEFAULT_DOMAINSOCKET */
diff -up cups-2.0.2/scheduler/main.c.ustTJg cups-2.0.2/scheduler/main.c
--- cups-2.0.2/scheduler/main.c.ustTJg 2015-02-10 13:40:24.121547526 +0100
+++ cups-2.0.2/scheduler/main.c 2015-02-10 13:40:24.295545063 +0100

View File

@ -7,14 +7,17 @@
# but we use lib for compatibility with 3rd party drivers (at upstream request).
%global cups_serverbin %{_exec_prefix}/lib/cups
%global prever rc1
%global VERSION %{version}%{prever}
Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.0.4
Release: 1%{?dist}
Version: 2.1
Release: 0.1%{prever}%{?dist}
License: GPLv2
Url: http://www.cups.org/
Source0: http://www.cups.org/software/%{version}/cups-%{version}-source.tar.bz2
Source0: http://www.cups.org/software/%{VERSION}/cups-%{VERSION}-source.tar.bz2
# Pixmap for desktop file
Source2: cupsprinter.png
# Logrotate configuration
@ -180,7 +183,7 @@ lpd emulation.
Sends IPP requests to the specified URI and tests and/or displays the results.
%prep
%setup -q
%setup -q -n cups-%{VERSION}
# Don't gzip man pages in the Makefile, let rpmbuild do it.
%patch1 -p1 -b .no-gzip-man
@ -263,7 +266,7 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in
# Log to the system journal by default (bug #1078781).
sed -i -e 's,^ErrorLog .*$,ErrorLog journal,' conf/cups-files.conf.in
sed -i -e 's,^ErrorLog .*$,ErrorLog syslog,' conf/cups-files.conf.in
# Let's look at the compilation command lines.
perl -pi -e "s,^.SILENT:,," Makedefs.in
@ -404,6 +407,10 @@ for keyword in PageLogFormat; do
/bin/sed -i -e "s,^$keyword,#$keyword,i" "$FILE" || :
done
# We've been using 'journal' name in our journal.patch for couple releases,
# but upstream decided not to use 'journal', but 'syslog'.
sed -i -e 's,^ErrorLog journal,ErrorLog syslog,' %{_sysconfdir}/cups/cups-files.conf
exit 0
%post client
@ -481,12 +488,14 @@ rm -f %{cups_serverbin}/backend/smb
%{_tmpfilesdir}/cups.conf
%{_tmpfilesdir}/cups-lp.conf
%verify(not md5 size mtime) %config(noreplace) %attr(0640,root,lp) %{_sysconfdir}/cups/cupsd.conf
%verify(not md5 size mtime) %config(noreplace) %attr(0640,root,lp) %{_sysconfdir}/cups/cups-files.conf
%attr(0640,root,lp) %{_sysconfdir}/cups/cupsd.conf.default
%verify(not md5 size mtime) %config(noreplace) %attr(0640,root,lp) %{_sysconfdir}/cups/cups-files.conf
%attr(0640,root,lp) %{_sysconfdir}/cups/cups-files.conf.default
%verify(not md5 size mtime) %config(noreplace) %attr(0644,root,lp) %{_sysconfdir}/cups/client.conf
%verify(not md5 size mtime) %config(noreplace) %attr(0600,root,lp) %{_sysconfdir}/cups/classes.conf
%verify(not md5 size mtime) %config(noreplace) %attr(0600,root,lp) %{_sysconfdir}/cups/printers.conf
%verify(not md5 size mtime) %config(noreplace) %attr(0644,root,lp) %{_sysconfdir}/cups/snmp.conf
%attr(0640,root,lp) %{_sysconfdir}/cups/snmp.conf.default
%verify(not md5 size mtime) %config(noreplace) %attr(0644,root,lp) %{_sysconfdir}/cups/subscriptions.conf
%{_sysconfdir}/cups/interfaces
%verify(not md5 size mtime) %config(noreplace) %attr(0644,root,lp) %{_sysconfdir}/cups/lpoptions
@ -612,6 +621,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz
%changelog
* Mon Aug 10 2015 Jiri Popelka <jpopelka@redhat.com> - 1:2.1-0.1rc1
- 2.1rc1
* Mon Aug 10 2015 Jiri Popelka <jpopelka@redhat.com> - 1:2.0.4-1
- 2.0.4

View File

@ -1 +1 @@
f5c847d9a4fac6c4c66fb0526a7afaae cups-2.0.4-source.tar.bz2
18f90dfee618598d541e664f7d73304e cups-2.1rc1-source.tar.bz2