summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-08-19 00:01:47 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-08-27 18:01:51 -0500
commit44bea83dd83ea323ef2a3ea0e3d4674256f13e00 (patch)
tree33d60eda56be28e7b742cf9b8ef2199bf0260e35
parent3a693d9a9814877562c44a651ab517120d3e6530 (diff)
downloadpackages-44bea83dd83ea323ef2a3ea0e3d4674256f13e00.tar.gz
packages-44bea83dd83ea323ef2a3ea0e3d4674256f13e00.tar.bz2
packages-44bea83dd83ea323ef2a3ea0e3d4674256f13e00.tar.xz
packages-44bea83dd83ea323ef2a3ea0e3d4674256f13e00.zip
user/polkit-sd: New package
This is PolKit built against systemd instead of elogind.
-rw-r--r--user/polkit-sd/APKBUILD50
-rw-r--r--user/polkit-sd/fix-consolekit-db-stat.patch30
-rw-r--r--user/polkit-sd/fix-test-fgetpwent.patch20
-rw-r--r--user/polkit-sd/polkit-sd.pre-install5
-rw-r--r--user/polkit-sd/polkit-sd.pre-upgrade5
5 files changed, 110 insertions, 0 deletions
diff --git a/user/polkit-sd/APKBUILD b/user/polkit-sd/APKBUILD
new file mode 100644
index 000000000..f5b332770
--- /dev/null
+++ b/user/polkit-sd/APKBUILD
@@ -0,0 +1,50 @@
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=polkit-sd
+pkgver=123
+pkgrel=0
+pkgdesc="Toolkit for controlling system-wide privileges"
+url="https://www.freedesktop.org/wiki/Software/polkit/"
+arch="all"
+options="!check suid" # Requires running ConsoleKit and PolKit for JS backend
+license="LGPL-2.0+"
+depends=""
+makedepends="glib-dev gobject-introspection-dev gtk-doc linux-pam-dev meson
+ duktape-dev systemd-dev"
+pkgusers="polkitd"
+pkggroups="polkitd"
+install="$pkgname.pre-install $pkgname.pre-upgrade"
+provides="polkit=$pkgver-r$pkgrel"
+replaces="polkit=$pkgver-r$pkgrel"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
+source="https://gitlab.freedesktop.org/polkit/polkit/-/archive/$pkgver/polkit-$pkgver.tar.bz2
+ fix-consolekit-db-stat.patch
+ fix-test-fgetpwent.patch
+ "
+builddir="$srcdir/polkit-$pkgver"
+
+# secfixes:
+# 0.123-r0:
+# - CVE-2021-4034
+# 0.115-r2:
+# - CVE-2018-19788
+
+build() {
+ meson setup . build \
+ -Dsession_tracking=libsystemd-login \
+ -Dman=true \
+ -Dpam_include='base-auth'
+ meson compile -C build
+}
+
+check() {
+ meson test -C build
+}
+
+package() {
+ meson install -C build --destdir="$pkgdir"
+}
+
+sha512sums="4306363d3ed7311243de462832199bd10ddda35e36449104daff0895725d8189b07a4c88340f28607846fdf761c23470da2d43288199c46aa816426384124bb6 polkit-123.tar.bz2
+bfefe2398f97138391ed34630e2994670dddaa0b13585e2e7cb101e7d11e3054dd491244ec84116b908d0f126a69032c467d83a0c52b0bb980d9b10290600745 fix-consolekit-db-stat.patch
+966825aded565432f4fda9e54113a773b514ebf7ee7faa83bcb8b97d218ae84a8707d6747bbc3cb8a828638d692fdef34c05038f150ad38e02a29f2c782aba5b fix-test-fgetpwent.patch"
diff --git a/user/polkit-sd/fix-consolekit-db-stat.patch b/user/polkit-sd/fix-consolekit-db-stat.patch
new file mode 100644
index 000000000..d06ce7ae7
--- /dev/null
+++ b/user/polkit-sd/fix-consolekit-db-stat.patch
@@ -0,0 +1,30 @@
+--- polkit-0.105.orig/src/polkitbackend/polkitbackendsessionmonitor.c 2012-04-24 19:05:34.000000000 +0300
++++ polkit-0.105/src/polkitbackend/polkitbackendsessionmonitor.c 2015-08-17 14:50:51.428580856 +0300
+@@ -48,7 +48,7 @@ struct _PolkitBackendSessionMonitor
+
+ GKeyFile *database;
+ GFileMonitor *database_monitor;
+- time_t database_mtime;
++ struct timespec database_mtim;
+ };
+
+ struct _PolkitBackendSessionMonitorClass
+@@ -96,7 +96,7 @@ reload_database (PolkitBackendSessionMon
+ goto out;
+ }
+
+- monitor->database_mtime = statbuf.st_mtime;
++ monitor->database_mtim = statbuf.st_mtim;
+
+ monitor->database = g_key_file_new ();
+ if (!g_key_file_load_from_file (monitor->database,
+@@ -132,7 +132,8 @@ ensure_database (PolkitBackendSessionMon
+ strerror (errno));
+ goto out;
+ }
+- if (statbuf.st_mtime == monitor->database_mtime)
++ if (statbuf.st_mtim.tv_sec == monitor->database_mtim.tv_sec &&
++ statbuf.st_mtim.tv_nsec == monitor->database_mtim.tv_nsec)
+ {
+ ret = TRUE;
+ goto out;
diff --git a/user/polkit-sd/fix-test-fgetpwent.patch b/user/polkit-sd/fix-test-fgetpwent.patch
new file mode 100644
index 000000000..7bc6481cc
--- /dev/null
+++ b/user/polkit-sd/fix-test-fgetpwent.patch
@@ -0,0 +1,20 @@
+--- polkit-0.105/test/mocklibc/src/pwd.c.old 2012-04-24 11:05:34.000000000 -0500
++++ polkit-0.105/test/mocklibc/src/pwd.c 2017-09-27 19:40:57.883227673 -0500
+@@ -16,6 +16,7 @@
+ * Author: Nikki VonHollen <vonhollen@gmail.com>
+ */
+
++#define _GNU_SOURCE
+ #include <pwd.h>
+
+ #include <stdio.h>
+--- polkit-0.105/test/mocklibc/src/grp.c.old 2012-04-24 11:05:34.000000000 -0500
++++ polkit-0.105/test/mocklibc/src/grp.c 2017-09-27 19:44:57.759238450 -0500
+@@ -16,6 +16,7 @@
+ * Author: Nikki VonHollen <vonhollen@gmail.com>
+ */
+
++#define _GNU_SOURCE
+ #include <grp.h>
+
+ #include <stdio.h>
diff --git a/user/polkit-sd/polkit-sd.pre-install b/user/polkit-sd/polkit-sd.pre-install
new file mode 100644
index 000000000..816f89236
--- /dev/null
+++ b/user/polkit-sd/polkit-sd.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+useradd -r -s /sbin/nologin -d /usr/lib/polkit-1 -M -U polkitd 2>/dev/null
+
+exit 0
diff --git a/user/polkit-sd/polkit-sd.pre-upgrade b/user/polkit-sd/polkit-sd.pre-upgrade
new file mode 100644
index 000000000..816f89236
--- /dev/null
+++ b/user/polkit-sd/polkit-sd.pre-upgrade
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+useradd -r -s /sbin/nologin -d /usr/lib/polkit-1 -M -U polkitd 2>/dev/null
+
+exit 0