Author: kiesiu Date: Mon Apr 2 19:17:05 2012 GMT Module: packages Tag: HEAD ---- Log message: - added patch for runtime fallback to ConsoleKit; rel. 3
---- Files affected: packages/polkit: polkit.spec (1.26 -> 1.27) , systemd-fallback.patch (NONE -> 1.1) (NEW) ---- Diffs: ================================================================ Index: packages/polkit/polkit.spec diff -u packages/polkit/polkit.spec:1.26 packages/polkit/polkit.spec:1.27 --- packages/polkit/polkit.spec:1.26 Mon Jan 30 21:10:40 2012 +++ packages/polkit/polkit.spec Mon Apr 2 21:17:00 2012 @@ -2,17 +2,18 @@ # # Conditional build: %bcond_without apidocs # build without apidocs -%bcond_with systemd # rely on systemd for session tracking instead of ConsoleKit +%bcond_without systemd # use systemd for session tracking instead of ConsoleKit (fallback to ConsoleKit on runtime) # Summary: A framework for defining policy for system-wide components Summary(pl.UTF-8): Szkielet do definiowania polityki dla komponentów systemowych Name: polkit Version: 0.104 -Release: 2 +Release: 3 License: LGPL v2+ Group: Libraries Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.gz # Source0-md5: e380b4c6fb1e7bccf854e92edc0a8ce1 +Patch0: systemd-fallback.patch URL: http://www.freedesktop.org/wiki/Software/PolicyKit BuildRequires: autoconf >= 2.60 BuildRequires: automake >= 1:1.7 @@ -34,7 +35,7 @@ BuildRequires: rpmbuild(macros) >= 1.527 %{?with_systemd:BuildRequires: systemd-devel} Requires: %{name}-libs = %{version}-%{release} -%{!?with_systemd:Requires: ConsoleKit >= 0.4.1} +Requires: ConsoleKit >= 0.4.1 Requires: dbus >= 1.1.2-5 Obsoletes: PolicyKit BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) @@ -104,6 +105,7 @@ %prep %setup -q +%{?with_systemd:%patch0 -p1} %build %{?with_apidocs:%{__gtkdocize}} @@ -116,7 +118,7 @@ %configure \ %{__enable_disable apidocs gtk-doc} \ --disable-silent-rules \ - %{!?with_systemd:--disable-systemd} \ + %{__enable_disable systemd systemd} \ --with-html-dir=%{_gtkdocdir} \ --with-pam-include=system-auth \ --with-pam-module-dir=/%{_lib}/security @@ -223,6 +225,9 @@ All persons listed below can be reached at <cvs_login>@pld-linux.org $Log$ +Revision 1.27 2012/04/02 19:17:00 kiesiu +- added patch for runtime fallback to ConsoleKit; rel. 3 + Revision 1.26 2012/01/30 20:10:40 baggins - rel 2 - O for PolicyKit packages ================================================================ Index: packages/polkit/systemd-fallback.patch diff -u /dev/null packages/polkit/systemd-fallback.patch:1.1 --- /dev/null Mon Apr 2 21:17:05 2012 +++ packages/polkit/systemd-fallback.patch Mon Apr 2 21:17:00 2012 @@ -0,0 +1,1572 @@ +diff -uNr polkit-0.104/configure.ac polkit-0.104.systemd/configure.ac +--- polkit-0.104/configure.ac 2012-01-03 17:25:49.000000000 +0100 ++++ polkit-0.104.systemd/configure.ac 2012-04-02 20:56:04.906628803 +0200 +@@ -160,14 +160,15 @@ + [enable_systemd=auto]) + if test "$enable_systemd" != "no"; then + PKG_CHECK_MODULES(SYSTEMD, +- [libsystemd-login], ++ [libsystemd-login libsystemd-daemon], + have_systemd=yes, + have_systemd=no) + if test "$have_systemd" = "yes"; then ++ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd is used for session tracking]) + SESSION_TRACKING=systemd + else + if test "$enable_systemd" = "yes"; then +- AC_MSG_ERROR([systemd support requested but libsystemd-login1 library not found]) ++ AC_MSG_ERROR([systemd support requested but systemd libraries not found]) + fi + fi + fi +diff -uNr polkit-0.104/src/polkit/Makefile.am polkit-0.104.systemd/src/polkit/Makefile.am +--- polkit-0.104/src/polkit/Makefile.am 2012-01-03 16:03:47.000000000 +0100 ++++ polkit-0.104.systemd/src/polkit/Makefile.am 2012-04-02 20:55:14.940232827 +0200 +@@ -79,15 +79,8 @@ + polkitimplicitauthorization.c polkitimplicitauthorization.h \ + polkittemporaryauthorization.c polkittemporaryauthorization.h \ + polkitpermission.c polkitpermission.h \ +- $(NULL) +- +-if HAVE_SYSTEMD +-libpolkit_gobject_1_la_SOURCES += \ +- polkitunixsession-systemd.c polkitunixsession.h +-else +-libpolkit_gobject_1_la_SOURCES += \ + polkitunixsession.c polkitunixsession.h +-endif ++ $(NULL) + + libpolkit_gobject_1_la_CFLAGS = \ + -D_POLKIT_COMPILATION \ +diff -uNr polkit-0.104/src/polkit/polkitunixsession.c polkit-0.104.systemd/src/polkit/polkitunixsession.c +--- polkit-0.104/src/polkit/polkitunixsession.c 2011-10-18 19:02:27.000000000 +0200 ++++ polkit-0.104.systemd/src/polkit/polkitunixsession.c 2012-04-02 20:55:14.940232827 +0200 +@@ -23,12 +23,18 @@ + # include "config.h" + #endif + ++#include <stdlib.h> + #include <string.h> + #include "polkitunixsession.h" + #include "polkitsubject.h" + #include "polkiterror.h" + #include "polkitprivate.h" + ++#ifdef HAVE_SYSTEMD ++# include <systemd/sd-daemon.h> ++# include <systemd/sd-login.h> ++#endif ++ + /** + * SECTION:polkitunixsession + * @title: PolkitUnixSession +@@ -364,34 +370,44 @@ + PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject); + GDBusConnection *connection; + GVariant *result; +- gboolean ret; +- +- ret = FALSE; ++ gboolean ret = FALSE; + +- connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error); +- if (connection == NULL) +- goto out; +- +- result = g_dbus_connection_call_sync (connection, +- "org.freedesktop.ConsoleKit", /* name */ +- session->session_id, /* object path */ +- "org.freedesktop.ConsoleKit.Session", /* interface name */ +- "GetUser", /* method */ +- NULL, /* parameters */ +- G_VARIANT_TYPE ("(u)"), +- G_DBUS_CALL_FLAGS_NONE, +- -1, +- cancellable, +- error); +- if (result == NULL) +- goto out; ++#ifdef HAVE_SYSTEMD ++ uid_t uid; ++ ++ if (sd_booted () > 0) ++ { ++ if (sd_session_get_uid (session->session_id, &uid) == 0) ++ ret = TRUE; ++ } ++ else ++#endif ++ { ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error); ++ if (connection == NULL) ++ goto out; ++ ++ result = g_dbus_connection_call_sync (connection, ++ "org.freedesktop.ConsoleKit", /* name */ ++ session->session_id, /* object path */ ++ "org.freedesktop.ConsoleKit.Session", /* interface name */ ++ "GetUser", /* method */ ++ NULL, /* parameters */ ++ G_VARIANT_TYPE ("(u)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ cancellable, ++ error); ++ if (result == NULL) ++ goto out; + +- ret = TRUE; +- g_variant_unref (result); ++ ret = TRUE; ++ g_variant_unref (result); + +- out: +- if (connection != NULL) +- g_object_unref (connection); ++ out: ++ if (connection != NULL) ++ g_object_unref (connection); ++ } + return ret; + } + +@@ -470,12 +486,9 @@ + GError **error) + { + PolkitUnixSession *session = POLKIT_UNIX_SESSION (initable); +- GDBusConnection *connection; ++ GDBusConnection *connection = NULL; + GVariant *result; +- gboolean ret; +- +- connection = NULL; +- ret = FALSE; ++ gboolean ret = FALSE; + + if (session->session_id != NULL) + { +@@ -484,33 +497,56 @@ + goto out; + } + +- connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error); +- if (connection == NULL) +- goto out; ++#ifdef HAVE_SYSTEMD ++ char *s; ++ ++ if (sd_booted () > 0) ++ { ++ if (sd_pid_get_session (session->pid, &s) == 0) ++ { ++ session->session_id = g_strdup (s); ++ free (s); ++ ret = TRUE; ++ goto out; ++ } ++ ++ g_set_error (error, ++ POLKIT_ERROR, ++ POLKIT_ERROR_FAILED, ++ "No session for pid %d", ++ (gint) session->pid); ++ } ++ else ++#endif ++ { ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error); ++ if (connection == NULL) ++ goto out; ++ ++ result = g_dbus_connection_call_sync (connection, ++ "org.freedesktop.ConsoleKit", /* name */ ++ "/org/freedesktop/ConsoleKit/Manager", /* object path */ ++ "org.freedesktop.ConsoleKit.Manager", /* interface name */ ++ "GetSessionForUnixProcess", /* method */ ++ g_variant_new ("(u)", session->pid), /* parameters */ ++ G_VARIANT_TYPE ("(o)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ cancellable, ++ error); ++ if (result == NULL) ++ goto out; + +- result = g_dbus_connection_call_sync (connection, +- "org.freedesktop.ConsoleKit", /* name */ +- "/org/freedesktop/ConsoleKit/Manager", /* object path */ +- "org.freedesktop.ConsoleKit.Manager", /* interface name */ +- "GetSessionForUnixProcess", /* method */ +- g_variant_new ("(u)", session->pid), /* parameters */ +- G_VARIANT_TYPE ("(o)"), +- G_DBUS_CALL_FLAGS_NONE, +- -1, +- cancellable, +- error); +- if (result == NULL) +- goto out; ++ g_variant_get (result, "(o)", &session->session_id); ++ g_variant_unref (result); + +- g_variant_get (result, "(o)", &session->session_id); +- g_variant_unref (result); ++ ret = TRUE; ++ } + +- ret = TRUE; + + out: + if (connection != NULL) + g_object_unref (connection); +- + return ret; + } + +diff -uNr polkit-0.104/src/polkit/polkitunixsession-systemd.c polkit-0.104.systemd/src/polkit/polkitunixsession-systemd.c +--- polkit-0.104/src/polkit/polkitunixsession-systemd.c 2012-01-03 16:03:47.000000000 +0100 ++++ polkit-0.104.systemd/src/polkit/polkitunixsession-systemd.c 1970-01-01 01:00:00.000000000 +0100 +@@ -1,481 +0,0 @@ +-/* +- * Copyright (C) 2011 Red Hat, Inc. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General +- * Public License along with this library; if not, write to the +- * Free Software Foundation, Inc., 59 Temple Place, Suite 330, +- * Boston, MA 02111-1307, USA. +- * +- * Author: Matthias Clasen +- */ +- +-#ifdef HAVE_CONFIG_H +-# include "config.h" +-#endif +- +-#include <string.h> +-#include "polkitunixsession.h" +-#include "polkitsubject.h" +-#include "polkiterror.h" +-#include "polkitprivate.h" +- +-#include <systemd/sd-login.h> +- +-/** +- * SECTION:polkitunixsession +- * @title: PolkitUnixSession +- * @short_description: Unix sessions +- * +- * An object that represents an user session. +- * +- * The session id is an opaque string obtained from ConsoleKit. +- */ +- +-/** +- * PolkitUnixSession: +- * +- * The #PolkitUnixSession struct should not be accessed directly. +- */ +-struct _PolkitUnixSession +-{ +- GObject parent_instance; +- +- gchar *session_id; +- +- gint pid; +-}; +- +-struct _PolkitUnixSessionClass +-{ +- GObjectClass parent_class; +-}; +- +-enum +-{ +- PROP_0, +- PROP_SESSION_ID, +- PROP_PID, +-}; +- +-static void subject_iface_init (PolkitSubjectIface *subject_iface); +-static void initable_iface_init (GInitableIface *initable_iface); +-static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); +- +-G_DEFINE_TYPE_WITH_CODE (PolkitUnixSession, polkit_unix_session, G_TYPE_OBJECT, +- G_IMPLEMENT_INTERFACE (POLKIT_TYPE_SUBJECT, subject_iface_init) +- G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init) +- G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init) +- ); +- +-static void +-polkit_unix_session_init (PolkitUnixSession *session) +-{ +-} +- +-static void +-polkit_unix_session_finalize (GObject *object) +-{ +- PolkitUnixSession *session = POLKIT_UNIX_SESSION (object); +- +- g_free (session->session_id); +- +- if (G_OBJECT_CLASS (polkit_unix_session_parent_class)->finalize != NULL) +- G_OBJECT_CLASS (polkit_unix_session_parent_class)->finalize (object); +-} +- +-static void +-polkit_unix_session_get_property (GObject *object, +- guint prop_id, +- GValue *value, +- GParamSpec *pspec) +-{ +- PolkitUnixSession *session = POLKIT_UNIX_SESSION (object); +- +- switch (prop_id) +- { +- case PROP_SESSION_ID: +- g_value_set_string (value, session->session_id); +- break; +- +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} +- +-static void +-polkit_unix_session_set_property (GObject *object, +- guint prop_id, +- const GValue *value, +- GParamSpec *pspec) +-{ +- PolkitUnixSession *session = POLKIT_UNIX_SESSION (object); +- +- switch (prop_id) +- { +- case PROP_SESSION_ID: +- polkit_unix_session_set_session_id (session, g_value_get_string (value)); +- break; +- +- case PROP_PID: +- session->pid = g_value_get_int (value); +- break; +- +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} +- +-static void +-polkit_unix_session_class_init (PolkitUnixSessionClass *klass) +-{ +- GObjectClass *gobject_class = G_OBJECT_CLASS (klass); +- +- gobject_class->finalize = polkit_unix_session_finalize; +- gobject_class->get_property = polkit_unix_session_get_property; +- gobject_class->set_property = polkit_unix_session_set_property; +- +- /** +- * PolkitUnixSession:session-id: +- * +- * The UNIX session id. +- */ +- g_object_class_install_property (gobject_class, +- PROP_SESSION_ID, +- g_param_spec_string ("session-id", +- "Session ID", +- "The UNIX session ID", +- NULL, +- G_PARAM_CONSTRUCT | +- G_PARAM_READWRITE | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_BLURB | +- G_PARAM_STATIC_NICK)); +- +- +- /** +- * PolkitUnixSession:pid: +- * +- * The UNIX process id to look up the session. +- */ +- g_object_class_install_property (gobject_class, +- PROP_PID, +- g_param_spec_int ("pid", +- "Process ID", +- "Process ID to use for looking up the session", +- 0, +- G_MAXINT, +- 0, +- G_PARAM_CONSTRUCT_ONLY | +- G_PARAM_WRITABLE | +- G_PARAM_STATIC_NAME | +- G_PARAM_STATIC_BLURB | +- G_PARAM_STATIC_NICK)); +- +-} +- +-/** +- * polkit_unix_session_get_session_id: +- * @session: A #PolkitUnixSession. +- * +- * Gets the session id for @session. +- * +- * Returns: The session id for @session. Do not free this string, it +- * is owned by @session. +- **/ +-const gchar * +-polkit_unix_session_get_session_id (PolkitUnixSession *session) +-{ +- g_return_val_if_fail (POLKIT_IS_UNIX_SESSION (session), NULL); +- return session->session_id; +-} +- +-/** +- * polkit_unix_session_set_session_id: +- * @session: A #PolkitUnixSession. +- * @session_id: The session id. +- * +- * Sets the session id for @session to @session_id. +- **/ +-void +-polkit_unix_session_set_session_id (PolkitUnixSession *session, +- const gchar *session_id) +-{ +- g_return_if_fail (POLKIT_IS_UNIX_SESSION (session)); +- /*g_return_if_fail (session_id != NULL);*/ +- g_free (session->session_id); +- session->session_id = g_strdup (session_id); +-} +- +-/** +- * polkit_unix_session_new: +- * @session_id: The session id. +- * +- * Creates a new #PolkitUnixSession for @session_id. +- * +- * Returns: (transfer full): A #PolkitUnixSession. Free with g_object_unref(). +- **/ +-PolkitSubject * +-polkit_unix_session_new (const gchar *session_id) +-{ +- return POLKIT_SUBJECT (g_object_new (POLKIT_TYPE_UNIX_SESSION, +- "session-id", session_id, +- NULL)); +-} +- +-/** +- * polkit_unix_session_new_for_process: +- * @pid: The process id of the process to get the session for. +- * @cancellable: (allow-none): A #GCancellable or %NULL. +- * @callback: A #GAsyncReadyCallback to call when the request is satisfied +- * @user_data: The data to pass to @callback. +- * +- * Asynchronously creates a new #PolkitUnixSession object for the +- * process with process id @pid. +- * +- * When the operation is finished, @callback will be invoked in the +- * <link linkend="g-main-context-push-thread-default">thread-default +- * main loop</link> of the thread you are calling this method +- * from. You can then call +- * polkit_unix_session_new_for_process_finish() to get the result of +- * the operation. +- * +- * This method constructs the object asynchronously, for the synchronous and blocking version +- * use polkit_unix_session_new_for_process_sync(). +- **/ +-void +-polkit_unix_session_new_for_process (gint pid, +- GCancellable *cancellable, +- GAsyncReadyCallback callback, +- gpointer user_data) +-{ +- g_async_initable_new_async (POLKIT_TYPE_UNIX_SESSION, +- G_PRIORITY_DEFAULT, +- cancellable, +- callback, +- user_data, +- "pid", pid, +- NULL); +-} +- +-/** +- * polkit_unix_session_new_for_process_finish: +- * @res: A #GAsyncResult obtained from the #GAsyncReadyCallback passed to polkit_unix_session_new_for_process(). +- * @error: (allow-none): Return location for error. +- * +- * Finishes constructing a #PolkitSubject for a process id. +- * +- * Returns: (transfer full) (allow-none): A #PolkitUnixSession for the @pid passed to +- * polkit_unix_session_new_for_process() or %NULL if @error is +- * set. Free with g_object_unref(). +- **/ +-PolkitSubject * +-polkit_unix_session_new_for_process_finish (GAsyncResult *res, +- GError **error) +-{ +- GObject *object; +- GObject *source_object; +- +- source_object = g_async_result_get_source_object (res); +- g_assert (source_object != NULL); +- +- object = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), +- res, +- error); +- g_object_unref (source_object); +- +- if (object != NULL) +- return POLKIT_SUBJECT (object); +- else <<Diff was trimmed, longer than 597 lines>> ---- CVS-web: http://cvs.pld-linux.org/packages/polkit/polkit.spec?r1=1.26&r2=1.27 _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
