rpms/gnome-color-manager/F-13 gnome-color-manager-2.30.1-only-connect-when-devices-are-required.patch, NONE, 1.1 gnome-color-manager.spec, 1.17, 1.18 gnome-color-manager-2.31.1-do-not-explode-for-non-rgb-profiles.patch, 1.1, NONE
Richard Hughes
rhughes at fedoraproject.org
Tue May 11 08:33:29 UTC 2010
Author: rhughes
Update of /cvs/pkgs/rpms/gnome-color-manager/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv28977
Modified Files:
gnome-color-manager.spec
Added Files:
gnome-color-manager-2.30.1-only-connect-when-devices-are-required.patch
Removed Files:
gnome-color-manager-2.31.1-do-not-explode-for-non-rgb-profiles.patch
Log Message:
* Tue May 11 2010 Richard Hughes <richard at hughsie.com> 2.30.1-3
- Coldplug CUPS and SANE only when we need the device lists.
Fixes a _correct_ AVC when running gcm-apply on login.
- Resolves: #590465
gnome-color-manager-2.30.1-only-connect-when-devices-are-required.patch:
gcm-client.c | 49 +++++++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 18 deletions(-)
--- NEW FILE gnome-color-manager-2.30.1-only-connect-when-devices-are-required.patch ---
commit a9a9c4944bdafe0609f54d7b78cc54818eaa38d4
Author: Richard Hughes <richard at hughsie.com>
Date: Tue May 11 09:26:29 2010 +0100
Only connect to SANE and CUPS when the device lists are needed, to silence gcm-apply with SELinux. Fixes rh#590465
diff --git a/src/gcm-client.c b/src/gcm-client.c
index 867710c..592386e 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -70,6 +70,8 @@ struct _GcmClientPrivate
gboolean loading;
guint loading_refcount;
gboolean use_threads;
+ gboolean init_cups;
+ gboolean init_sane;
};
enum {
@@ -722,6 +724,14 @@ gcm_client_add_connected_devices_cups (GcmClient *client, GError **error)
gint i;
GcmClientPrivate *priv = client->priv;
+ /* initialize */
+ if (!client->priv->init_cups) {
+ httpInitialize();
+ /* should be okay for localhost */
+ client->priv->http = httpConnectEncrypt (cupsServer (), ippPort (), cupsEncryption ());
+ client->priv->init_cups = TRUE;
+ }
+
num_dests = cupsGetDests2 (priv->http, &dests);
egg_debug ("got %i printers", num_dests);
@@ -805,17 +815,28 @@ static gboolean
gcm_client_add_connected_devices_sane (GcmClient *client, GError **error)
{
gint i;
+ gboolean ret = TRUE;
SANE_Status status;
const SANE_Device **device_list;
/* force sane to drop it's cache of devices -- yes, it is that crap */
- sane_exit ();
- sane_init (NULL, NULL);
+ if (client->priv->init_sane) {
+ sane_exit ();
+ client->priv->init_sane = FALSE;
+ }
+ status = sane_init (NULL, NULL);
+ if (status != SANE_STATUS_GOOD) {
+ ret = FALSE;
+ g_set_error (error, 1, 0, "failed to init SANE: %s", sane_strstatus (status));
+ goto out;
+ }
+ client->priv->init_sane = TRUE;
/* get scanners on the local server */
status = sane_get_devices (&device_list, FALSE);
if (status != SANE_STATUS_GOOD) {
- egg_warning ("failed to get devices from SANE: %s", sane_strstatus (status));
+ ret = FALSE;
+ g_set_error (error, 1, 0, "failed to get devices from SANE: %s", sane_strstatus (status));
goto out;
}
@@ -831,7 +852,7 @@ gcm_client_add_connected_devices_sane (GcmClient *client, GError **error)
out:
/* inform the UI */
gcm_client_done_loading (client);
- return TRUE;
+ return ret;
}
/**
@@ -1324,12 +1345,13 @@ static void
gcm_client_init (GcmClient *client)
{
const gchar *subsystems[] = {"usb", "video4linux", NULL};
- SANE_Status status;
client->priv = GCM_CLIENT_GET_PRIVATE (client);
client->priv->display_name = NULL;
client->priv->loading_refcount = 0;
client->priv->use_threads = FALSE;
+ client->priv->init_cups = FALSE;
+ client->priv->init_sane = FALSE;
client->priv->array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
client->priv->screen = gcm_screen_new ();
g_signal_connect (client->priv->screen, "outputs-changed",
@@ -1339,17 +1361,6 @@ gcm_client_init (GcmClient *client)
client->priv->gudev_client = g_udev_client_new (subsystems);
g_signal_connect (client->priv->gudev_client, "uevent",
G_CALLBACK (gcm_client_uevent_cb), client);
-
- /* for CUPS */
- httpInitialize();
-
- /* for SANE */
- status = sane_init (NULL, NULL);
- if (status != SANE_STATUS_GOOD)
- egg_warning ("failed to init SANE: %s", sane_strstatus (status));
-
- /* should be okay for localhost */
- client->priv->http = httpConnectEncrypt (cupsServer (), ippPort (), cupsEncryption ());
}
/**
@@ -1373,8 +1384,10 @@ gcm_client_finalize (GObject *object)
g_ptr_array_unref (priv->array);
g_object_unref (priv->gudev_client);
g_object_unref (priv->screen);
- httpClose (priv->http);
- sane_exit ();
+ if (client->priv->init_cups)
+ httpClose (priv->http);
+ if (client->priv->init_sane)
+ sane_exit ();
G_OBJECT_CLASS (gcm_client_parent_class)->finalize (object);
}
Index: gnome-color-manager.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gnome-color-manager/F-13/gnome-color-manager.spec,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -p -r1.17 -r1.18
--- gnome-color-manager.spec 4 May 2010 08:26:32 -0000 1.17
+++ gnome-color-manager.spec 11 May 2010 08:33:29 -0000 1.18
@@ -3,7 +3,7 @@
Summary: Color management tools for GNOME
Name: gnome-color-manager
Version: 2.30.1
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv2+
Group: Applications/System
URL: http://projects.gnome.org/gnome-color-manager/
@@ -13,6 +13,9 @@ Source1: 21Apr2010-gnome-color-manager
# Already upstream
Patch0: 0001-Do-not-connect-to-sane-in-gcm-apply-we-only-need-XRa.patch
+# Already upstream
+Patch1: gnome-color-manager-2.30.1-only-connect-when-devices-are-required.patch
+
Requires: gnome-icon-theme
Requires: shared-mime-info
Requires: shared-color-profiles
@@ -50,6 +53,7 @@ and generate color profiles in the GNOME
%prep
%setup -q
%patch0 -p1 -b .coldplug
+%patch1 -p1 -b .coldplug-later
# use new F14 icons
tar xvfj %{SOURCE1}
@@ -127,6 +131,11 @@ gtk-update-icon-cache %{_datadir}/icons/
%dir %{_localstatedir}/lib/color
%changelog
+* Tue May 11 2010 Richard Hughes <richard at hughsie.com> 2.30.1-3
+- Coldplug CUPS and SANE only when we need the device lists.
+ Fixes a _correct_ AVC when running gcm-apply on login.
+- Resolves: #590465
+
* Mon May 04 2010 Richard Hughes <richard at hughsie.com> 2.30.1-2
- Use the new 32x32 icon.
- Do not trigger a SELinux warning on login by only coldplugging XRandR.
--- gnome-color-manager-2.31.1-do-not-explode-for-non-rgb-profiles.patch DELETED ---
More information about the scm-commits
mailing list