From 670e47386494d0c22245c1a9a44a683c96d0138e Mon Sep 17 00:00:00 2001
From: Tim Waugh
Date: Thu, 6 Nov 2014 13:42:50 +0000
Subject: [PATCH 1/2] New systemd journal fields CUPS_DEST and CUPS_PRINTER, as
well as accurate code location fields.
---
cups-journal.patch | 532 +++++++++++++++++++++++++-------------
cups-systemd-socket.patch | 8 +-
cups.spec | 6 +-
3 files changed, 361 insertions(+), 185 deletions(-)
diff --git a/cups-journal.patch b/cups-journal.patch
index debf83d..7d8cd97 100644
--- a/cups-journal.patch
+++ b/cups-journal.patch
@@ -1,50 +1,55 @@
-diff -up cups-1.7.1/config.h.in.journal cups-1.7.1/config.h.in
---- cups-1.7.1/config.h.in.journal 2014-02-17 16:48:19.089795987 +0000
-+++ cups-1.7.1/config.h.in 2014-02-17 16:48:19.136796218 +0000
-@@ -458,6 +458,13 @@
+diff -up cups-1.7.5/conf/cups-files.conf.in.journal cups-1.7.5/conf/cups-files.conf.in
+--- cups-1.7.5/conf/cups-files.conf.in.journal 2013-07-26 22:27:27.000000000 +0100
++++ cups-1.7.5/conf/cups-files.conf.in 2014-11-05 17:57:42.011621332 +0000
+@@ -30,9 +30,10 @@ SystemGroup @CUPS_SYSTEM_GROUPS@
+ #ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@
+ #LogFilePerm 0@CUPS_LOG_FILE_PERM@
+-# 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
- /*
-+ * Do we have systemd-journal support?
-+ */
-+
-+#undef HAVE_JOURNAL
-+
-+
-+/*
- * Various scripting languages...
- */
+ # Location of cache files used by the scheduler...
+@@ -44,11 +45,11 @@ AccessLog @CUPS_LOGDIR@/access_log
+ # Location of the static web content served by the scheduler...
+ #DocumentRoot @CUPS_DOCROOT@
-diff -up cups-1.7.1/config-scripts/cups-systemd.m4.journal cups-1.7.1/config-scripts/cups-systemd.m4
---- cups-1.7.1/config-scripts/cups-systemd.m4.journal 2014-02-17 16:48:19.089795987 +0000
-+++ cups-1.7.1/config-scripts/cups-systemd.m4 2014-02-17 16:48:19.136796218 +0000
-@@ -22,6 +22,15 @@ if test "x$with_systemdsystemunitdir" !=
- fi
- fi
+-# 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
-+SDJLIBS=""
-+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
- if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then
- SYSTEMD_UNITS="cups.service cups.socket cups.path"
- else
-@@ -30,6 +39,7 @@ fi
+ # Location of fonts used by older print filters...
+ #FontPath @CUPS_FONTPATH@
+@@ -56,10 +57,10 @@ ErrorLog @CUPS_LOGDIR@/error_log
+ # Location of LPD configuration
+ #LPDConfigFile @CUPS_DEFAULT_LPD_CONFIG_FILE@
- AC_SUBST(SYSTEMD_UNITS)
- AC_SUBST(SDLIBS)
-+AC_SUBST(SDJLIBS)
+-# 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
- dnl
- dnl "$Id$"
-diff -up cups-1.7.1/doc/help/ref-cups-files-conf.html.in.journal cups-1.7.1/doc/help/ref-cups-files-conf.html.in
---- cups-1.7.1/doc/help/ref-cups-files-conf.html.in.journal 2014-02-17 17:06:11.652078495 +0000
-+++ cups-1.7.1/doc/help/ref-cups-files-conf.html.in 2014-02-17 17:11:50.675752398 +0000
+ # Location of the file listing all of the local printers...
+diff -up cups-1.7.5/doc/help/ref-cups-files-conf.html.in.journal cups-1.7.5/doc/help/ref-cups-files-conf.html.in
+--- cups-1.7.5/doc/help/ref-cups-files-conf.html.in.journal 2013-07-26 22:27:27.000000000 +0100
++++ cups-1.7.5/doc/help/ref-cups-files-conf.html.in 2014-11-05 17:57:42.012621337 +0000
@@ -18,6 +18,7 @@
AccessLog /var/log/cups/access_log
AccessLog /var/log/cups/access_log-%s
@@ -58,7 +63,7 @@ diff -up cups-1.7.1/doc/help/ref-cups-files-conf.html.in.journal cups-1.7.1/doc/
information to the system log instead of a plain file.
+The special name "journal" can be used to send the access
-+information to the system log instead of a plain file.
++information to the systemd journal instead of a plain file.
+
The default access log file is
/var/log/access_log.
@@ -76,7 +81,7 @@ diff -up cups-1.7.1/doc/help/ref-cups-files-conf.html.in.journal cups-1.7.1/doc/
information to the system log instead of a plain file.
+The special name "journal" can be used to send the error
-+information to the system journal instead of a plain file. Information
++information to the systemd journal instead of a plain file. Information
+relating to a specific job is logged with the field
+CUPS_JOB_ID
filled in.
+
@@ -103,20 +108,9 @@ diff -up cups-1.7.1/doc/help/ref-cups-files-conf.html.in.journal cups-1.7.1/doc/
-diff -up cups-1.7.1/Makedefs.in.journal cups-1.7.1/Makedefs.in
---- cups-1.7.1/Makedefs.in.journal 2014-02-17 16:48:19.090795992 +0000
-+++ cups-1.7.1/Makedefs.in 2014-02-17 16:48:19.136796218 +0000
-@@ -143,6 +143,7 @@ IPPFIND_BIN = @IPPFIND_BIN@
- IPPFIND_MAN = @IPPFIND_MAN@
- LAUNCHDLIBS = @LAUNCHDLIBS@
- SDLIBS = @SDLIBS@
-+SDJLIBS = @SDJLIBS@
- LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
- -L../scheduler @LDARCHFLAGS@ \
- @LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
-diff -up cups-1.7.1/man/cups-files.conf.man.in.journal cups-1.7.1/man/cups-files.conf.man.in
---- cups-1.7.1/man/cups-files.conf.man.in.journal 2014-02-17 17:05:08.103764935 +0000
-+++ cups-1.7.1/man/cups-files.conf.man.in 2014-02-17 17:06:48.131258521 +0000
+diff -up cups-1.7.5/man/cups-files.conf.man.in.journal cups-1.7.5/man/cups-files.conf.man.in
+--- cups-1.7.5/man/cups-files.conf.man.in.journal 2013-07-26 22:27:27.000000000 +0100
++++ cups-1.7.5/man/cups-files.conf.man.in 2014-11-05 17:57:42.013621342 +0000
@@ -29,6 +29,8 @@ on-line help for detailed descriptions:
AccessLog filename
.TP 5
@@ -144,9 +138,9 @@ diff -up cups-1.7.1/man/cups-files.conf.man.in.journal cups-1.7.1/man/cups-files
.br
Specifies the page log filename.
.TP 5
-diff -up cups-1.7.1/scheduler/conf.c.journal cups-1.7.1/scheduler/conf.c
---- cups-1.7.1/scheduler/conf.c.journal 2014-02-17 16:48:19.047795781 +0000
-+++ cups-1.7.1/scheduler/conf.c 2014-02-17 16:48:19.137796223 +0000
+diff -up cups-1.7.5/scheduler/conf.c.journal cups-1.7.5/scheduler/conf.c
+--- cups-1.7.5/scheduler/conf.c.journal 2014-11-05 17:57:41.938620961 +0000
++++ cups-1.7.5/scheduler/conf.c 2014-11-05 17:57:42.013621342 +0000
@@ -950,9 +950,9 @@ cupsdReadConfiguration(void)
*/
@@ -177,22 +171,93 @@ diff -up cups-1.7.1/scheduler/conf.c.journal cups-1.7.1/scheduler/conf.c
cupsdCheckLogFile(&PageFile, PageLog);
/*
-diff -up cups-1.7.1/scheduler/conf.h.journal cups-1.7.1/scheduler/conf.h
---- cups-1.7.1/scheduler/conf.h.journal 2014-02-17 16:48:19.048795786 +0000
-+++ cups-1.7.1/scheduler/conf.h 2014-02-17 16:48:19.138796228 +0000
-@@ -297,6 +297,8 @@ extern int cupsdLogMessage(int level, co
+diff -up cups-1.7.5/scheduler/conf.h.journal cups-1.7.5/scheduler/conf.h
+--- cups-1.7.5/scheduler/conf.h.journal 2014-11-05 17:57:41.938620961 +0000
++++ cups-1.7.5/scheduler/conf.h 2014-11-05 17:57:42.014621347 +0000
+@@ -290,16 +290,69 @@ extern int cupsdLogGSSMessage(int level,
+ int 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-1.7.1/scheduler/log.c.journal cups-1.7.1/scheduler/log.c
---- cups-1.7.1/scheduler/log.c.journal 2014-02-17 16:48:19.073795909 +0000
-+++ cups-1.7.1/scheduler/log.c 2014-02-17 16:48:19.138796228 +0000
-@@ -21,6 +21,7 @@
++#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 11202 2013-07-26 21:31:54Z msweet $".
+ */
+diff -up cups-1.7.5/scheduler/log.c.journal cups-1.7.5/scheduler/log.c
+--- cups-1.7.5/scheduler/log.c.journal 2014-11-05 17:57:41.967621108 +0000
++++ cups-1.7.5/scheduler/log.c 2014-11-05 17:58:18.297805575 +0000
+@@ -17,10 +17,11 @@
+ * cupsdCheckLogFile() - Open/rotate a log file if it needs it.
+ * cupsdGetDateTime() - Returns a pointer to a date/time string.
+ * cupsdLogGSSMessage() - Log a GSSAPI error...
+- * cupsdLogJob() - Log a job message.
++ * _cupsdLogJobWithLocation() - Log a job message.
* cupsdLogMessage() - Log a message to the error log file.
* cupsdLogPage() - Log a page to the page log file.
* cupsdLogRequest() - Log an HTTP request in Common Log Format.
@@ -200,53 +265,235 @@ diff -up cups-1.7.1/scheduler/log.c.journal cups-1.7.1/scheduler/log.c
* cupsdWriteErrorLog() - Write a line to the ErrorLog.
* format_log_line() - Format a line for a log file.
*/
-@@ -35,6 +36,9 @@
+@@ -34,7 +35,13 @@
+ #include
#include
#include
++#include
#include
-+#ifdef HAVE_JOURNAL
++#ifdef HAVE_SYSTEMD
++/* We handle location fields ourselves */
++# define SD_JOURNAL_SUPPRESS_LOCATION
+# include
-+#endif /* HAVE_JOURNAL */
++#endif /* HAVE_SYSTEMD */
/*
-@@ -559,8 +563,17 @@ cupsdLogJob(cupsd_job_t *job, /* I - Jo
+@@ -465,21 +472,140 @@ cupsdLogGSSMessage(
+ #endif /* HAVE_GSSAPI */
+
+
++#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 */
+ int status; /* Formatting status */
+
+-
+ /*
+ * See if we want to log this message...
+ */
+@@ -559,8 +685,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
-@@ -789,6 +802,15 @@ cupsdLogPage(cupsd_job_t *job, /* I - J
+@@ -573,10 +705,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 */
+@@ -620,10 +755,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!"));
+ }
+
+
+@@ -789,6 +924,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...
-@@ -964,7 +986,7 @@ cupsdLogRequest(cupsd_client_t *con, /*
+@@ -964,7 +1110,7 @@ cupsdLogRequest(cupsd_client_t *con, /*
* See if we are logging accesses via syslog...
*/
@@ -255,46 +502,33 @@ diff -up cups-1.7.1/scheduler/log.c.journal cups-1.7.1/scheduler/log.c
{
syslog(LOG_INFO,
"REQUEST %s - %s \"%s %s HTTP/%d.%d\" %d " CUPS_LLFMT " %s %s\n",
-@@ -1018,8 +1040,9 @@ cupsdLogRequest(cupsd_client_t *con, /*
+@@ -1018,8 +1164,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 */
{
static const char levels[] = /* Log levels... */
{
-@@ -1036,12 +1059,25 @@ cupsdWriteErrorLog(int level, /*
+@@ -1036,6 +1186,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);
-@@ -1067,6 +1103,18 @@ cupsdWriteErrorLog(int level, /*
+@@ -1067,6 +1221,22 @@ cupsdWriteErrorLog(int level, /*
}
@@ -303,80 +537,18 @@ diff -up cups-1.7.1/scheduler/log.c.journal cups-1.7.1/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-1.7.1/scheduler/Makefile.journal cups-1.7.1/scheduler/Makefile
---- cups-1.7.1/scheduler/Makefile.journal 2014-02-17 16:48:19.124796159 +0000
-+++ cups-1.7.1/scheduler/Makefile 2014-02-17 16:48:19.137796223 +0000
-@@ -383,7 +383,7 @@ cupsd: $(CUPSDOBJS) $(LIBCUPSMIME) ../cu
- $(CC) $(LDFLAGS) -o cupsd $(CUPSDOBJS) -L. -lcupsmime \
- $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
- $(LIBPAPER) $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBS) \
-- $(LIBGSSAPI) $(LIBWRAP) $(SDLIBS)
-+ $(LIBGSSAPI) $(LIBWRAP) $(SDLIBS) $(SDJLIBS)
-
- cupsd-static: $(CUPSDOBJS) libcupsmime.a ../cups/$(LIBCUPSSTATIC)
- echo Linking $@...
-@@ -391,7 +391,7 @@ cupsd-static: $(CUPSDOBJS) libcupsmime.a
- $(LIBZ) $(SSLLIBS) $(LIBSLP) $(LIBLDAP) $(PAMLIBS) \
- ../cups/$(LIBCUPSSTATIC) $(COMMONLIBS) $(LIBZ) $(LIBPAPER) \
- $(LIBMALLOC) $(SERVERLIBS) $(DNSSDLIBS) $(LIBGSSAPI) \
-- $(LIBWRAP) $(SDLIBS)
-+ $(LIBWRAP) $(SDLIBS) $(SDJLIBS)
-
- tls.o: tls-darwin.c tls-gnutls.c tls-openssl.c
-
---- cups-1.7.1/conf/cups-files.conf.in.journal 2014-04-04 13:12:13.923185140 +0100
-+++ cups-1.7.1/conf/cups-files.conf.in 2014-04-04 13:13:10.633430876 +0100
-@@ -30,9 +30,10 @@ SystemGroup @CUPS_SYSTEM_GROUPS@
- #ConfigFilePerm 0@CUPS_CONFIG_FILE_PERM@
- #LogFilePerm 0@CUPS_LOG_FILE_PERM@
-
--# 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
-
- # Location of cache files used by the scheduler...
-@@ -44,10 +45,10 @@ 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.
-+# 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
-
- # Location of fonts used by older print filters...
-@@ -56,10 +57,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 --git a/cups-systemd-socket.patch b/cups-systemd-socket.patch
index a5068bd..464bba7 100644
--- a/cups-systemd-socket.patch
+++ b/cups-systemd-socket.patch
@@ -29,11 +29,11 @@
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [], [with_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)])
+if test "x$with_systemdsystemunitdir" != xno; then
-+ 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)
-+ SDCFLAGS=`$PKGCONFIG --cflags libsystemd-daemon`
-+ SDLIBS=`$PKGCONFIG --libs libsystemd-daemon`
++ SDCFLAGS=`$PKGCONFIG --cflags libsystemd`
++ SDLIBS=`$PKGCONFIG --libs libsystemd`
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+ AC_DEFINE(HAVE_SYSTEMD)
+ else
diff --git a/cups.spec b/cups.spec
index 10ab7b8..98968fb 100644
--- a/cups.spec
+++ b/cups.spec
@@ -11,7 +11,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 1.7.5
-Release: 13%{?dist}
+Release: 14%{?dist}
License: GPLv2
Url: http://www.cups.org/
Source: http://www.cups.org/software/%{version}/cups-%{version}-source.tar.bz2
@@ -688,6 +688,10 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz
%changelog
+* Thu Nov 6 2014 Tim Waugh - 1:1.7.5-14
+- New systemd journal fields CUPS_DEST and CUPS_PRINTER, as well as
+ accurate code location fields.
+
* Wed Oct 22 2014 Tim Waugh - 1:1.7.5-13
- Upstream fix for cupsd crash on restart when colord not available
- (STR #4496).
From d8d714368183cc42d52260bacd2d96b935c9226e Mon Sep 17 00:00:00 2001
From: Tim Waugh
Date: Thu, 6 Nov 2014 13:43:32 +0000
Subject: [PATCH 2/2] Fixed some warnings in cups-lspp.patch.
---
cups-lspp.patch | 185 +++++++++++++++++++++++++-----------------------
cups.spec | 1 +
2 files changed, 96 insertions(+), 90 deletions(-)
diff --git a/cups-lspp.patch b/cups-lspp.patch
index 753aa16..772f0d7 100644
--- a/cups-lspp.patch
+++ b/cups-lspp.patch
@@ -1,7 +1,7 @@
-diff -up cups-1.7.1/config.h.in.lspp cups-1.7.1/config.h.in
---- cups-1.7.1/config.h.in.lspp 2014-01-08 18:43:27.282821790 +0100
-+++ cups-1.7.1/config.h.in 2014-01-08 18:43:27.295821610 +0100
-@@ -717,6 +717,13 @@ static __inline int _cups_abs(int i) { r
+diff -up cups-1.7.5/config.h.in.lspp cups-1.7.5/config.h.in
+--- cups-1.7.5/config.h.in.lspp 2014-11-06 13:38:20.203763326 +0000
++++ cups-1.7.5/config.h.in 2014-11-06 13:38:20.247763561 +0000
+@@ -711,6 +711,13 @@ static __inline int _cups_abs(int i) { r
# endif /* __GNUC__ || __STDC_VERSION__ */
#endif /* !HAVE_ABS && !abs */
@@ -15,9 +15,9 @@ diff -up cups-1.7.1/config.h.in.lspp cups-1.7.1/config.h.in
#endif /* !_CUPS_CONFIG_H_ */
/*
-diff -up cups-1.7.1/config-scripts/cups-lspp.m4.lspp cups-1.7.1/config-scripts/cups-lspp.m4
---- cups-1.7.1/config-scripts/cups-lspp.m4.lspp 2014-01-08 18:43:27.295821610 +0100
-+++ cups-1.7.1/config-scripts/cups-lspp.m4 2014-01-08 18:43:27.295821610 +0100
+diff -up cups-1.7.5/config-scripts/cups-lspp.m4.lspp cups-1.7.5/config-scripts/cups-lspp.m4
+--- cups-1.7.5/config-scripts/cups-lspp.m4.lspp 2014-11-06 13:38:20.247763561 +0000
++++ cups-1.7.5/config-scripts/cups-lspp.m4 2014-11-06 13:38:20.247763561 +0000
@@ -0,0 +1,36 @@
+dnl
+dnl LSPP code for the Common UNIX Printing System (CUPS).
@@ -55,9 +55,9 @@ diff -up cups-1.7.1/config-scripts/cups-lspp.m4.lspp cups-1.7.1/config-scripts/c
+ ;;
+ esac
+fi
-diff -up cups-1.7.1/configure.in.lspp cups-1.7.1/configure.in
---- cups-1.7.1/configure.in.lspp 2014-01-08 18:43:27.228822537 +0100
-+++ cups-1.7.1/configure.in 2014-01-08 18:43:27.296821596 +0100
+diff -up cups-1.7.5/configure.in.lspp cups-1.7.5/configure.in
+--- cups-1.7.5/configure.in.lspp 2014-11-06 13:38:20.204763332 +0000
++++ cups-1.7.5/configure.in 2014-11-06 13:38:20.247763561 +0000
@@ -37,6 +37,8 @@ sinclude(config-scripts/cups-systemd.m4)
sinclude(config-scripts/cups-defaults.m4)
sinclude(config-scripts/cups-scripting.m4)
@@ -67,9 +67,9 @@ diff -up cups-1.7.1/configure.in.lspp cups-1.7.1/configure.in
INSTALL_LANGUAGES=""
UNINSTALL_LANGUAGES=""
LANGFILES=""
-diff -up cups-1.7.1/filter/common.c.lspp cups-1.7.1/filter/common.c
---- cups-1.7.1/filter/common.c.lspp 2013-05-29 13:51:34.000000000 +0200
-+++ cups-1.7.1/filter/common.c 2014-01-08 18:43:27.296821596 +0100
+diff -up cups-1.7.5/filter/common.c.lspp cups-1.7.5/filter/common.c
+--- cups-1.7.5/filter/common.c.lspp 2013-05-29 12:51:34.000000000 +0100
++++ cups-1.7.5/filter/common.c 2014-11-06 13:38:20.247763561 +0000
@@ -30,6 +30,12 @@
* Include necessary headers...
*/
@@ -238,9 +238,9 @@ diff -up cups-1.7.1/filter/common.c.lspp cups-1.7.1/filter/common.c
/*
-diff -up cups-1.7.1/filter/pstops.c.lspp cups-1.7.1/filter/pstops.c
---- cups-1.7.1/filter/pstops.c.lspp 2013-05-29 13:51:34.000000000 +0200
-+++ cups-1.7.1/filter/pstops.c 2014-01-08 18:43:27.297821582 +0100
+diff -up cups-1.7.5/filter/pstops.c.lspp cups-1.7.5/filter/pstops.c
+--- cups-1.7.5/filter/pstops.c.lspp 2013-05-29 12:51:34.000000000 +0100
++++ cups-1.7.5/filter/pstops.c 2014-11-06 13:38:20.248763567 +0000
@@ -3203,6 +3203,18 @@ write_label_prolog(pstops_doc_t *doc, /*
{
const char *classification; /* CLASSIFICATION environment variable */
@@ -396,10 +396,10 @@ diff -up cups-1.7.1/filter/pstops.c.lspp cups-1.7.1/filter/pstops.c
/*
-diff -up cups-1.7.1/Makedefs.in.lspp cups-1.7.1/Makedefs.in
---- cups-1.7.1/Makedefs.in.lspp 2014-01-08 18:43:27.282821790 +0100
-+++ cups-1.7.1/Makedefs.in 2014-01-08 18:43:27.295821610 +0100
-@@ -149,7 +149,7 @@ LDFLAGS = -L../cgi-bin -L../cups -L../f
+diff -up cups-1.7.5/Makedefs.in.lspp cups-1.7.5/Makedefs.in
+--- cups-1.7.5/Makedefs.in.lspp 2014-11-06 13:38:20.205763337 +0000
++++ cups-1.7.5/Makedefs.in 2014-11-06 13:38:20.248763567 +0000
+@@ -148,7 +148,7 @@ LDFLAGS = -L../cgi-bin -L../cups -L../f
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ)
LINKCUPSIMAGE = @LINKCUPSIMAGE@
@@ -408,10 +408,10 @@ diff -up cups-1.7.1/Makedefs.in.lspp cups-1.7.1/Makedefs.in
OPTIM = @OPTIM@
OPTIONS =
PAMLIBS = @PAMLIBS@
-diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
---- cups-1.7.1/scheduler/client.c.lspp 2013-09-27 16:09:25.000000000 +0200
-+++ cups-1.7.1/scheduler/client.c 2014-01-08 18:43:27.298821568 +0100
-@@ -49,6 +50,7 @@
+diff -up cups-1.7.5/scheduler/client.c.lspp cups-1.7.5/scheduler/client.c
+--- cups-1.7.5/scheduler/client.c.lspp 2014-11-06 13:38:20.233763487 +0000
++++ cups-1.7.5/scheduler/client.c 2014-11-06 13:39:01.130981978 +0000
+@@ -22,6 +22,7 @@
#include "cupsd.h"
@@ -419,7 +419,7 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
#ifdef __APPLE__
# include
#endif /* __APPLE__ */
-@@ -56,6 +58,11 @@
+@@ -29,6 +30,11 @@
# include
#endif /* HAVE_TCPD_H */
@@ -431,7 +431,7 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
/*
* Local globals...
-@@ -378,6 +385,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
+@@ -351,6 +357,57 @@ cupsdAcceptClient(cupsd_listener_t *lis)
}
#endif /* HAVE_TCPD_H */
@@ -489,7 +489,7 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
#ifdef AF_LOCAL
if (con->http.hostaddr->addr.sa_family == AF_LOCAL)
{
-@@ -714,6 +772,13 @@ cupsdReadClient(cupsd_client_t *con) /*
+@@ -687,6 +744,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 */
@@ -503,7 +503,7 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
status = HTTP_CONTINUE;
-@@ -2231,6 +2296,67 @@ cupsdReadClient(cupsd_client_t *con) /*
+@@ -2207,6 +2271,72 @@ cupsdReadClient(cupsd_client_t *con) /*
fchmod(con->file, 0640);
fchown(con->file, RunUser, Group);
fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC);
@@ -513,7 +513,8 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
+ if (getfilecon(con->filename, &spoolcon) == -1)
+ {
+ cupsdSendError(con, HTTP_SERVER_ERROR, CUPSD_AUTH_NONE);
-+ return (cupsdCloseClient(con));
++ cupsdCloseClient(con);
++ return;
+ }
+ clicon = context_new(con->scon);
+ tmpcon = context_new(spoolcon);
@@ -525,7 +526,8 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
+ context_free(clicon);
+ if (tmpcon)
+ context_free(tmpcon);
-+ return (cupsdCloseClient(con));
++ cupsdCloseClient(con);
++ return;
+ }
+ clirange = context_range_get(clicon);
+ if (clirange)
@@ -539,7 +541,8 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
+ free(clirange);
+ context_free(tmpcon);
+ context_free(clicon);
-+ return (cupsdCloseClient(con));
++ cupsdCloseClient(con);
++ return;
+ }
+ }
+ else
@@ -550,7 +553,8 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
+ free(clirange);
+ context_free(tmpcon);
+ context_free(clicon);
-+ return (cupsdCloseClient(con));
++ cupsdCloseClient(con);
++ return;
+ }
+ }
+ free(clirange);
@@ -560,7 +564,8 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
+ cupsdSendError(con, HTTP_SERVER_ERROR, CUPSD_AUTH_NONE);
+ context_free(tmpcon);
+ context_free(clicon);
-+ return (cupsdCloseClient(con));
++ cupsdCloseClient(con);
++ return;
+ }
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdReadClient: %s set to %s",
+ con->filename, context_str(tmpcon));
@@ -571,7 +576,7 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
}
if (con->http.state != HTTP_STATE_POST_SEND)
-@@ -3727,6 +3853,49 @@ is_path_absolute(const char *path) /* I
+@@ -3777,6 +3907,49 @@ is_path_absolute(const char *path) /* I
return (1);
}
@@ -621,9 +626,9 @@ diff -up cups-1.7.1/scheduler/client.c.lspp cups-1.7.1/scheduler/client.c
/*
* 'pipe_command()' - Pipe the output of a command to the remote client.
-diff -up cups-1.7.1/scheduler/client.h.lspp cups-1.7.1/scheduler/client.h
---- cups-1.7.1/scheduler/client.h.lspp 2014-01-08 18:43:27.231822495 +0100
-+++ cups-1.7.1/scheduler/client.h 2014-01-08 18:43:27.298821568 +0100
+diff -up cups-1.7.5/scheduler/client.h.lspp cups-1.7.5/scheduler/client.h
+--- cups-1.7.5/scheduler/client.h.lspp 2014-11-06 13:38:20.205763337 +0000
++++ cups-1.7.5/scheduler/client.h 2014-11-06 13:38:20.249763572 +0000
@@ -18,6 +18,13 @@
#endif /* HAVE_AUTHORIZATION_H */
@@ -659,9 +664,9 @@ diff -up cups-1.7.1/scheduler/client.h.lspp cups-1.7.1/scheduler/client.h
#ifdef HAVE_SSL
extern int cupsdEndTLS(cupsd_client_t *con);
-diff -up cups-1.7.1/scheduler/conf.c.lspp cups-1.7.1/scheduler/conf.c
---- cups-1.7.1/scheduler/conf.c.lspp 2014-01-08 18:43:27.291821665 +0100
-+++ cups-1.7.1/scheduler/conf.c 2014-01-08 18:43:27.300821540 +0100
+diff -up cups-1.7.5/scheduler/conf.c.lspp cups-1.7.5/scheduler/conf.c
+--- cups-1.7.5/scheduler/conf.c.lspp 2014-11-06 13:38:20.233763487 +0000
++++ cups-1.7.5/scheduler/conf.c 2014-11-06 13:38:20.250763577 +0000
@@ -36,6 +36,9 @@
# define INADDR_NONE 0xffffffff
#endif /* !INADDR_NONE */
@@ -758,9 +763,9 @@ diff -up cups-1.7.1/scheduler/conf.c.lspp cups-1.7.1/scheduler/conf.c
/*
* 'read_policy()' - Read a definition.
-diff -up cups-1.7.1/scheduler/conf.h.lspp cups-1.7.1/scheduler/conf.h
---- cups-1.7.1/scheduler/conf.h.lspp 2014-01-08 18:43:27.284821762 +0100
-+++ cups-1.7.1/scheduler/conf.h 2014-01-08 18:43:27.301821527 +0100
+diff -up cups-1.7.5/scheduler/conf.h.lspp cups-1.7.5/scheduler/conf.h
+--- cups-1.7.5/scheduler/conf.h.lspp 2014-11-06 13:38:20.228763460 +0000
++++ cups-1.7.5/scheduler/conf.h 2014-11-06 13:38:20.250763577 +0000
@@ -250,6 +250,13 @@ VAR int SSLOptions VALUE(CUPSD_SSL_NO
/* SSL/TLS options */
#endif /* HAVE_SSL */
@@ -785,9 +790,9 @@ diff -up cups-1.7.1/scheduler/conf.h.lspp cups-1.7.1/scheduler/conf.h
/*
* Prototypes...
-diff -up cups-1.7.1/scheduler/cupsd.h.lspp cups-1.7.1/scheduler/cupsd.h
---- cups-1.7.1/scheduler/cupsd.h.lspp 2014-01-08 18:43:27.264822039 +0100
-+++ cups-1.7.1/scheduler/cupsd.h 2014-01-08 18:43:27.301821527 +0100
+diff -up cups-1.7.5/scheduler/cupsd.h.lspp cups-1.7.5/scheduler/cupsd.h
+--- cups-1.7.5/scheduler/cupsd.h.lspp 2014-11-06 13:38:20.221763423 +0000
++++ cups-1.7.5/scheduler/cupsd.h 2014-11-06 13:38:20.250763577 +0000
@@ -13,6 +13,8 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@@ -819,9 +824,9 @@ diff -up cups-1.7.1/scheduler/cupsd.h.lspp cups-1.7.1/scheduler/cupsd.h
/*
* Some OS's don't have hstrerror(), most notably Solaris...
*/
-diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
---- cups-1.7.1/scheduler/ipp.c.lspp 2014-01-08 18:43:27.188823090 +0100
-+++ cups-1.7.1/scheduler/ipp.c 2014-01-08 18:46:34.235235319 +0100
+diff -up cups-1.7.5/scheduler/ipp.c.lspp cups-1.7.5/scheduler/ipp.c
+--- cups-1.7.5/scheduler/ipp.c.lspp 2014-11-06 13:38:20.238763513 +0000
++++ cups-1.7.5/scheduler/ipp.c 2014-11-06 13:38:20.251763583 +0000
@@ -16,6 +16,9 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@@ -879,7 +884,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %p(%s), %p(%s/%s))",
-@@ -1552,6 +1581,106 @@ add_job(cupsd_client_t *con, /* I - Cl
+@@ -1551,6 +1580,106 @@ add_job(cupsd_client_t *con, /* I - Cl
return (NULL);
}
@@ -934,7 +939,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/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);
@@ -986,7 +991,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
if ((job = cupsdAddJob(priority, printer->name)) == NULL)
{
send_ipp_status(con, IPP_INTERNAL_ERROR,
-@@ -1560,6 +1689,32 @@ add_job(cupsd_client_t *con, /* I - Cl
+@@ -1559,6 +1688,32 @@ add_job(cupsd_client_t *con, /* I - Cl
return (NULL);
}
@@ -1019,7 +1024,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
job->dtype = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE);
job->attrs = con->request;
job->dirty = 1;
-@@ -1769,6 +1924,29 @@ add_job(cupsd_client_t *con, /* I - Cl
+@@ -1770,6 +1925,29 @@ add_job(cupsd_client_t *con, /* I - Cl
attr->values[0].string.text = _cupsStrRetain(printer->job_sheets[0]);
attr->values[1].string.text = _cupsStrRetain(printer->job_sheets[1]);
}
@@ -1049,7 +1054,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
job->job_sheets = attr;
-@@ -1799,6 +1977,9 @@ add_job(cupsd_client_t *con, /* I - Cl
+@@ -1800,6 +1978,9 @@ add_job(cupsd_client_t *con, /* I - Cl
"job-sheets=\"%s,none\", "
"job-originating-user-name=\"%s\"",
Classification, job->username);
@@ -1059,7 +1064,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
}
else if (attr->num_values == 2 &&
strcmp(attr->values[0].string.text,
-@@ -1817,6 +1998,9 @@ add_job(cupsd_client_t *con, /* I - Cl
+@@ -1818,6 +1999,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);
@@ -1069,7 +1074,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
}
else if (strcmp(attr->values[0].string.text, Classification) &&
strcmp(attr->values[0].string.text, "none") &&
-@@ -1837,6 +2021,9 @@ add_job(cupsd_client_t *con, /* I - Cl
+@@ -1838,6 +2022,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);
@@ -1079,7 +1084,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
}
}
else if (strcmp(attr->values[0].string.text, Classification) &&
-@@ -1877,8 +2064,52 @@ add_job(cupsd_client_t *con, /* I - Cl
+@@ -1878,8 +2065,52 @@ add_job(cupsd_client_t *con, /* I - Cl
"job-sheets=\"%s\", "
"job-originating-user-name=\"%s\"",
Classification, job->username);
@@ -1177,7 +1182,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/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)
@@ -1290,7 +1295,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
+ job->num_files --;
+ return (0);
+ }
-+ jobrange = context_range_get(jobcon);
++ jobrange = (char *) context_range_get(jobcon);
+ if (jobrange)
+ {
+ jobrange = strdup(jobrange);
@@ -1368,7 +1373,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
if (!strcmp(s, "printer-name"))
{
cupsFilePuts(out, job->dest);
-@@ -6101,6 +6540,22 @@ get_job_attrs(cupsd_client_t *con, /* I
+@@ -6148,6 +6587,22 @@ get_job_attrs(cupsd_client_t *con, /* I
exclude = cupsdGetPrivateAttrs(policy, con, printer, job->username);
@@ -1391,7 +1396,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
/*
* Copy attributes...
*/
-@@ -6443,6 +6898,11 @@ get_jobs(cupsd_client_t *con, /* I - C
+@@ -6548,6 +7003,11 @@ get_jobs(cupsd_client_t *con, /* I - C
if (username[0] && _cups_strcasecmp(username, job->username))
continue;
@@ -1403,7 +1408,7 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
if (count > 0)
ippAddSeparator(con->response);
-@@ -11013,6 +11473,11 @@ validate_user(cupsd_job_t *job, /* I
+@@ -11123,6 +11583,11 @@ validate_user(cupsd_job_t *job, /* I
strlcpy(username, get_username(con), userlen);
@@ -1415,9 +1420,9 @@ diff -up cups-1.7.1/scheduler/ipp.c.lspp cups-1.7.1/scheduler/ipp.c
/*
* Check the username against the owner...
*/
-diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
---- cups-1.7.1/scheduler/job.c.lspp 2014-01-08 18:43:27.279821831 +0100
-+++ cups-1.7.1/scheduler/job.c 2014-01-08 18:47:08.592759973 +0100
+diff -up cups-1.7.5/scheduler/job.c.lspp cups-1.7.5/scheduler/job.c
+--- cups-1.7.5/scheduler/job.c.lspp 2014-11-06 13:38:20.239763519 +0000
++++ cups-1.7.5/scheduler/job.c 2014-11-06 13:38:20.252763588 +0000
@@ -13,6 +13,9 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@@ -1443,7 +1448,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
/*
* Design Notes for Job Management
-@@ -525,6 +536,14 @@ cupsdContinueJob(cupsd_job_t *job) /* I
+@@ -526,6 +537,14 @@ cupsdContinueJob(cupsd_job_t *job) /* I
/* PRINTER_STATE_REASONS env var */
rip_max_cache[255];
/* RIP_MAX_CACHE env variable */
@@ -1458,7 +1463,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
cupsdLogMessage(CUPSD_LOG_DEBUG2,
-@@ -1034,6 +1053,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I
+@@ -1040,6 +1059,67 @@ cupsdContinueJob(cupsd_job_t *job) /* I
if (final_content_type[0])
envp[envc ++] = final_content_type;
@@ -1526,7 +1531,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
if (Classification && !banner_page)
{
if ((attr = ippFindAttribute(job->attrs, "job-sheets",
-@@ -1800,6 +1880,20 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J
+@@ -1833,6 +1913,20 @@ cupsdLoadJob(cupsd_job_t *job) /* I - J
ippSetString(job->attrs, &job->reasons, 0, "none");
}
@@ -1547,7 +1552,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/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);
-@@ -2188,6 +2282,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
+@@ -2237,6 +2331,14 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
{
char filename[1024]; /* Job control filename */
cups_file_t *fp; /* Job file */
@@ -1562,7 +1567,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p(%d)): job->attrs=%p",
-@@ -2200,6 +2302,76 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
+@@ -2249,6 +2351,76 @@ cupsdSaveJob(cupsd_job_t *job) /* I - J
fchown(cupsFileNumber(fp), RunUser, Group);
@@ -1639,7 +1644,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
job->attrs->state = IPP_IDLE;
if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL,
-@@ -3748,6 +3920,18 @@ get_options(cupsd_job_t *job, /* I - Jo
+@@ -3819,6 +3991,18 @@ get_options(cupsd_job_t *job, /* I - Jo
banner_page)
continue;
@@ -1658,7 +1663,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
/*
* Otherwise add them to the list...
*/
-@@ -4472,6 +4656,18 @@ start_job(cupsd_job_t *job, /* I -
+@@ -4569,6 +4753,18 @@ start_job(cupsd_job_t *job, /* I -
cupsd_printer_t *printer) /* I - Printer to print job */
{
const char *filename; /* Support filename */
@@ -1677,7 +1682,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job(job=%p(%d), printer=%p(%s))",
-@@ -4635,6 +4831,108 @@ start_job(cupsd_job_t *job, /* I -
+@@ -4732,6 +4928,108 @@ start_job(cupsd_job_t *job, /* I -
fcntl(job->side_pipes[1], F_SETFD,
fcntl(job->side_pipes[1], F_GETFD) | FD_CLOEXEC);
@@ -1726,7 +1731,7 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/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);
@@ -1786,9 +1791,9 @@ diff -up cups-1.7.1/scheduler/job.c.lspp cups-1.7.1/scheduler/job.c
/*
* Now start the first file in the job...
*/
-diff -up cups-1.7.1/scheduler/job.h.lspp cups-1.7.1/scheduler/job.h
---- cups-1.7.1/scheduler/job.h.lspp 2013-05-29 13:51:34.000000000 +0200
-+++ cups-1.7.1/scheduler/job.h 2014-01-08 18:43:27.308821430 +0100
+diff -up cups-1.7.5/scheduler/job.h.lspp cups-1.7.5/scheduler/job.h
+--- cups-1.7.5/scheduler/job.h.lspp 2014-11-06 13:38:20.239763519 +0000
++++ cups-1.7.5/scheduler/job.h 2014-11-06 13:38:20.252763588 +0000
@@ -13,6 +13,13 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@@ -1803,7 +1808,7 @@ diff -up cups-1.7.1/scheduler/job.h.lspp cups-1.7.1/scheduler/job.h
/*
* Constants...
*/
-@@ -82,6 +89,10 @@ struct cupsd_job_s /**** Job request *
+@@ -86,6 +93,10 @@ struct cupsd_job_s /**** Job request *
int progress; /* Printing progress */
int num_keywords; /* Number of PPD keywords */
cups_option_t *keywords; /* PPD keywords */
@@ -1814,10 +1819,10 @@ diff -up cups-1.7.1/scheduler/job.h.lspp cups-1.7.1/scheduler/job.h
};
typedef struct cupsd_joblog_s /**** Job log message ****/
-diff -up cups-1.7.1/scheduler/main.c.lspp cups-1.7.1/scheduler/main.c
---- cups-1.7.1/scheduler/main.c.lspp 2014-01-08 18:43:27.265822025 +0100
-+++ cups-1.7.1/scheduler/main.c 2014-01-08 18:43:27.308821430 +0100
-@@ -80,6 +82,9 @@
+diff -up cups-1.7.5/scheduler/main.c.lspp cups-1.7.5/scheduler/main.c
+--- cups-1.7.5/scheduler/main.c.lspp 2014-11-06 13:38:20.222763428 +0000
++++ cups-1.7.5/scheduler/main.c 2014-11-06 13:38:20.253763593 +0000
+@@ -59,6 +59,9 @@
# include
#endif /* HAVE_SYS_PARAM_H */
@@ -1827,7 +1832,7 @@ diff -up cups-1.7.1/scheduler/main.c.lspp cups-1.7.1/scheduler/main.c
/*
* Local functions...
-@@ -143,6 +148,9 @@ main(int argc, /* I - Number of comm
+@@ -122,6 +125,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 */
@@ -1837,7 +1842,7 @@ diff -up cups-1.7.1/scheduler/main.c.lspp cups-1.7.1/scheduler/main.c
int run_as_child = 0;
/* Needed for background fork/exec */
#ifdef __APPLE__
-@@ -519,6 +527,25 @@ main(int argc, /* I - Number of comm
+@@ -498,6 +504,25 @@ main(int argc, /* I - Number of comm
#endif /* DEBUG */
}
@@ -1863,7 +1868,7 @@ diff -up cups-1.7.1/scheduler/main.c.lspp cups-1.7.1/scheduler/main.c
/*
* Set the timezone info...
*/
-@@ -1197,6 +1224,11 @@ main(int argc, /* I - Number of comm
+@@ -1190,6 +1215,11 @@ main(int argc, /* I - Number of comm
cupsdStopSelect();
@@ -1875,9 +1880,9 @@ diff -up cups-1.7.1/scheduler/main.c.lspp cups-1.7.1/scheduler/main.c
return (!stop_scheduler);
}
-diff -up cups-1.7.1/scheduler/printers.c.lspp cups-1.7.1/scheduler/printers.c
---- cups-1.7.1/scheduler/printers.c.lspp 2014-01-08 18:43:27.161823463 +0100
-+++ cups-1.7.1/scheduler/printers.c 2014-01-08 18:47:33.449416072 +0100
+diff -up cups-1.7.5/scheduler/printers.c.lspp cups-1.7.5/scheduler/printers.c
+--- cups-1.7.5/scheduler/printers.c.lspp 2014-11-06 13:38:20.173763166 +0000
++++ cups-1.7.5/scheduler/printers.c 2014-11-06 13:38:20.253763593 +0000
@@ -13,6 +13,8 @@
* file is missing or damaged, see the license at "http://www.cups.org/".
*/
@@ -1898,7 +1903,7 @@ diff -up cups-1.7.1/scheduler/printers.c.lspp cups-1.7.1/scheduler/printers.c
/*
* Local functions...
-@@ -2023,6 +2029,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
+@@ -2022,6 +2028,13 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
ipp_attribute_t *attr; /* Attribute data */
char *name, /* Current user/group name */
*filter; /* Current filter */
@@ -1912,7 +1917,7 @@ diff -up cups-1.7.1/scheduler/printers.c.lspp cups-1.7.1/scheduler/printers.c
DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
-@@ -2145,6 +2158,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
+@@ -2144,6 +2157,45 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)
attr->values[1].string.text = _cupsStrAlloc(Classification ?
Classification : p->job_sheets[1]);
}
diff --git a/cups.spec b/cups.spec
index 98968fb..48bf810 100644
--- a/cups.spec
+++ b/cups.spec
@@ -689,6 +689,7 @@ rm -f %{cups_serverbin}/backend/smb
%changelog
* Thu Nov 6 2014 Tim Waugh - 1:1.7.5-14
+- Fixed some warnings in cups-lspp.patch.
- New systemd journal fields CUPS_DEST and CUPS_PRINTER, as well as
accurate code location fields.