summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2009-03-10 12:48:43 +0100
committerMichael Biebl <biebl@debian.org>2009-07-14 17:41:23 +0200
commit52f1844b988992a9303b7412d0c0681cce075608 (patch)
tree73889e695680287caafe01445bd4d86a4f66baf0
parent849c10f5869ad558e1a6d8231828e847987178c2 (diff)
downloadconsolekit-debian/0.3.0-1.tar.gz
Imported Debian patch 0.3.0-1debian/0.3.0-1
-rw-r--r--debian/changelog42
-rw-r--r--debian/compat2
-rw-r--r--debian/consolekit.docs2
-rw-r--r--debian/control15
-rw-r--r--debian/libpam-ck-connector.install1
-rw-r--r--debian/libpam-ck-connector.pam-auth-update6
-rw-r--r--debian/libpam-ck-connector.postinst7
-rw-r--r--debian/libpam-ck-connector.prerm11
-rw-r--r--debian/patches/01-dbus_policy.patch30
-rw-r--r--debian/patches/02-exit_with_dbus.patch113
-rw-r--r--debian/patches/04-consolekit_park.patch192
-rw-r--r--debian/patches/05-dbus_policy.patch55
-rw-r--r--debian/patches/05-pam-add-nox11.patch54
-rw-r--r--debian/patches/06-xmlto_skip_validation.patch26
-rw-r--r--debian/patches/08-fix-double-close.patch31
-rw-r--r--debian/patches/09-directory-handle-leak.patch15
-rw-r--r--debian/patches/10-file_monitor_remove_watch_crash.patch249
-rw-r--r--debian/patches/11-unref-dbus-proxy.patch16
-rw-r--r--debian/patches/12-allow-get-sessions.patch13
-rw-r--r--debian/patches/80-gnukfreebsd_support_configure.ac.patch13
-rw-r--r--debian/patches/81-gnukfreebsd_support_pseudo_run_autoconf.patch13
-rw-r--r--debian/patches/series12
-rwxr-xr-xdebian/rules1
23 files changed, 738 insertions, 181 deletions
diff --git a/debian/changelog b/debian/changelog
index ea4c03a..16ce664 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,45 @@
+consolekit (0.3.0-1) unstable; urgency=low
+
+ * New upstream release.
+ * debian/patches/01-dbus_policy.patch
+ - Removed, the access to the restart and stop actions is now properly
+ restricted by checks in the source code.
+ * debian/patches/02-exit_with_dbus.patch
+ - Removed, merged upstream.
+ * debian/patches/05-dbus_policy.patch
+ - Updated by pulling latest patch from upstream Git.
+ * debian/patches/06-xmlto_skip_validation.patch
+ - Skip XML validation when generating the documentation. (Closes: #516253)
+ A proper fix will be, to make ConsoleKit.xml actually valid XML.
+ * debian/consolekit.docs
+ - Update path to spec html file.
+ * Merge patches from Ubuntu
+ - debian/patches/04-consolekit_park.patch (Closes: #489032)
+ - debian/patches/05-pam-add-nox11.patch
+ - debian/patches/08-fix-double-close.patch
+ - debian/patches/09-directory-handle-leak.patch (Closes: #516532)
+ - debian/patches/10-file_monitor_remove_watch_crash.patch
+ - debian/patches/11-unref-dbus-proxy.patch
+ - debian/patches/12-allow-get-sessions.patch
+ * debian/control
+ - Wrap Build-Depends.
+ - Bump Build-Depends on debhelper to (>= 7).
+ * debian/compat
+ - Bump debhelper compat level to 7.
+ * Fix FTBFS on GNU/kFreeBSD. (Closes: #511270)
+ - debian/patches/80-gnukfreebsd_support_configure.ac.patch
+ debian/patches/81-gnukfreebsd_support_pseudo_run_autoconf.patch
+ + Add kfreebsd target to configure(.ac) script
+ - debian/control
+ + Add libkvm-dev to Build-Depends on kfreebsd ports.
+ Patch by Luca Favatella, thanks.
+ * debian/libpam-ck-connector.{pam-auth-update,install,postinst,prerm},
+ debian/rules: enable pam_ck_connector by default using the new
+ pam-auth-update support.
+ * debian/control: depend on libpam-runtime (>= 1.0.1-6) for the above.
+
+ -- Michael Biebl <biebl@debian.org> Tue, 10 Mar 2009 12:48:43 +0100
+
consolekit (0.2.10-5) unstable; urgency=high
* debian/watch
diff --git a/debian/compat b/debian/compat
index 7ed6ff8..7f8f011 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-5
+7
diff --git a/debian/consolekit.docs b/debian/consolekit.docs
index 3a9a1df..90bbbd6 100644
--- a/debian/consolekit.docs
+++ b/debian/consolekit.docs
@@ -1 +1 @@
-doc/ConsoleKit.html
+debian/tmp/usr/share/doc/ConsoleKit/spec/ConsoleKit.html
diff --git a/debian/control b/debian/control
index 26554b3..b20b846 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,18 @@ Section: admin
Priority: optional
Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Uploaders: Michael Biebl <biebl@debian.org>
-Build-Depends: cdbs, debhelper (>= 5), autotools-dev, pkg-config, quilt, libdbus-glib-1-dev (>= 0.30), libglib2.0-dev (>= 2.7.0), libx11-dev (>= 1.0.0), xmlto, libpam0g-dev, zlib1g-dev
+Build-Depends: cdbs,
+ debhelper (>= 7),
+ autotools-dev,
+ pkg-config,
+ quilt,
+ libdbus-glib-1-dev (>= 0.30),
+ libglib2.0-dev (>= 2.7.0),
+ libx11-dev (>= 1.0.0),
+ libkvm-dev [kfreebsd-i386 kfreebsd-amd64],
+ xmlto,
+ libpam0g-dev,
+ zlib1g-dev
Standards-Version: 3.8.0
Vcs-Svn: svn://svn.debian.org/svn/pkg-utopia/packages/unstable/consolekit
Vcs-Browser: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/consolekit
@@ -49,7 +60,7 @@ Description: ConsoleKit development files
Package: libpam-ck-connector
Section: admin
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, libpam-runtime (>= 1.0.1-6)
Description: ConsoleKit PAM module
ConsoleKit is a system daemon for tracking what users are logged
into the system and how they interact with the computer (e.g.
diff --git a/debian/libpam-ck-connector.install b/debian/libpam-ck-connector.install
index cd45d22..07bff8b 100644
--- a/debian/libpam-ck-connector.install
+++ b/debian/libpam-ck-connector.install
@@ -1,2 +1,3 @@
debian/tmp/lib/security/pam_ck_connector.so
debian/tmp/usr/share/man/man8/pam_ck_connector.8
+debian/tmp/usr/share/pam-configs/consolekit
diff --git a/debian/libpam-ck-connector.pam-auth-update b/debian/libpam-ck-connector.pam-auth-update
new file mode 100644
index 0000000..967d491
--- /dev/null
+++ b/debian/libpam-ck-connector.pam-auth-update
@@ -0,0 +1,6 @@
+Name: ConsoleKit Session Management
+Default: yes
+Priority: 0
+Session-Type: Additional
+Session-Final:
+ optional pam_ck_connector.so nox11
diff --git a/debian/libpam-ck-connector.postinst b/debian/libpam-ck-connector.postinst
new file mode 100644
index 0000000..7e37590
--- /dev/null
+++ b/debian/libpam-ck-connector.postinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+pam-auth-update --package
+
+#DEBHELPER#
diff --git a/debian/libpam-ck-connector.prerm b/debian/libpam-ck-connector.prerm
new file mode 100644
index 0000000..ecab883
--- /dev/null
+++ b/debian/libpam-ck-connector.prerm
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = remove ]; then
+ pam-auth-update --package --remove consolekit
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/patches/01-dbus_policy.patch b/debian/patches/01-dbus_policy.patch
deleted file mode 100644
index e558a40..0000000
--- a/debian/patches/01-dbus_policy.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-Allow only root to call the Restart and Stop D-Bus methods since we are
-not using PolicyKit to restrict the access to those methods.
-
-Index: ConsoleKit-0.2.10/data/ConsoleKit.conf
-===================================================================
---- ConsoleKit-0.2.10.orig/data/ConsoleKit.conf 2008-02-12 16:45:04.000000000 +0100
-+++ ConsoleKit-0.2.10/data/ConsoleKit.conf 2008-07-25 00:34:44.000000000 +0200
-@@ -22,10 +22,6 @@
- send_interface="org.freedesktop.DBus.Properties" />
-
- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
-- send_member="Restart"/>
-- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
-- send_member="Stop"/>
-- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
- send_member="OpenSession"/>
- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
- send_member="CloseSession"/>
-@@ -91,4 +87,11 @@
- send_member="GetIdleSinceHint"/>
- </policy>
-
-+ <policy user="root">
-+ <allow send_interface="org.freedesktop.ConsoleKit.Manager"
-+ send_member="Restart"/>
-+ <allow send_interface="org.freedesktop.ConsoleKit.Manager"
-+ send_member="Stop"/>
-+ </policy>
-+
- </busconfig>
diff --git a/debian/patches/02-exit_with_dbus.patch b/debian/patches/02-exit_with_dbus.patch
deleted file mode 100644
index 8cf3372..0000000
--- a/debian/patches/02-exit_with_dbus.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From 8ec523138671a8fe93748a0b75adaaca96e2392e Mon Sep 17 00:00:00 2001
-From: William Jon McCann <jmccann@redhat.com>
-Date: Mon, 5 May 2008 13:34:08 -0400
-Subject: [PATCH] exit with the bus now that we're activated by the bus
-
----
- src/main.c | 65 +++++++----------------------------------------------------
- 1 files changed, 8 insertions(+), 57 deletions(-)
-
-Index: ConsoleKit-0.2.10/src/main.c
-===================================================================
---- ConsoleKit-0.2.10.orig/src/main.c 2008-07-25 03:17:18.000000000 +0200
-+++ ConsoleKit-0.2.10/src/main.c 2008-07-25 03:17:26.000000000 +0200
-@@ -44,9 +44,6 @@
-
- #define CK_DBUS_NAME "org.freedesktop.ConsoleKit"
-
--static void bus_proxy_destroyed_cb (DBusGProxy *bus_proxy,
-- CkManager *manager);
--
- static gboolean
- timed_exit_cb (GMainLoop *loop)
- {
-@@ -138,60 +135,12 @@
- return bus;
- }
-
--static gboolean
--bus_reconnect (CkManager *manager)
--{
-- DBusGConnection *bus;
-- DBusGProxy *bus_proxy;
-- gboolean ret;
--
-- ret = TRUE;
--
-- bus = get_system_bus ();
-- if (bus == NULL) {
-- goto out;
-- }
--
-- bus_proxy = get_bus_proxy (bus);
-- if (bus_proxy == NULL) {
-- g_warning ("Could not construct bus_proxy object; will retry");
-- goto out;
-- }
--
-- if (! acquire_name_on_proxy (bus_proxy) ) {
-- g_warning ("Could not acquire name; will retry");
-- goto out;
-- }
--
-- manager = ck_manager_new ();
-- if (manager == NULL) {
-- g_warning ("Could not construct manager object");
-- exit (1);
-- }
--
-- g_signal_connect (bus_proxy,
-- "destroy",
-- G_CALLBACK (bus_proxy_destroyed_cb),
-- manager);
--
-- g_debug ("Successfully reconnected to D-Bus");
--
-- ret = FALSE;
--
-- out:
-- return ret;
--}
--
- static void
- bus_proxy_destroyed_cb (DBusGProxy *bus_proxy,
-- CkManager *manager)
-+ GMainLoop *loop)
- {
- g_debug ("Disconnected from D-Bus");
--
-- g_object_unref (manager);
-- manager = NULL;
--
-- g_timeout_add (3000, (GSourceFunc)bus_reconnect, manager);
-+ g_main_loop_quit (loop);
- }
-
- static void
-@@ -371,12 +320,12 @@
- goto out;
- }
-
-+ loop = g_main_loop_new (NULL, FALSE);
-+
- g_signal_connect (bus_proxy,
- "destroy",
- G_CALLBACK (bus_proxy_destroyed_cb),
-- manager);
--
-- loop = g_main_loop_new (NULL, FALSE);
-+ loop);
-
- if (do_timed_exit) {
- g_timeout_add (1000 * 30, (GSourceFunc) timed_exit_cb, loop);
-@@ -384,7 +333,9 @@
-
- g_main_loop_run (loop);
-
-- g_object_unref (manager);
-+ if (manager != NULL) {
-+ g_object_unref (manager);
-+ }
-
- g_main_loop_unref (loop);
-
diff --git a/debian/patches/04-consolekit_park.patch b/debian/patches/04-consolekit_park.patch
new file mode 100644
index 0000000..46f24e9
--- /dev/null
+++ b/debian/patches/04-consolekit_park.patch
@@ -0,0 +1,192 @@
+#
+# Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=11786
+#
+Index: consolekit-0.3/src/ck-manager.c
+===================================================================
+--- consolekit-0.3.orig/src/ck-manager.c 2008-09-23 20:56:46.000000000 +0200
++++ consolekit-0.3/src/ck-manager.c 2008-09-23 21:23:47.000000000 +0200
+@@ -30,6 +30,13 @@
+ #include <sys/types.h>
+ #include <errno.h>
+ #include <pwd.h>
++ #ifdef HAVE_PATHS_H
++ #include <paths.h>
++ #endif /* HAVE_PATHS_H */
++
++ #ifndef _PATH_TTY
++ #define _PATH_TTY "/dev/tty"
++ #endif
+
+ #include <glib.h>
+ #include <glib/gi18n.h>
+@@ -2370,6 +2377,41 @@
+ CkManager *manager;
+ } RemoveLeaderData;
+
++gboolean
++ck_manager_set_x11_parking_place (CkManager *manager,
++ const char *x11display,
++ const char *x11displaydevice,
++ DBusGMethodInvocation *context)
++{
++ CkSeat *seat;
++ guint num;
++ gboolean res = FALSE;
++
++ g_debug ("x11display=%s device=%s", x11display, x11displaydevice);
++
++ seat = g_hash_table_lookup (manager->priv->seats,
++ CK_DBUS_PATH "/Seat1");
++ /* FIXME: this is rather unpleasantly hardcoded, but it
++ * mirrors the code in find_seat_for_session - iwj */
++ if (seat == NULL) {
++ g_debug ("no seat");
++ goto xit;
++ }
++
++ if (sscanf (x11displaydevice, _PATH_TTY "%u", &num) != 1) {
++ g_debug ("bad device");
++ goto xit;
++ }
++
++ ck_seat_set_park_vt (seat, num);
++ res = TRUE;
++
++xit:
++ dbus_g_method_return (context, res);
++
++ return TRUE;
++}
++
+ static gboolean
+ remove_leader_for_connection (const char *cookie,
+ CkSessionLeader *leader,
+Index: consolekit-0.3/src/ck-manager.h
+===================================================================
+--- consolekit-0.3.orig/src/ck-manager.h 2008-09-23 20:56:46.000000000 +0200
++++ consolekit-0.3/src/ck-manager.h 2008-09-23 21:23:47.000000000 +0200
+@@ -94,6 +94,10 @@
+ gboolean ck_manager_close_session (CkManager *manager,
+ const char *cookie,
+ DBusGMethodInvocation *context);
++gboolean ck_manager_set_x11_parking_place (CkManager *manager,
++ const char *x11display,
++ const char *x11displaydevice,
++ DBusGMethodInvocation *context);
+ gboolean ck_manager_get_current_session (CkManager *manager,
+ DBusGMethodInvocation *context);
+ gboolean ck_manager_get_session_for_cookie (CkManager *manager,
+Index: consolekit-0.3/src/ck-seat.c
+===================================================================
+--- consolekit-0.3.orig/src/ck-seat.c 2008-09-23 20:56:46.000000000 +0200
++++ consolekit-0.3/src/ck-seat.c 2008-09-23 21:23:47.000000000 +0200
+@@ -61,6 +61,8 @@
+ CkSession *active_session;
+
+ CkVtMonitor *vt_monitor;
++ guint vt_park_num;
++ gboolean vt_park_enable;
+
+ DBusGConnection *connection;
+ };
+@@ -498,9 +500,17 @@
+ g_object_ref (session);
+ ck_session_get_id (session, &ssid, NULL);
+ ck_session_set_active (session, TRUE, NULL);
++ g_debug ("Active session changed: %s", ssid);
++ } else if (seat->priv->vt_park_enable) {
++ ck_seat_park (seat);
++ g_debug ("Active session: none - parking");
++ } else {
++ g_debug ("Active session: none and no parking");
+ }
+
+- g_debug ("Active session changed: %s", ssid ? ssid : "(null)");
++ /* We park only once: enable is set when a session exits
++ * and cleared here when we choose a new session. */
++ seat->priv->vt_park_enable = FALSE;
+
+ g_signal_emit (seat, signals [ACTIVE_SESSION_CHANGED], 0, ssid);
+
+@@ -549,6 +559,33 @@
+ return TRUE;
+ }
+
++void
++ck_seat_park (CkSeat *seat)
++{
++ GError *vt_error;
++ guint num;
++ gboolean ret;
++
++ num = seat->priv->vt_park_num;
++ g_debug ("Parking on VT %u", num);
++ if (num < 0) return;
++
++ vt_error = NULL;
++ ret = ck_vt_monitor_set_active (seat->priv->vt_monitor, num, &vt_error);
++ if (! ret) {
++ g_debug ("Unable to park: %s", vt_error->message);
++ g_error_free (vt_error);
++ }
++}
++
++void
++ck_seat_set_park_vt (CkSeat *seat, guint num)
++{
++ g_debug ("Parking place is VT %u", num);
++
++ seat->priv->vt_park_num = num;
++}
++
+ gboolean
+ ck_seat_remove_session (CkSeat *seat,
+ CkSession *session,
+@@ -592,6 +629,7 @@
+ g_signal_emit (seat, signals [SESSION_REMOVED], 0, ssid);
+
+ /* try to change the active session */
++ seat->priv->vt_park_enable = TRUE;
+ maybe_update_active_session (seat);
+
+ if (orig_session != NULL) {
+@@ -988,6 +1026,8 @@
+ g_str_equal,
+ g_free,
+ (GDestroyNotify) g_object_unref);
++ seat->priv->vt_park_num = -1;
++ seat->priv->vt_park_enable = FALSE;
+ seat->priv->devices = g_ptr_array_new ();
+ }
+
+Index: consolekit-0.3/src/ck-seat.h
+===================================================================
+--- consolekit-0.3.orig/src/ck-seat.h 2008-09-23 20:56:46.000000000 +0200
++++ consolekit-0.3/src/ck-seat.h 2008-09-23 21:23:47.000000000 +0200
+@@ -133,6 +133,9 @@
+ gboolean ck_seat_activate_session (CkSeat *seat,
+ const char *ssid,
+ DBusGMethodInvocation *context);
++void ck_seat_park (CkSeat *seat);
++void ck_seat_set_park_vt (CkSeat *seat,
++ guint num);
+
+ G_END_DECLS
+
+Index: consolekit-0.3/src/org.freedesktop.ConsoleKit.Manager.xml
+===================================================================
+--- consolekit-0.3.orig/src/org.freedesktop.ConsoleKit.Manager.xml 2008-09-23 21:23:55.000000000 +0200
++++ consolekit-0.3/src/org.freedesktop.ConsoleKit.Manager.xml 2008-09-23 21:24:01.000000000 +0200
+@@ -133,6 +133,12 @@
+ </doc:doc>
+ </method>
+
++ <method name="SetX11ParkingPlace">
++ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
++ <arg name="x11display" direction="in" type="s"/>
++ <arg name="x11displaydevice" direction="in" type="s"/>
++ </method>
++
+ <method name="GetSeats">
+ <arg name="seats" direction="out" type="ao">
+ <doc:doc>
diff --git a/debian/patches/05-dbus_policy.patch b/debian/patches/05-dbus_policy.patch
index b6e035a..52d5f99 100644
--- a/debian/patches/05-dbus_policy.patch
+++ b/debian/patches/05-dbus_policy.patch
@@ -1,23 +1,14 @@
-Patch from Colin Walters for http://bugs.freedesktop.org/show_bug.cgi?id=19020,
-adapted to apply to Debian's ConsoleKit.
+commit e0d9cc359b3099307067107b59ec691418e280b8
+Author: Colin Walters <walters@verbum.org>
+Date: Sun Jan 18 13:06:37 2009 -0500
-He writes:
-> This patch is relatively conservative; it adds send_destination= to all the
-> rules (as is very important, see
-> https://bugs.freedesktop.org/show_bug.cgi?id=18961).
->
-> It also adds SetIdleHint into the default allow. From the source it looks that
-> that method implementation checks the caller.
->
-> Please review.
->
-> Also an open question - do all the methods verify their caller? In that case
-> the policy file can be *much* simpler; see:
-> http://lists.freedesktop.org/archives/dbus/2008-December/010717.html
+ fix up D-Bus permissions
---- a/data/ConsoleKit.conf 2009-01-06 02:59:15.000000000 +0000
-+++ b/data/ConsoleKit.conf 2009-01-06 03:04:38.000000000 +0000
-@@ -8,89 +8,129 @@
+Index: consolekit-0.3.0/data/ConsoleKit.conf
+===================================================================
+--- consolekit-0.3.0.orig/data/ConsoleKit.conf 2009-03-03 01:48:13.000000000 +0100
++++ consolekit-0.3.0/data/ConsoleKit.conf 2009-03-03 01:48:28.000000000 +0100
+@@ -8,88 +8,128 @@
<allow own="org.freedesktop.ConsoleKit"/>
<!-- Allow all methods on interfaces -->
@@ -46,6 +37,14 @@ He writes:
- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
+ <allow send_destination="org.freedesktop.ConsoleKit"
+ send_interface="org.freedesktop.ConsoleKit.Manager"
+ send_member="Restart"/>
+- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
++ <allow send_destination="org.freedesktop.ConsoleKit"
++ send_interface="org.freedesktop.ConsoleKit.Manager"
+ send_member="Stop"/>
+- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
++ <allow send_destination="org.freedesktop.ConsoleKit"
++ send_interface="org.freedesktop.ConsoleKit.Manager"
send_member="OpenSession"/>
- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
+ <allow send_destination="org.freedesktop.ConsoleKit"
@@ -120,6 +119,10 @@ He writes:
- <allow send_interface="org.freedesktop.ConsoleKit.Session"
+ <allow send_destination="org.freedesktop.ConsoleKit"
+ send_interface="org.freedesktop.ConsoleKit.Session"
+ send_member="GetLoginSessionId"/>
+- <allow send_interface="org.freedesktop.ConsoleKit.Session"
++ <allow send_destination="org.freedesktop.ConsoleKit"
++ send_interface="org.freedesktop.ConsoleKit.Session"
send_member="GetSessionType"/>
- <allow send_interface="org.freedesktop.ConsoleKit.Session"
+ <allow send_destination="org.freedesktop.ConsoleKit"
@@ -168,21 +171,9 @@ He writes:
- <allow send_interface="org.freedesktop.ConsoleKit.Session"
+ <allow send_destination="org.freedesktop.ConsoleKit"
+ send_interface="org.freedesktop.ConsoleKit.Session"
- send_member="GetIdleSinceHint"/>
-+
-+ <allow send_destination="org.freedesktop.ConsoleKit"
-+ send_interface="org.freedesktop.ConsoleKit.Session"
+ send_member="SetIdleHint"/>
- </policy>
-
- <policy user="root">
-- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
-+ <allow send_destination="org.freedesktop.ConsoleKit"
-+ send_interface="org.freedesktop.ConsoleKit.Manager"
- send_member="Restart"/>
-- <allow send_interface="org.freedesktop.ConsoleKit.Manager"
+ <allow send_destination="org.freedesktop.ConsoleKit"
-+ send_interface="org.freedesktop.ConsoleKit.Manager"
- send_member="Stop"/>
++ send_interface="org.freedesktop.ConsoleKit.Session"
+ send_member="GetIdleSinceHint"/>
</policy>
diff --git a/debian/patches/05-pam-add-nox11.patch b/debian/patches/05-pam-add-nox11.patch
new file mode 100644
index 0000000..ddac6bc
--- /dev/null
+++ b/debian/patches/05-pam-add-nox11.patch
@@ -0,0 +1,54 @@
+# Description: Add "nox11" option to the PAM module, which ignores PAM
+# sessions where PAM_TTY is an X11 display. This allows adding
+# pam_ck_connector to PAM's "common-session" without interfering
+# with the already existing ConsoleKit operations in gdm, the
+# Xsession script, etc.
+# Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=16746
+
+Index: consolekit-0.2.10/pam-ck-connector/pam-ck-connector.c
+===================================================================
+--- consolekit-0.2.10.orig/pam-ck-connector/pam-ck-connector.c 2008-08-04 18:23:37.000000000 +0200
++++ consolekit-0.2.10/pam-ck-connector/pam-ck-connector.c 2008-08-04 18:23:49.000000000 +0200
+@@ -63,6 +63,7 @@
+ #include "ck-connector.h"
+
+ static int opt_debug = FALSE;
++static int opt_nox11 = FALSE;
+
+ #ifndef HAVE_PAM_SYSLOG
+
+@@ -145,6 +146,8 @@
+ for (i = 0; i < argc && argv[i] != NULL; i++) {
+ if (strcmp (argv[i] , "debug") == 0) {
+ opt_debug = TRUE;
++ } else if (strcmp (argv[i] , "nox11") == 0) {
++ opt_nox11 = TRUE;
+ } else {
+ ck_pam_syslog (pamh, LOG_ERR, "unknown option: %s", argv[i]);
+ }
+@@ -276,6 +279,10 @@
+ x11_display = NULL;
+ /* interpret any tty with a colon as a DISPLAY */
+ if (strchr (display_device, ':') != NULL) {
++ if (opt_nox11) {
++ ck_pam_syslog (pamh, LOG_WARNING, "nox11 mode, ignoring PAM_TTY %s", display_device);
++ goto out;
++ }
+ x11_display = display_device;
+ display_device = "";
+ } else if (strncmp (_PATH_DEV, display_device, 5) != 0) {
+Index: consolekit-0.2.10/pam-ck-connector/pam_ck_connector.8
+===================================================================
+--- consolekit-0.2.10.orig/pam-ck-connector/pam_ck_connector.8 2008-08-04 18:23:44.000000000 +0200
++++ consolekit-0.2.10/pam-ck-connector/pam_ck_connector.8 2008-08-04 18:23:49.000000000 +0200
+@@ -66,6 +66,10 @@
+ .TP 3n
+ \fBdebug\fR
+ Print debug information.
++.TP 3n
++\fBnox11\fR
++Do not create a session if PAM specifies an X11 display instead of a
++/dev/tty terminal.
+ .fi
+ .RE
+ .sp
diff --git a/debian/patches/06-xmlto_skip_validation.patch b/debian/patches/06-xmlto_skip_validation.patch
new file mode 100644
index 0000000..480a83e
--- /dev/null
+++ b/debian/patches/06-xmlto_skip_validation.patch
@@ -0,0 +1,26 @@
+Index: consolekit-0.3.0/doc/dbus/Makefile.am
+===================================================================
+--- consolekit-0.3.0.orig/doc/dbus/Makefile.am 2009-03-03 01:56:14.000000000 +0100
++++ consolekit-0.3.0/doc/dbus/Makefile.am 2009-03-03 01:56:42.000000000 +0100
+@@ -16,7 +16,7 @@
+ htmldoc_DATA = ConsoleKit.html
+
+ ConsoleKit.html : $(SPEC_XML_FILES)
+- $(XMLTO) xhtml-nochunks -m $(top_srcdir)/doc/dbus/config.xsl ConsoleKit.xml
++ $(XMLTO) --skip-validation xhtml-nochunks -m $(top_srcdir)/doc/dbus/config.xsl ConsoleKit.xml
+
+ endif # DOCBOOK_DOCS_ENABLED
+
+Index: consolekit-0.3.0/doc/dbus/Makefile.in
+===================================================================
+--- consolekit-0.3.0.orig/doc/dbus/Makefile.in 2009-03-03 01:56:12.000000000 +0100
++++ consolekit-0.3.0/doc/dbus/Makefile.in 2009-03-03 01:57:03.000000000 +0100
+@@ -427,7 +427,7 @@
+
+
+ @DOCBOOK_DOCS_ENABLED_TRUE@ConsoleKit.html : $(SPEC_XML_FILES)
+-@DOCBOOK_DOCS_ENABLED_TRUE@ $(XMLTO) xhtml-nochunks -m $(top_srcdir)/doc/dbus/config.xsl ConsoleKit.xml
++@DOCBOOK_DOCS_ENABLED_TRUE@ $(XMLTO) --skip-validation xhtml-nochunks -m $(top_srcdir)/doc/dbus/config.xsl ConsoleKit.xml
+
+ org.freedesktop.ConsoleKit.Manager.ref.xml : $(top_srcdir)/src/org.freedesktop.ConsoleKit.Manager.xml spec-to-docbook.xsl
+ $(XSLTPROC) $(top_srcdir)/doc/dbus/spec-to-docbook.xsl $< | tail -n +2 > $@
diff --git a/debian/patches/08-fix-double-close.patch b/debian/patches/08-fix-double-close.patch
new file mode 100644
index 0000000..7dc9daf
--- /dev/null
+++ b/debian/patches/08-fix-double-close.patch
@@ -0,0 +1,31 @@
+# Description: Fix double close of the log file (->file is an fdopen(->priv), which occasionally causes segfaults.
+# Ubuntu: https://bugs.launchpad.net/bugs/263245
+# Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=17866
+# Upstream: http://gitweb.freedesktop.org/?p=ConsoleKit.git;a=commitdiff;h=a58a4bff451dcf8a6019aed1b2fb276e9836b0f4
+--- a/src/ck-event-logger.c
++++ b/src/ck-event-logger.c
+@@ -180,8 +180,10 @@ retry:
+ static void
+ reopen_file_stream (CkEventLogger *event_logger)
+ {
+- close (event_logger->priv->fd);
+- fclose (event_logger->priv->file);
++ /* fclose will also close the underlying fd */
++ if (event_logger->priv->file != NULL) {
++ fclose (event_logger->priv->file);
++ }
+
+ /* FIXME: retries */
+ open_log_file (event_logger);
+@@ -420,8 +422,8 @@ ck_event_logger_finalize (GObject *objec
+ g_async_queue_unref (event_logger->priv->event_queue);
+ }
+
+- if (event_logger->priv->fd != -1) {
+- close (event_logger->priv->fd);
++ if (event_logger->priv->file != NULL) {
++ fclose (event_logger->priv->file);
+ }
+
+ g_free (event_logger->priv->log_filename);
+
diff --git a/debian/patches/09-directory-handle-leak.patch b/debian/patches/09-directory-handle-leak.patch
new file mode 100644
index 0000000..028fd82
--- /dev/null
+++ b/debian/patches/09-directory-handle-leak.patch
@@ -0,0 +1,15 @@
+# Description: Close the directory handle when we're done with it, so that we aren't leaking file descriptors.
+# Ubuntu: https://launchpad.net/bugs/276918
+# Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=17893
+Index: consolekit-0.2.10/src/ck-run-programs.c
+===================================================================
+--- consolekit-0.2.10.orig/src/ck-run-programs.c
++++ consolekit-0.2.10/src/ck-run-programs.c
+@@ -225,6 +225,7 @@
+ out_loop:
+ g_free (child_argv[0]);
+ }
++ g_dir_close (dir);
+ out:
+ g_strfreev (env_for_child);
+ }
diff --git a/debian/patches/10-file_monitor_remove_watch_crash.patch b/debian/patches/10-file_monitor_remove_watch_crash.patch
new file mode 100644
index 0000000..a4b3bf0
--- /dev/null
+++ b/debian/patches/10-file_monitor_remove_watch_crash.patch
@@ -0,0 +1,249 @@
+# Description: Fix common crash when trying to remove a NULL watch
+# Ubuntu: https://launchpad.net/bugs/269651
+# Upstream: http://bugs.freedesktop.org/show_bug.cgi?id=18046
+Index: consolekit-0.2.10/src/ck-file-monitor-inotify.c
+===================================================================
+--- consolekit-0.2.10.orig/src/ck-file-monitor-inotify.c 2008-10-20 14:41:37.000000000 +0100
++++ consolekit-0.2.10/src/ck-file-monitor-inotify.c 2008-10-20 14:56:02.000000000 +0100
+@@ -55,7 +55,7 @@
+
+ typedef struct
+ {
+- FileInotifyWatch *watch;
++ gint wd;
+ CkFileMonitorEvent event;
+ char *path;
+ } FileMonitorEventInfo;
+@@ -80,7 +80,9 @@
+ guchar *buffer;
+
+ guint events_idle_id;
++ guint remove_idle_id;
+ GQueue *notify_events;
++ GQueue *remove_events;
+ };
+
+ enum {
+@@ -242,6 +244,10 @@
+ file_monitor_remove_watch (CkFileMonitor *monitor,
+ FileInotifyWatch *watch)
+ {
++ if (watch->wd == -1) {
++ return;
++ }
++
+ g_hash_table_remove (monitor->priv->path_to_watch,
+ watch->path);
+ g_hash_table_remove (monitor->priv->wd_to_watch,
+@@ -296,6 +302,7 @@
+ emit_events_in_idle (CkFileMonitor *monitor)
+ {
+ FileMonitorEventInfo *event_info;
++ gchar *path, *freeme;
+
+ monitor->priv->events_idle_id = 0;
+
+@@ -303,29 +310,39 @@
+ GSList *l;
+ FileInotifyWatch *watch;
+
+- watch = event_info->watch;
+-
+- for (l = watch->notifies; l != NULL; l = l->next) {
+- FileMonitorNotify *notify;
++ watch = g_hash_table_lookup (monitor->priv->wd_to_watch,
++ GINT_TO_POINTER (event_info->wd));
+
+- notify = g_hash_table_lookup (monitor->priv->notifies,
+- GUINT_TO_POINTER (l->data));
+- if (notify == NULL) {
+- continue;
+- }
+-
+- if (! (notify->mask & event_info->event)) {
+- continue;
+- }
+-
+- if (notify->notify_func) {
+- notify->notify_func (monitor, event_info->event, event_info->path, notify->user_data);
+- }
++ if (watch) {
++ for (l = watch->notifies; l != NULL; l = l->next) {
++ FileMonitorNotify *notify;
++
++ notify = g_hash_table_lookup (monitor->priv->notifies,
++ GUINT_TO_POINTER (l->data));
++ if (notify == NULL) {
++ continue;
++ }
++
++ if (! (notify->mask & event_info->event)) {
++ continue;
++ }
++
++ if (notify->notify_func) {
++ freeme = NULL;
++ if (event_info->path) {
++ path = freeme = g_build_filename (watch->path, event_info->path, NULL);
++ } else {
++ path = watch->path;
++ }
++ notify->notify_func (monitor, event_info->event, path, notify->user_data);
++ if (freeme) {
++ g_free (freeme);
++ }
++ }
++ }
+ }
+
+- g_free (event_info->path);
+ event_info->path = NULL;
+-
+ event_info->event = CK_FILE_MONITOR_EVENT_NONE;
+
+ g_free (event_info);
+@@ -334,6 +351,37 @@
+ return FALSE;
+ }
+
++static gboolean
++emit_removals_in_idle (CkFileMonitor *monitor)
++{
++ gint wd;
++ FileInotifyWatch *watch;
++ GSList *l;
++
++ monitor->priv->remove_idle_id = 0;
++
++ while ((wd = g_queue_pop_head (monitor->priv->remove_events)) != NULL) {
++ watch = g_hash_table_lookup (monitor->priv->wd_to_watch,
++ GINT_TO_POINTER (wd));
++ if (watch && watch->wd != -1) {
++ for (l = watch->notifies; l != NULL; l = l->next) {
++ FileMonitorNotify *notify;
++
++ notify = g_hash_table_lookup (monitor->priv->notifies,
++ GUINT_TO_POINTER (l->data));
++ if (notify == NULL) {
++ continue;
++ }
++ notify->watch = NULL;
++ }
++ file_monitor_remove_watch (monitor, watch);
++ g_free (watch);
++ }
++ }
++
++ return FALSE;
++}
++
+ static void
+ file_monitor_queue_event (CkFileMonitor *monitor,
+ FileMonitorEventInfo *event_info)
+@@ -347,7 +395,7 @@
+
+ static void
+ queue_watch_event (CkFileMonitor *monitor,
+- FileInotifyWatch *watch,
++ gint wd,
+ CkFileMonitorEvent event,
+ const char *path)
+ {
+@@ -355,7 +403,7 @@
+
+ event_info = g_new0 (FileMonitorEventInfo, 1);
+
+- event_info->watch = watch;
++ event_info->wd = wd;
+ event_info->path = g_strdup (path);
+ event_info->event = event;
+
+@@ -363,8 +411,18 @@
+ }
+
+ static void
++queue_remove_event (CkFileMonitor *monitor,
++ gint wd)
++{
++ g_queue_push_tail (monitor->priv->remove_events, wd);
++
++ if (monitor->priv->remove_idle_id == 0) {
++ monitor->priv->remove_idle_id = g_idle_add ((GSourceFunc) emit_removals_in_idle, monitor);
++ }
++}
++
++static void
+ handle_inotify_event (CkFileMonitor *monitor,
+- FileInotifyWatch *watch,
+ struct inotify_event *ievent)
+ {
+ CkFileMonitorEvent event;
+@@ -375,9 +433,9 @@
+ freeme = NULL;
+
+ if (ievent->len > 0) {
+- path = freeme = g_build_filename (watch->path, ievent->name, NULL);
++ path = ievent->name;
+ } else {
+- path = watch->path;
++ path = NULL;
+ }
+
+ mask_str = imask_to_string (ievent->mask);
+@@ -397,11 +455,11 @@
+ }
+
+ if (event != CK_FILE_MONITOR_EVENT_NONE) {
+- queue_watch_event (monitor, watch, event, path);
++ queue_watch_event (monitor, ievent->wd, event, path);
+ }
+
+ if (ievent->mask & IN_IGNORED) {
+- file_monitor_remove_watch (monitor, watch);
++ queue_remove_event (monitor, ievent->wd);
+ }
+ }
+
+@@ -460,7 +518,7 @@
+ watch = g_hash_table_lookup (monitor->priv->wd_to_watch,
+ GINT_TO_POINTER (ievent->wd));
+ if (watch != NULL) {
+- handle_inotify_event (monitor, watch, ievent);
++ handle_inotify_event (monitor, ievent);
+ }
+
+ i += sizeof (struct inotify_event) + ievent->len;
+@@ -523,11 +581,13 @@
+ g_hash_table_steal (monitor->priv->notifies,
+ GUINT_TO_POINTER (id));
+
+- notify->watch->notifies = g_slist_remove (notify->watch->notifies, GUINT_TO_POINTER (id));
++ if (notify->watch) {
++ notify->watch->notifies = g_slist_remove (notify->watch->notifies, GUINT_TO_POINTER (id));
+
+- if (g_slist_length (notify->watch->notifies) == 0) {
+- file_monitor_remove_watch (monitor, notify->watch);
+- g_free (notify->watch);
++ if (g_slist_length (notify->watch->notifies) == 0) {
++ file_monitor_remove_watch (monitor, notify->watch);
++ g_free (notify->watch);
++ }
+ }
+
+ g_free (notify);
+@@ -629,6 +689,7 @@
+
+ monitor->priv->serial = 1;
+ monitor->priv->notify_events = g_queue_new ();
++ monitor->priv->remove_events = g_queue_new ();
+
+ setup_inotify (monitor);
+ }
+@@ -649,6 +710,7 @@
+
+ g_hash_table_destroy (monitor->priv->notifies);
+ g_queue_free (monitor->priv->notify_events);
++ g_queue_free (monitor->priv->remove_events);
+
+ G_OBJECT_CLASS (ck_file_monitor_parent_class)->finalize (object);
+ }
diff --git a/debian/patches/11-unref-dbus-proxy.patch b/debian/patches/11-unref-dbus-proxy.patch
new file mode 100644
index 0000000..be8f441
--- /dev/null
+++ b/debian/patches/11-unref-dbus-proxy.patch
@@ -0,0 +1,16 @@
+# Unref the dbus proxy when finalizing the session object, so that they are not leaked
+# Ubuntu: https://launchpad.net/bugs/284229
+# Upstream: https://bugs.freedesktop.org/show_bug.cgi?id=18330
+Index: consolekit-0.3/src/ck-session.c
+===================================================================
+--- consolekit-0.3.orig/src/ck-session.c 2008-11-23 16:51:26.000000000 +0000
++++ consolekit-0.3/src/ck-session.c 2008-11-23 16:51:41.000000000 +0000
+@@ -1100,6 +1100,8 @@
+
+ session_remove_activity_watch (session);
+
++ g_object_unref (session->priv->bus_proxy);
++
+ g_free (session->priv->id);
+ g_free (session->priv->cookie);
+ g_free (session->priv->seat_id);
diff --git a/debian/patches/12-allow-get-sessions.patch b/debian/patches/12-allow-get-sessions.patch
new file mode 100644
index 0000000..30cc85b
--- /dev/null
+++ b/debian/patches/12-allow-get-sessions.patch
@@ -0,0 +1,13 @@
+diff -ur ConsoleKit-0.3.0/data/ConsoleKit.conf ConsoleKit-ted/data/ConsoleKit.conf
+--- ConsoleKit-0.3.0/data/ConsoleKit.conf 2009-03-04 14:02:53.000000000 -0600
++++ ConsoleKit-ted/data/ConsoleKit.conf 2009-03-04 14:03:21.000000000 -0600
+@@ -41,6 +41,9 @@
+ send_member="GetSeats"/>
+ <allow send_destination="org.freedesktop.ConsoleKit"
+ send_interface="org.freedesktop.ConsoleKit.Manager"
++ send_member="GetSessions"/>
++ <allow send_destination="org.freedesktop.ConsoleKit"
++ send_interface="org.freedesktop.ConsoleKit.Manager"
+ send_member="GetSessionForCookie"/>
+ <allow send_destination="org.freedesktop.ConsoleKit"
+ send_interface="org.freedesktop.ConsoleKit.Manager"
diff --git a/debian/patches/80-gnukfreebsd_support_configure.ac.patch b/debian/patches/80-gnukfreebsd_support_configure.ac.patch
new file mode 100644
index 0000000..b41fe8f
--- /dev/null
+++ b/debian/patches/80-gnukfreebsd_support_configure.ac.patch
@@ -0,0 +1,13 @@
+Index: ConsoleKit-0.3.0/configure.ac
+===================================================================
+--- ConsoleKit-0.3.0.orig/configure.ac 2008-07-31 02:35:53.000000000 +0200
++++ ConsoleKit-0.3.0/configure.ac 2009-03-10 12:06:52.000000000 +0100
+@@ -176,7 +176,7 @@
+ CK_BACKEND=""
+ KVM_LIBS=""
+ case "$host" in
+- *-*-freebsd*)
++ *-*-freebsd* | *-*-kfreebsd*-gnu)
+ CK_BACKEND="freebsd"
+ AC_CHECK_LIB(kvm, kvm_openfiles, have_kvm=yes,
+ AC_MSG_ERROR([Unable to find libkvm which is needed on FreeBSD]))
diff --git a/debian/patches/81-gnukfreebsd_support_pseudo_run_autoconf.patch b/debian/patches/81-gnukfreebsd_support_pseudo_run_autoconf.patch
new file mode 100644
index 0000000..1e76eb7
--- /dev/null
+++ b/debian/patches/81-gnukfreebsd_support_pseudo_run_autoconf.patch
@@ -0,0 +1,13 @@
+Index: ConsoleKit-0.3.0/configure
+===================================================================
+--- ConsoleKit-0.3.0.orig/configure 2008-07-31 02:41:02.000000000 +0200
++++ ConsoleKit-0.3.0/configure 2009-03-10 12:06:52.000000000 +0100
+@@ -24393,7 +24393,7 @@
+ CK_BACKEND=""
+ KVM_LIBS=""
+ case "$host" in
+- *-*-freebsd*)
++ *-*-freebsd* | *-*-kfreebsd*-gnu)
+ CK_BACKEND="freebsd"
+ { echo "$as_me:$LINENO: checking for kvm_openfiles in -lkvm" >&5
+ echo $ECHO_N "checking for kvm_openfiles in -lkvm... $ECHO_C" >&6; }
diff --git a/debian/patches/series b/debian/patches/series
index 49b0066..84ad52c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,13 @@
-01-dbus_policy.patch
-02-exit_with_dbus.patch
03-cleanup_console_tags.patch
+04-consolekit_park.patch
04-defer_daemonizing.patch
05-dbus_policy.patch
+05-pam-add-nox11.patch
+06-xmlto_skip_validation.patch
+08-fix-double-close.patch
+09-directory-handle-leak.patch
+10-file_monitor_remove_watch_crash.patch
+11-unref-dbus-proxy.patch
+12-allow-get-sessions.patch
+80-gnukfreebsd_support_configure.ac.patch
+81-gnukfreebsd_support_pseudo_run_autoconf.patch
diff --git a/debian/rules b/debian/rules
index 6d3a5f2..49f7fe3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,3 +13,4 @@ DEB_CONFIGURE_EXTRA_FLAGS := --enable-pam-module \
install/consolekit::
install -m 755 debian/pam-foreground-compat.ck debian/tmp/usr/lib/ConsoleKit/run-session.d/
+ install -D -m 644 debian/libpam-ck-connector.pam-auth-update debian/tmp/usr/share/pam-configs/consolekit