Removed cups-dbus-utf8.patch as no longer needed (see STR #4314).
This commit is contained in:
parent
ca5992f31a
commit
a7745db8fb
@ -1,6 +1,6 @@
|
||||
diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
|
||||
--- cups-1.7.0/notifier/dbus.c.dbus-notifier 2014-01-02 17:01:06.033615950 +0000
|
||||
+++ cups-1.7.0/notifier/dbus.c 2014-01-02 17:02:06.573904333 +0000
|
||||
--- cups-1.7.0/notifier/dbus.c.dbus-notifier 2012-10-01 04:01:10.000000000 +0100
|
||||
+++ cups-1.7.0/notifier/dbus.c 2014-01-07 14:57:59.563591055 +0000
|
||||
@@ -4,7 +4,7 @@
|
||||
* D-Bus notifier for CUPS.
|
||||
*
|
||||
@ -10,7 +10,7 @@ diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
|
||||
* Copyright (C) 2007 Tim Waugh <twaugh@redhat.com>
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
@@ -157,9 +157,16 @@ enum
|
||||
@@ -154,9 +154,16 @@ enum
|
||||
|
||||
|
||||
/*
|
||||
@ -24,10 +24,10 @@ diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
|
||||
*/
|
||||
|
||||
+static void release_lock(void);
|
||||
static int acquire_lock(int *fd, char *lockfile, size_t locksize);
|
||||
static const char *validate_utf8(const char *str);
|
||||
static int acquire_lock(int *fd, char *lockfile, size_t locksize);
|
||||
|
||||
@@ -251,8 +258,6 @@ main(int argc, /* I - Number of comm
|
||||
|
||||
@@ -176,8 +183,6 @@ main(int argc, /* I - Number of comm
|
||||
DBusMessage *message; /* Message to send */
|
||||
DBusMessageIter iter; /* Iterator for message data */
|
||||
int lock_fd = -1; /* Lock file descriptor */
|
||||
@ -36,7 +36,7 @@ diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
|
||||
|
||||
|
||||
/*
|
||||
@@ -653,7 +658,7 @@ main(int argc, /* I - Number of comm
|
||||
@@ -578,7 +583,7 @@ main(int argc, /* I - Number of comm
|
||||
if (lock_fd >= 0)
|
||||
{
|
||||
close(lock_fd);
|
||||
@ -45,7 +45,7 @@ diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
|
||||
}
|
||||
|
||||
return (0);
|
||||
@@ -661,6 +666,27 @@ main(int argc, /* I - Number of comm
|
||||
@@ -586,6 +591,27 @@ main(int argc, /* I - Number of comm
|
||||
|
||||
|
||||
/*
|
||||
@ -73,7 +73,7 @@ diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
|
||||
* 'acquire_lock()' - Acquire a lock so we only have a single notifier running.
|
||||
*/
|
||||
|
||||
@@ -669,7 +695,8 @@ acquire_lock(int *fd, /* O - Lock fi
|
||||
@@ -594,7 +620,8 @@ acquire_lock(int *fd, /* O - Lock fi
|
||||
char *lockfile, /* I - Lock filename buffer */
|
||||
size_t locksize) /* I - Size of filename buffer */
|
||||
{
|
||||
@ -83,7 +83,7 @@ diff -up cups-1.7.0/notifier/dbus.c.dbus-notifier cups-1.7.0/notifier/dbus.c
|
||||
|
||||
|
||||
/*
|
||||
@@ -687,8 +714,16 @@ acquire_lock(int *fd, /* O - Lock fi
|
||||
@@ -612,8 +639,16 @@ acquire_lock(int *fd, /* O - Lock fi
|
||||
|
||||
if ((*fd = open(lockfile, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) < 0)
|
||||
return (-1);
|
||||
|
@ -1,106 +0,0 @@
|
||||
diff -up cups-1.6.1/notifier/dbus.c.dbus-utf8 cups-1.6.1/notifier/dbus.c
|
||||
--- cups-1.6.1/notifier/dbus.c.dbus-utf8 2012-01-20 19:00:32.000000000 +0000
|
||||
+++ cups-1.6.1/notifier/dbus.c 2012-10-31 11:04:47.686973616 +0000
|
||||
@@ -31,6 +31,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
+#include <assert.h>
|
||||
+#include <locale.h>
|
||||
+#include <wchar.h>
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
# include <dbus/dbus.h>
|
||||
@@ -157,10 +160,82 @@ enum
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
-static int acquire_lock(int *fd, char *lockfile, size_t locksize);
|
||||
+static int acquire_lock(int *fd, char *lockfile, size_t locksize);
|
||||
+static const char *validate_utf8(const char *str);
|
||||
|
||||
|
||||
/*
|
||||
+ * 'validate_utf8()' - Convert to valid UTF-8
|
||||
+ */
|
||||
+
|
||||
+static const char *
|
||||
+validate_utf8 (const char *str)
|
||||
+{
|
||||
+ static char *buffer = NULL;
|
||||
+ static size_t buflen = 0;
|
||||
+ char *p;
|
||||
+ size_t str_len;
|
||||
+ unsigned int i;
|
||||
+ mbstate_t instate, outstate;
|
||||
+
|
||||
+ if (str == NULL)
|
||||
+ {
|
||||
+ free (buffer);
|
||||
+ return (NULL);
|
||||
+ }
|
||||
+
|
||||
+ /* Is it already valid? */
|
||||
+ if (mbstowcs (NULL, str, 0) != (size_t) -1)
|
||||
+ return str;
|
||||
+
|
||||
+ /* Make sure our buffer is at least as large as the input string */
|
||||
+ str_len = strlen (str);
|
||||
+ if (str_len > buflen)
|
||||
+ {
|
||||
+ if (buffer == NULL)
|
||||
+ /* Set encoding type to UTF-8 the first time we need to */
|
||||
+ setlocale (LC_CTYPE, "en_US.UTF-8");
|
||||
+
|
||||
+ buflen = str_len + 1;
|
||||
+ buffer = realloc (buffer, buflen);
|
||||
+ }
|
||||
+
|
||||
+ memset (&instate, '\0', sizeof (mbstate_t));
|
||||
+ memset (&outstate, '\0', sizeof (mbstate_t));
|
||||
+ p = buffer;
|
||||
+ i = 0;
|
||||
+ while (i < str_len)
|
||||
+ {
|
||||
+ wchar_t wc;
|
||||
+ size_t used, written;
|
||||
+ mbstate_t orig_instate = instate;
|
||||
+ used = mbrtowc (&wc, str + i, str_len - i, &instate);
|
||||
+ switch (used)
|
||||
+ {
|
||||
+ case (size_t) -2:
|
||||
+ case (size_t) -1:
|
||||
+ wc = L'?'; /* so replacement is never longer than original char */
|
||||
+ instate = orig_instate;
|
||||
+ /* fallthru */
|
||||
+ case 0:
|
||||
+ used = 1;
|
||||
+ }
|
||||
+
|
||||
+ written = wcrtomb (p, wc, &outstate);
|
||||
+ if (written != -1)
|
||||
+ {
|
||||
+ p += written;
|
||||
+ assert (p - buffer < buflen);
|
||||
+ }
|
||||
+
|
||||
+ i += used;
|
||||
+ }
|
||||
+
|
||||
+ *p = '\0';
|
||||
+ return buffer;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* 'main()' - Read events and send DBUS notifications.
|
||||
*/
|
||||
|
||||
@@ -366,7 +441,7 @@ main(int argc, /* I - Number of comm
|
||||
attr = ippFindAttribute(msg, "notify-text", IPP_TAG_TEXT);
|
||||
if (attr)
|
||||
{
|
||||
- const char *val = ippGetString(attr, 0, NULL);
|
||||
+ const char *val = validate_utf8 (ippGetString(attr, 0, NULL));
|
||||
if (!dbus_message_iter_append_string(&iter, &val))
|
||||
goto bail;
|
||||
}
|
@ -31,7 +31,6 @@ Source8: macros.cups
|
||||
Patch1: cups-no-gzip-man.patch
|
||||
Patch2: cups-system-auth.patch
|
||||
Patch3: cups-multilib.patch
|
||||
Patch4: cups-dbus-utf8.patch
|
||||
Patch5: cups-banners.patch
|
||||
Patch6: cups-serverbin-compat.patch
|
||||
Patch7: cups-no-export-ssllibs.patch
|
||||
@ -193,8 +192,6 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
|
||||
%patch2 -p1 -b .system-auth
|
||||
# Prevent multilib conflict in cups-config script.
|
||||
%patch3 -p1 -b .multilib
|
||||
# Ensure attributes are valid UTF-8 in dbus notifier (bug #863387).
|
||||
%patch4 -p1 -b .dbus-utf8
|
||||
# Ignore rpm save/new files in the banners directory.
|
||||
%patch5 -p1 -b .banners
|
||||
# Use compatibility fallback path for ServerBin.
|
||||
@ -662,6 +659,7 @@ rm -f %{cups_serverbin}/backend/smb
|
||||
|
||||
%changelog
|
||||
* Tue Jan 7 2014 Tim Waugh <twaugh@redhat.com> - 1:1.7.0-10
|
||||
- Removed cups-dbus-utf8.patch as no longer needed (see STR #4314).
|
||||
- Return jobs in rank order when handling IPP-Get-Jobs (STR #4326).
|
||||
|
||||
* Thu Jan 2 2014 Tim Waugh <twaugh@redhat.com> - 1:1.7.0-9
|
||||
|
Loading…
Reference in New Issue
Block a user