aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Popov <arrowd@FreeBSD.org>2023-08-31 07:55:34 +0000
committerGleb Popov <arrowd@FreeBSD.org>2023-08-31 07:55:34 +0000
commit12b84b980b45573c93be5382a274dbe872a1eb73 (patch)
tree19e20e8f9611a6e2a2e0990bc259663e8204f05d
parentc256b14367a832b7cac31ee86b6e59fa74ec0d02 (diff)
downloadports-12b84b980b45573c93be5382a274dbe872a1eb73.tar.gz
ports-12b84b980b45573c93be5382a274dbe872a1eb73.zip
sysutils/polkit: Adapt to ConsoleKit changes.
Sponsored by: Serenity Cybersecurity, LLC
-rw-r--r--UPDATING8
-rw-r--r--sysutils/polkit/Makefile1
-rw-r--r--sysutils/polkit/files/patch-src_polkit_polkitunixsession.c53
-rw-r--r--sysutils/polkit/files/patch-src_polkitbackend_polkitbackendsessionmonitor.c45
4 files changed, 107 insertions, 0 deletions
diff --git a/UPDATING b/UPDATING
index 428c7169615b..7ded41161f91 100644
--- a/UPDATING
+++ b/UPDATING
@@ -6,6 +6,14 @@ You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
20230822:
+ AUTHOR: arrowd@FreeBSD.org
+ AFFECTS: users of sysutils/polkit together with sysutils/consolekit2
+
+ ConsoleKit2 has grown some logind1 compatibility which resulted in breaking
+ changes in its API. One of its consumers, Polkit, is patched to handle it,
+ so make sure to update both ports simultaneously.
+
+20230822:
AUTHOR: leres@FreeBSD.org
AFFECTS: users of security/zeek
diff --git a/sysutils/polkit/Makefile b/sysutils/polkit/Makefile
index ef09a86ecf56..5c8cb59f7691 100644
--- a/sysutils/polkit/Makefile
+++ b/sysutils/polkit/Makefile
@@ -1,5 +1,6 @@
PORTNAME= polkit
DISTVERSION= 123
+PORTREVISION= 1
CATEGORIES= sysutils gnome
MAINTAINER= desktop@FreeBSD.org
diff --git a/sysutils/polkit/files/patch-src_polkit_polkitunixsession.c b/sysutils/polkit/files/patch-src_polkit_polkitunixsession.c
new file mode 100644
index 000000000000..6367e0e5c6b6
--- /dev/null
+++ b/sysutils/polkit/files/patch-src_polkit_polkitunixsession.c
@@ -0,0 +1,53 @@
+FreeBSD ConsoleKit is patched to return proper IDs instead D-Bus paths, so
+adapt Polkit to this case.
+
+--- src/polkit/polkitunixsession.c.orig 2023-07-28 12:34:38 UTC
++++ src/polkit/polkitunixsession.c
+@@ -364,6 +364,7 @@ polkit_unix_session_exists_sync (PolkitSubject *subj
+ PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject);
+ GDBusConnection *connection;
+ GVariant *result;
++ const gchar* session_path = NULL;
+ gboolean ret;
+
+ ret = FALSE;
+@@ -372,9 +373,12 @@ polkit_unix_session_exists_sync (PolkitSubject *subj
+ if (connection == NULL)
+ goto out;
+
++ if (strncmp (session->session_id, "/org/freedesktop/ConsoleKit", strlen ("/org/freedesktop/ConsoleKit") ))
++ session_path = g_build_path("/", "/org/freedesktop/ConsoleKit", session->session_id, NULL);
++
+ result = g_dbus_connection_call_sync (connection,
+ "org.freedesktop.ConsoleKit", /* name */
+- session->session_id, /* object path */
++ session_path ? session_path : session->session_id, /* object path */
+ "org.freedesktop.ConsoleKit.Session", /* interface name */
+ "GetUser", /* method */
+ NULL, /* parameters */
+@@ -383,6 +387,7 @@ polkit_unix_session_exists_sync (PolkitSubject *subj
+ -1,
+ cancellable,
+ error);
++ g_free (session_path);
+ if (result == NULL)
+ goto out;
+
+@@ -472,6 +477,7 @@ polkit_unix_session_initable_init (GInitable *init
+ PolkitUnixSession *session = POLKIT_UNIX_SESSION (initable);
+ GDBusConnection *connection;
+ GVariant *result;
++ const gchar* session_path;
+ gboolean ret;
+
+ connection = NULL;
+@@ -502,7 +508,8 @@ polkit_unix_session_initable_init (GInitable *init
+ if (result == NULL)
+ goto out;
+
+- g_variant_get (result, "(o)", &session->session_id);
++ g_variant_get (result, "(&o)", &session_path);
++ session->session_id = g_path_get_basename (session_path);
+ g_variant_unref (result);
+
+ ret = TRUE;
diff --git a/sysutils/polkit/files/patch-src_polkitbackend_polkitbackendsessionmonitor.c b/sysutils/polkit/files/patch-src_polkitbackend_polkitbackendsessionmonitor.c
new file mode 100644
index 000000000000..216f00b94e58
--- /dev/null
+++ b/sysutils/polkit/files/patch-src_polkitbackend_polkitbackendsessionmonitor.c
@@ -0,0 +1,45 @@
+FreeBSD ConsoleKit is patched to return proper IDs instead D-Bus paths, so
+adapt Polkit to this case.
+
+--- src/polkitbackend/polkitbackendsessionmonitor.c.orig 2023-07-28 12:34:38 UTC
++++ src/polkitbackend/polkitbackendsessionmonitor.c
+@@ -385,7 +385,7 @@ polkit_backend_session_monitor_get_session_for_subject
+
+ if (POLKIT_IS_UNIX_PROCESS (subject))
+ {
+- const gchar *session_id;
++ const gchar *session_path, *session_id;
+ GVariant *result;
+ result = g_dbus_connection_call_sync (monitor->system_bus,
+ "org.freedesktop.ConsoleKit",
+@@ -400,14 +400,16 @@ polkit_backend_session_monitor_get_session_for_subject
+ error);
+ if (result == NULL)
+ goto out;
+- g_variant_get (result, "(&o)", &session_id);
++ g_variant_get (result, "(&o)", &session_path);
++ session_id = g_path_get_basename (session_path);
+ session = polkit_unix_session_new (session_id);
++ g_free (session_id);
+ g_variant_unref (result);
+ }
+ else if (POLKIT_IS_SYSTEM_BUS_NAME (subject))
+ {
+ guint32 pid;
+- const gchar *session_id;
++ const gchar *session_path, *session_id;
+ GVariant *result;
+
+ result = g_dbus_connection_call_sync (monitor->system_bus,
+@@ -439,8 +441,10 @@ polkit_backend_session_monitor_get_session_for_subject
+ error);
+ if (result == NULL)
+ goto out;
+- g_variant_get (result, "(&o)", &session_id);
++ g_variant_get (result, "(&o)", &session_path);
++ session_id = g_path_get_basename (session_path);
+ session = polkit_unix_session_new (session_id);
++ g_free (session_id);
+ g_variant_unref (result);
+ }
+ else