initial buildroot for linux 5.15
This commit is contained in:
@@ -0,0 +1,426 @@
|
||||
From 1b854ef4bb15032091a33fed587e5ba6f3e582eb Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 22 May 2019 13:18:55 -0700
|
||||
Subject: [PATCH] make netgroup support optional
|
||||
|
||||
On at least Linux/musl and Linux/uclibc, netgroup
|
||||
support is not available. PolKit fails to compile on these systems
|
||||
for that reason.
|
||||
|
||||
This change makes netgroup support conditional on the presence of the
|
||||
setnetgrent(3) function which is required for the support to work. If
|
||||
that function is not available on the system, an error will be returned
|
||||
to the administrator if unix-netgroup: is specified in configuration.
|
||||
|
||||
Fixes bug 50145.
|
||||
|
||||
Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Adam: Extend patch to work with duktape integration.]
|
||||
Signed-off-by: Adam Duskett <aduskett@gmail.com>
|
||||
[Thomas: add introspection.m4.]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
buildutil/introspection.m4 | 142 ++++++++++++++++++
|
||||
configure.ac | 2 +-
|
||||
src/polkit/polkitidentity.c | 16 ++
|
||||
src/polkit/polkitunixnetgroup.c | 3 +
|
||||
.../polkitbackendduktapeauthority.c | 2 +
|
||||
.../polkitbackendinteractiveauthority.c | 14 +-
|
||||
.../polkitbackendjsauthority.cpp | 3 +-
|
||||
test/polkit/polkitidentitytest.c | 9 +-
|
||||
test/polkit/polkitunixnetgrouptest.c | 3 +
|
||||
.../test-polkitbackendjsauthority.c | 2 +
|
||||
10 files changed, 187 insertions(+), 9 deletions(-)
|
||||
create mode 100644 buildutil/introspection.m4
|
||||
|
||||
diff --git a/buildutil/introspection.m4 b/buildutil/introspection.m4
|
||||
new file mode 100644
|
||||
index 0000000..b0ccd68
|
||||
--- /dev/null
|
||||
+++ b/buildutil/introspection.m4
|
||||
@@ -0,0 +1,142 @@
|
||||
+dnl -*- mode: autoconf -*-
|
||||
+dnl Copyright 2009 Johan Dahlin
|
||||
+dnl
|
||||
+dnl This file is free software; the author(s) gives unlimited
|
||||
+dnl permission to copy and/or distribute it, with or without
|
||||
+dnl modifications, as long as this notice is preserved.
|
||||
+dnl
|
||||
+
|
||||
+# serial 1
|
||||
+
|
||||
+dnl This is a copy of AS_AC_EXPAND
|
||||
+dnl
|
||||
+dnl (C) 2003, 2004, 2005 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
+dnl Copying and distribution of this file, with or without modification,
|
||||
+dnl are permitted in any medium without royalty provided the copyright
|
||||
+dnl notice and this notice are preserved.
|
||||
+m4_define([_GOBJECT_INTROSPECTION_AS_AC_EXPAND],
|
||||
+[
|
||||
+ EXP_VAR=[$1]
|
||||
+ FROM_VAR=[$2]
|
||||
+
|
||||
+ dnl first expand prefix and exec_prefix if necessary
|
||||
+ prefix_save=$prefix
|
||||
+ exec_prefix_save=$exec_prefix
|
||||
+
|
||||
+ dnl if no prefix given, then use /usr/local, the default prefix
|
||||
+ if test "x$prefix" = "xNONE"; then
|
||||
+ prefix="$ac_default_prefix"
|
||||
+ fi
|
||||
+ dnl if no exec_prefix given, then use prefix
|
||||
+ if test "x$exec_prefix" = "xNONE"; then
|
||||
+ exec_prefix=$prefix
|
||||
+ fi
|
||||
+
|
||||
+ full_var="$FROM_VAR"
|
||||
+ dnl loop until it doesn't change anymore
|
||||
+ while true; do
|
||||
+ new_full_var="`eval echo $full_var`"
|
||||
+ if test "x$new_full_var" = "x$full_var"; then break; fi
|
||||
+ full_var=$new_full_var
|
||||
+ done
|
||||
+
|
||||
+ dnl clean up
|
||||
+ full_var=$new_full_var
|
||||
+ AC_SUBST([$1], "$full_var")
|
||||
+
|
||||
+ dnl restore prefix and exec_prefix
|
||||
+ prefix=$prefix_save
|
||||
+ exec_prefix=$exec_prefix_save
|
||||
+])
|
||||
+
|
||||
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
|
||||
+[
|
||||
+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
|
||||
+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
|
||||
+ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
|
||||
+
|
||||
+ dnl enable/disable introspection
|
||||
+ m4_if([$2], [require],
|
||||
+ [dnl
|
||||
+ enable_introspection=yes
|
||||
+ ],[dnl
|
||||
+ AC_ARG_ENABLE(introspection,
|
||||
+ AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
|
||||
+ [Enable introspection for this build]),,
|
||||
+ [enable_introspection=auto])
|
||||
+ ])dnl
|
||||
+
|
||||
+ AC_MSG_CHECKING([for gobject-introspection])
|
||||
+
|
||||
+ dnl presence/version checking
|
||||
+ AS_CASE([$enable_introspection],
|
||||
+ [no], [dnl
|
||||
+ found_introspection="no (disabled, use --enable-introspection to enable)"
|
||||
+ ],dnl
|
||||
+ [yes],[dnl
|
||||
+ PKG_CHECK_EXISTS([gobject-introspection-1.0],,
|
||||
+ AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
|
||||
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
|
||||
+ found_introspection=yes,
|
||||
+ AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
|
||||
+ ],dnl
|
||||
+ [auto],[dnl
|
||||
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
|
||||
+ dnl Canonicalize enable_introspection
|
||||
+ enable_introspection=$found_introspection
|
||||
+ ],dnl
|
||||
+ [dnl
|
||||
+ AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
|
||||
+ ])dnl
|
||||
+
|
||||
+ AC_MSG_RESULT([$found_introspection])
|
||||
+
|
||||
+ dnl expand datadir/libdir so we can pass them to pkg-config
|
||||
+ dnl and get paths relative to our target directories
|
||||
+ _GOBJECT_INTROSPECTION_AS_AC_EXPAND(_GI_EXP_DATADIR, "$datadir")
|
||||
+ _GOBJECT_INTROSPECTION_AS_AC_EXPAND(_GI_EXP_LIBDIR, "$libdir")
|
||||
+
|
||||
+ INTROSPECTION_SCANNER=
|
||||
+ INTROSPECTION_COMPILER=
|
||||
+ INTROSPECTION_GENERATE=
|
||||
+ INTROSPECTION_GIRDIR=
|
||||
+ INTROSPECTION_TYPELIBDIR=
|
||||
+ if test "x$found_introspection" = "xyes"; then
|
||||
+ INTROSPECTION_SCANNER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
|
||||
+ INTROSPECTION_COMPILER=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
|
||||
+ INTROSPECTION_GENERATE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
|
||||
+ INTROSPECTION_GIRDIR=`$PKG_CONFIG --define-variable=datadir="${_GI_EXP_DATADIR}" --variable=girdir gobject-introspection-1.0`
|
||||
+ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --define-variable=libdir="${_GI_EXP_LIBDIR}" --variable=typelibdir gobject-introspection-1.0)"
|
||||
+ INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
|
||||
+ INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
|
||||
+ INTROSPECTION_MAKEFILE=$PKG_CONFIG_SYSROOT_DIR`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
|
||||
+ fi
|
||||
+ AC_SUBST(INTROSPECTION_SCANNER)
|
||||
+ AC_SUBST(INTROSPECTION_COMPILER)
|
||||
+ AC_SUBST(INTROSPECTION_GENERATE)
|
||||
+ AC_SUBST(INTROSPECTION_GIRDIR)
|
||||
+ AC_SUBST(INTROSPECTION_TYPELIBDIR)
|
||||
+ AC_SUBST(INTROSPECTION_CFLAGS)
|
||||
+ AC_SUBST(INTROSPECTION_LIBS)
|
||||
+ AC_SUBST(INTROSPECTION_MAKEFILE)
|
||||
+
|
||||
+ AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
|
||||
+])
|
||||
+
|
||||
+
|
||||
+dnl Usage:
|
||||
+dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
|
||||
+
|
||||
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
|
||||
+[
|
||||
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
|
||||
+])
|
||||
+
|
||||
+dnl Usage:
|
||||
+dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
|
||||
+
|
||||
+
|
||||
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
|
||||
+[
|
||||
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
|
||||
+])
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 5cedb4e..87aa0ad 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -111,7 +111,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
|
||||
[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
|
||||
AC_SUBST(EXPAT_LIBS)
|
||||
|
||||
-AC_CHECK_FUNCS(clearenv fdatasync)
|
||||
+AC_CHECK_FUNCS(clearenv fdatasync setnetgrent)
|
||||
|
||||
if test "x$GCC" = "xyes"; then
|
||||
LDFLAGS="-Wl,--as-needed $LDFLAGS"
|
||||
diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c
|
||||
index 3aa1f7f..10e9c17 100644
|
||||
--- a/src/polkit/polkitidentity.c
|
||||
+++ b/src/polkit/polkitidentity.c
|
||||
@@ -182,7 +182,15 @@ polkit_identity_from_string (const gchar *str,
|
||||
}
|
||||
else if (g_str_has_prefix (str, "unix-netgroup:"))
|
||||
{
|
||||
+#ifndef HAVE_SETNETGRENT
|
||||
+ g_set_error (error,
|
||||
+ POLKIT_ERROR,
|
||||
+ POLKIT_ERROR_FAILED,
|
||||
+ "Netgroups are not available on this machine ('%s')",
|
||||
+ str);
|
||||
+#else
|
||||
identity = polkit_unix_netgroup_new (str + sizeof "unix-netgroup:" - 1);
|
||||
+#endif
|
||||
}
|
||||
|
||||
if (identity == NULL && (error != NULL && *error == NULL))
|
||||
@@ -344,6 +352,13 @@ polkit_identity_new_for_gvariant (GVariant *variant,
|
||||
GVariant *v;
|
||||
const char *name;
|
||||
|
||||
+#ifndef HAVE_SETNETGRENT
|
||||
+ g_set_error (error,
|
||||
+ POLKIT_ERROR,
|
||||
+ POLKIT_ERROR_FAILED,
|
||||
+ "Netgroups are not available on this machine");
|
||||
+ goto out;
|
||||
+#else
|
||||
v = lookup_asv (details_gvariant, "name", G_VARIANT_TYPE_STRING, error);
|
||||
if (v == NULL)
|
||||
{
|
||||
@@ -353,6 +368,7 @@ polkit_identity_new_for_gvariant (GVariant *variant,
|
||||
name = g_variant_get_string (v, NULL);
|
||||
ret = polkit_unix_netgroup_new (name);
|
||||
g_variant_unref (v);
|
||||
+#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/src/polkit/polkitunixnetgroup.c b/src/polkit/polkitunixnetgroup.c
|
||||
index 8a2b369..83f8d4a 100644
|
||||
--- a/src/polkit/polkitunixnetgroup.c
|
||||
+++ b/src/polkit/polkitunixnetgroup.c
|
||||
@@ -194,6 +194,9 @@ polkit_unix_netgroup_set_name (PolkitUnixNetgroup *group,
|
||||
PolkitIdentity *
|
||||
polkit_unix_netgroup_new (const gchar *name)
|
||||
{
|
||||
+#ifndef HAVE_SETNETGRENT
|
||||
+ g_assert_not_reached();
|
||||
+#endif
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
return POLKIT_IDENTITY (g_object_new (POLKIT_TYPE_UNIX_NETGROUP,
|
||||
"name", name,
|
||||
diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
|
||||
index 4b4f8fd..e19b009 100644
|
||||
--- a/src/polkitbackend/polkitbackendduktapeauthority.c
|
||||
+++ b/src/polkitbackend/polkitbackendduktapeauthority.c
|
||||
@@ -1036,6 +1036,7 @@ js_polkit_user_is_in_netgroup (duk_context *cx)
|
||||
const char *netgroup;
|
||||
gboolean is_in_netgroup = FALSE;
|
||||
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
user = duk_require_string (cx, 0);
|
||||
netgroup = duk_require_string (cx, 1);
|
||||
|
||||
@@ -1046,6 +1047,7 @@ js_polkit_user_is_in_netgroup (duk_context *cx)
|
||||
{
|
||||
is_in_netgroup = TRUE;
|
||||
}
|
||||
+#endif
|
||||
|
||||
duk_push_boolean (cx, is_in_netgroup);
|
||||
return 1;
|
||||
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
|
||||
index 056d9a8..36c2f3d 100644
|
||||
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
|
||||
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
|
||||
@@ -2233,25 +2233,26 @@ get_users_in_net_group (PolkitIdentity *group,
|
||||
GList *ret;
|
||||
|
||||
ret = NULL;
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group));
|
||||
|
||||
-#ifdef HAVE_SETNETGRENT_RETURN
|
||||
+# ifdef HAVE_SETNETGRENT_RETURN
|
||||
if (setnetgrent (name) == 0)
|
||||
{
|
||||
g_warning ("Error looking up net group with name %s: %s", name, g_strerror (errno));
|
||||
goto out;
|
||||
}
|
||||
-#else
|
||||
+# else
|
||||
setnetgrent (name);
|
||||
-#endif
|
||||
+# endif /* HAVE_SETNETGRENT_RETURN */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
-#if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
|
||||
+# if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
|
||||
const char *hostname, *username, *domainname;
|
||||
-#else
|
||||
+# else
|
||||
char *hostname, *username, *domainname;
|
||||
-#endif
|
||||
+# endif /* defined(HAVE_NETBSD) || defined(HAVE_OPENBSD) */
|
||||
PolkitIdentity *user;
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -2282,6 +2283,7 @@ get_users_in_net_group (PolkitIdentity *group,
|
||||
|
||||
out:
|
||||
endnetgrent ();
|
||||
+#endif /* HAVE_SETNETGRENT */
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
|
||||
index 9b752d1..09b2878 100644
|
||||
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
|
||||
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
|
||||
@@ -1520,6 +1520,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
|
||||
|
||||
JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
|
||||
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
JS::RootedString usrstr (authority->priv->cx);
|
||||
usrstr = args[0].toString();
|
||||
user = JS_EncodeStringToUTF8 (cx, usrstr);
|
||||
@@ -1534,7 +1535,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
|
||||
{
|
||||
is_in_netgroup = true;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
ret = true;
|
||||
|
||||
args.rval ().setBoolean (is_in_netgroup);
|
||||
diff --git a/test/polkit/polkitidentitytest.c b/test/polkit/polkitidentitytest.c
|
||||
index e91967b..e829aaa 100644
|
||||
--- a/test/polkit/polkitidentitytest.c
|
||||
+++ b/test/polkit/polkitidentitytest.c
|
||||
@@ -19,6 +19,7 @@
|
||||
* Author: Nikki VonHollen <vonhollen@google.com>
|
||||
*/
|
||||
|
||||
+#include "config.h"
|
||||
#include "glib.h"
|
||||
#include <polkit/polkit.h>
|
||||
#include <polkit/polkitprivate.h>
|
||||
@@ -145,11 +146,15 @@ struct ComparisonTestData comparison_test_data [] = {
|
||||
{"unix-group:root", "unix-group:jane", FALSE},
|
||||
{"unix-group:jane", "unix-group:jane", TRUE},
|
||||
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
{"unix-netgroup:foo", "unix-netgroup:foo", TRUE},
|
||||
{"unix-netgroup:foo", "unix-netgroup:bar", FALSE},
|
||||
+#endif
|
||||
|
||||
{"unix-user:root", "unix-group:root", FALSE},
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
{"unix-user:jane", "unix-netgroup:foo", FALSE},
|
||||
+#endif
|
||||
|
||||
{NULL},
|
||||
};
|
||||
@@ -181,11 +186,13 @@ main (int argc, char *argv[])
|
||||
g_test_add_data_func ("/PolkitIdentity/group_string_2", "unix-group:jane", test_string);
|
||||
g_test_add_data_func ("/PolkitIdentity/group_string_3", "unix-group:users", test_string);
|
||||
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
g_test_add_data_func ("/PolkitIdentity/netgroup_string", "unix-netgroup:foo", test_string);
|
||||
+ g_test_add_data_func ("/PolkitIdentity/netgroup_gvariant", "unix-netgroup:foo", test_gvariant);
|
||||
+#endif
|
||||
|
||||
g_test_add_data_func ("/PolkitIdentity/user_gvariant", "unix-user:root", test_gvariant);
|
||||
g_test_add_data_func ("/PolkitIdentity/group_gvariant", "unix-group:root", test_gvariant);
|
||||
- g_test_add_data_func ("/PolkitIdentity/netgroup_gvariant", "unix-netgroup:foo", test_gvariant);
|
||||
|
||||
add_comparison_tests ();
|
||||
|
||||
diff --git a/test/polkit/polkitunixnetgrouptest.c b/test/polkit/polkitunixnetgrouptest.c
|
||||
index 3701ba1..e3352eb 100644
|
||||
--- a/test/polkit/polkitunixnetgrouptest.c
|
||||
+++ b/test/polkit/polkitunixnetgrouptest.c
|
||||
@@ -19,6 +19,7 @@
|
||||
* Author: Nikki VonHollen <vonhollen@google.com>
|
||||
*/
|
||||
|
||||
+#include "config.h"
|
||||
#include "glib.h"
|
||||
#include <polkit/polkit.h>
|
||||
#include <string.h>
|
||||
@@ -69,7 +70,9 @@ int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
g_test_add_func ("/PolkitUnixNetgroup/new", test_new);
|
||||
g_test_add_func ("/PolkitUnixNetgroup/set_name", test_set_name);
|
||||
+#endif
|
||||
return g_test_run ();
|
||||
}
|
||||
diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c
|
||||
index 71aad23..fdd28f3 100644
|
||||
--- a/test/polkitbackend/test-polkitbackendjsauthority.c
|
||||
+++ b/test/polkitbackend/test-polkitbackendjsauthority.c
|
||||
@@ -137,12 +137,14 @@ test_get_admin_identities (void)
|
||||
"unix-group:users"
|
||||
}
|
||||
},
|
||||
+#ifdef HAVE_SETNETGRENT
|
||||
{
|
||||
"net.company.action3",
|
||||
{
|
||||
"unix-netgroup:foo"
|
||||
}
|
||||
},
|
||||
+#endif
|
||||
};
|
||||
guint n;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
From 6c8022392713955c5ae0061e22b50a16a1c2252a Mon Sep 17 00:00:00 2001
|
||||
From: Simon McVittie <smcv@collabora.com>
|
||||
Date: Thu, 15 Jul 2021 12:36:05 +0000
|
||||
Subject: [PATCH] Improve meson_post_install script
|
||||
|
||||
[Retrieved from:
|
||||
https://gitlab.freedesktop.org/polkit/polkit/-/commit/6c8022392713955c5ae0061e22b50a16a1c2252a]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
.gitlab-ci.yml | 3 +--
|
||||
meson_post_install.py | 58 +++++++++++++++++++++++++++++++++++--------
|
||||
2 files changed, 49 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
|
||||
index 8ac3e9f..6d0abb4 100644
|
||||
--- a/.gitlab-ci.yml
|
||||
+++ b/.gitlab-ci.yml
|
||||
@@ -26,8 +26,6 @@ build_stable:
|
||||
before_script:
|
||||
- dnf upgrade -y --nogpgcheck fedora-release fedora-repos*
|
||||
- dnf update -y && dnf install -y $DEPENDENCIES
|
||||
- - getent group polkitd >/dev/null || groupadd -r polkitd
|
||||
- - getent passwd polkitd >/dev/null || useradd -r -g polkitd -d / -s /sbin/nologin -c "User for polkitd" polkitd
|
||||
|
||||
script:
|
||||
- meson setup
|
||||
@@ -43,6 +41,7 @@ build_stable:
|
||||
- meson compile -C builddir
|
||||
- meson test -C builddir
|
||||
- meson install -C builddir
|
||||
+ - DESTDIR=$(pwd)/DESTDIR meson install -C builddir
|
||||
artifacts:
|
||||
name: 'test logs'
|
||||
when: 'always'
|
||||
diff --git a/meson_post_install.py b/meson_post_install.py
|
||||
index 0a0fccf..0ab7469 100644
|
||||
--- a/meson_post_install.py
|
||||
+++ b/meson_post_install.py
|
||||
@@ -1,20 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
-import getpass
|
||||
import os
|
||||
import pwd
|
||||
import sys
|
||||
|
||||
+destdir = os.environ.get('DESTDIR')
|
||||
prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
|
||||
|
||||
-bindir = os.path.join(prefix, sys.argv[1])
|
||||
-pkgdatadir = os.path.join(prefix, sys.argv[2])
|
||||
-pkglibdir = os.path.join(prefix, sys.argv[3])
|
||||
-pkgsysconfdir = os.path.join(prefix, sys.argv[4])
|
||||
+def destdir_path(p):
|
||||
+ if os.path.isabs(p):
|
||||
+ if destdir is None:
|
||||
+ return p
|
||||
+ else:
|
||||
+ return os.path.join(destdir, os.path.relpath(p, '/'))
|
||||
+ else:
|
||||
+ return os.path.join(prefix, p)
|
||||
|
||||
-polkitd_uid = pwd.getpwnam(sys.argv[5]).pw_uid
|
||||
+bindir = destdir_path(sys.argv[1])
|
||||
+pkgdatadir = destdir_path(sys.argv[2])
|
||||
+pkglibdir = destdir_path(sys.argv[3])
|
||||
+pkgsysconfdir = destdir_path(sys.argv[4])
|
||||
+polkitd_user = sys.argv[5]
|
||||
|
||||
-os.chmod(os.path.join(bindir, 'pkexec'), 0o4775)
|
||||
+try:
|
||||
+ polkitd_uid = pwd.getpwnam(polkitd_user).pw_uid
|
||||
+except KeyError:
|
||||
+ polkitd_uid = None
|
||||
+
|
||||
+dst = os.path.join(bindir, 'pkexec')
|
||||
+
|
||||
+if os.geteuid() == 0:
|
||||
+ os.chmod(dst, 0o4755)
|
||||
+ os.chown(dst, 0, -1)
|
||||
+else:
|
||||
+ print(
|
||||
+ 'Owner and mode of {} need to be setuid root (04755) after '
|
||||
+ 'installation'.format(
|
||||
+ dst,
|
||||
+ )
|
||||
+ )
|
||||
|
||||
dst_dirs = [
|
||||
os.path.join(pkgsysconfdir, 'rules.d'),
|
||||
@@ -24,13 +48,27 @@ dst_dirs = [
|
||||
for dst in dst_dirs:
|
||||
if not os.path.exists(dst):
|
||||
os.makedirs(dst, mode=0o700)
|
||||
- if getpass.getuser() == "root":
|
||||
+ if os.geteuid() == 0 and polkitd_uid is not None:
|
||||
os.chown(dst, polkitd_uid, -1)
|
||||
+ else:
|
||||
+ print(
|
||||
+ 'Owner of {} needs to be set to {} after installation'.format(
|
||||
+ dst, polkitd_user,
|
||||
+ )
|
||||
+ )
|
||||
|
||||
# polkit-agent-helper-1 need to be setuid root because it's used to
|
||||
# authenticate not only the invoking user, but possibly also root
|
||||
# and/or other users.
|
||||
dst = os.path.join(pkglibdir, 'polkit-agent-helper-1')
|
||||
-os.chmod(dst, 0o4755)
|
||||
-if getpass.getuser() == "root":
|
||||
+
|
||||
+if os.geteuid() == 0:
|
||||
+ os.chmod(dst, 0o4755)
|
||||
os.chown(dst, 0, -1)
|
||||
+else:
|
||||
+ print(
|
||||
+ 'Owner and mode of {} need to be setuid root (04755) after '
|
||||
+ 'installation'.format(
|
||||
+ dst,
|
||||
+ )
|
||||
+ )
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 9fa097f4dde92a0c1675400228b4cb965ed3e123 Mon Sep 17 00:00:00 2001
|
||||
From: Simon McVittie <smcv@debian.org>
|
||||
Date: Thu, 3 Jun 2021 18:55:29 +0100
|
||||
Subject: [PATCH] build: Remove redundant computation of dbus data directory
|
||||
|
||||
We were asking pkg-config "if I define ${datadir} to pk_prefix/pk_datadir,
|
||||
what would ${datadir} be?" but the answer is obviously always going to be
|
||||
pk_prefix/pk_datadir.
|
||||
|
||||
Signed-off-by: Simon McVittie <smcv@debian.org>
|
||||
|
||||
[Retrieved (and slightly updated for duktape fork) from:
|
||||
https://gitlab.freedesktop.org/polkit/polkit/-/commit/9fa097f4dde92a0c1675400228b4cb965ed3e123]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
meson.build | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 6a6799e..03a7683 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -136,8 +136,7 @@ assert(cc.has_function('XML_ParserCreate', dependencies: expat_dep), 'Can\'t fin
|
||||
endif
|
||||
|
||||
dbus_dep = dependency('dbus-1')
|
||||
-dbus_confdir = dbus_dep.get_pkgconfig_variable('datadir', define_variable: ['datadir', pk_prefix / pk_datadir]) #changed from sysconfdir with respect to commit#8eada3836465838
|
||||
-dbus_policydir = dbus_confdir / 'dbus-1/system.d'
|
||||
+dbus_policydir = pk_prefix / pk_datadir / 'dbus-1/system.d'
|
||||
dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', pk_prefix / pk_datadir])
|
||||
|
||||
# check OS
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 4bb2157adae620c8b07caf5a24b177d1f90f2fbb Mon Sep 17 00:00:00 2001
|
||||
From: Simon McVittie <smcv@debian.org>
|
||||
Date: Thu, 3 Jun 2021 18:57:00 +0100
|
||||
Subject: [PATCH] build: Don't require dbus development files
|
||||
|
||||
We don't actually need libdbus, only the dbus-daemon's installation
|
||||
directory for system services, which in practice is always going to be
|
||||
/usr/share/dbus-1/system-services.
|
||||
|
||||
Signed-off-by: Simon McVittie <smcv@debian.org>
|
||||
|
||||
[Retrieved (and slightly updated for duktape fork) from:
|
||||
https://gitlab.freedesktop.org/polkit/polkit/-/commit/4bb2157adae620c8b07caf5a24b177d1f90f2fbb]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
meson.build | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 03a7683..539ec7a 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -135,9 +135,14 @@ assert(cc.has_function('XML_ParserCreate', dependencies: expat_dep), 'Can\'t fin
|
||||
js_dep = dependency('mozjs-78')
|
||||
endif
|
||||
|
||||
-dbus_dep = dependency('dbus-1')
|
||||
+dbus_dep = dependency('dbus-1', required: false)
|
||||
dbus_policydir = pk_prefix / pk_datadir / 'dbus-1/system.d'
|
||||
-dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', pk_prefix / pk_datadir])
|
||||
+if dbus_dep.found()
|
||||
+ dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', pk_prefix / pk_datadir])
|
||||
+else
|
||||
+ # libdbus development files not installed, assume a standard layout
|
||||
+ dbus_system_bus_services_dir = pk_prefix / pk_datadir / 'dbus-1' / 'system-services'
|
||||
+endif
|
||||
|
||||
# check OS
|
||||
host_system = host_machine.system()
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
config BR2_PACKAGE_POLKIT
|
||||
bool "polkit"
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # C++17
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2, dbus
|
||||
depends on BR2_USE_MMU # libglib2, dbus
|
||||
depends on BR2_USE_WCHAR # libglib2
|
||||
depends on !BR2_STATIC_LIBS # duktape
|
||||
select BR2_PACKAGE_DBUS # runtime
|
||||
select BR2_PACKAGE_DUKTAPE
|
||||
select BR2_PACKAGE_EXPAT
|
||||
select BR2_PACKAGE_LIBGLIB2
|
||||
help
|
||||
PolicyKit is a toolkit for defining and handling
|
||||
authorizations. It is used for allowing unprivileged
|
||||
processes to speak to privileged processes.
|
||||
|
||||
http://www.freedesktop.org/wiki/Software/polkit
|
||||
|
||||
comment "polkit needs a toolchain with dynamic library, wchar, threads, gcc >= 7"
|
||||
depends on BR2_USE_MMU
|
||||
depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \
|
||||
BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
|
||||
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="polkitd"
|
||||
DAEMON_PATH="/usr/lib/polkit-1/${DAEMON}"
|
||||
PIDFILE="/var/run/${DAEMON}.pid"
|
||||
POLKITD_ARGS="--no-debug"
|
||||
|
||||
# polkitd does not create a pidfile, so pass "-n" in the command line
|
||||
# and use "-m" to instruct start-stop-daemon to create one.
|
||||
start() {
|
||||
printf 'Starting %s: ' "${DAEMON}"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${POLKITD_ARGS}
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "${DAEMON}"
|
||||
start-stop-daemon -Kqp "$PIDFILE"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
rm -f "$PIDFILE"
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart|reload)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
@@ -0,0 +1,5 @@
|
||||
# Locally calculated after checking pgp signature
|
||||
sha256 88d078f1d1f653fd31fe42e46cc3d9b7dd468e70684075e32fe1766dc7ece517 polkit-0.119.tar.gz
|
||||
|
||||
# Locally calculated
|
||||
sha256 d2e2aa973e29c75e1b492e67ea7b7da9de2d501d49a934657971fd74f9a0b0a8 COPYING
|
||||
@@ -0,0 +1,70 @@
|
||||
################################################################################
|
||||
#
|
||||
# polkit
|
||||
#
|
||||
################################################################################
|
||||
|
||||
POLKIT_VERSION = 0.119
|
||||
POLKIT_SITE = $(call github,aduskett,polkit-duktape,v$(POLKIT_VERSION))
|
||||
POLKIT_LICENSE = GPL-2.0
|
||||
POLKIT_LICENSE_FILES = COPYING
|
||||
POLKIT_CPE_ID_VENDOR = polkit_project
|
||||
POLKIT_INSTALL_STAGING = YES
|
||||
|
||||
POLKIT_DEPENDENCIES = \
|
||||
duktape libglib2 host-intltool expat $(TARGET_NLS_DEPENDENCIES)
|
||||
|
||||
POLKIT_LDFLAGS = $(TARGET_NLS_LIBS)
|
||||
|
||||
POLKIT_CONF_OPTS = \
|
||||
-Dman=false \
|
||||
-Dexamples=false \
|
||||
-Dsession_tracking=ConsoleKit \
|
||||
-Djs_engine=duktape
|
||||
|
||||
ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
|
||||
POLKIT_CONF_OPTS += -Dintrospection=true
|
||||
POLKIT_DEPENDENCIES += gobject-introspection
|
||||
else
|
||||
POLKIT_CONF_OPTS += -Dintrospection=false
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
|
||||
POLKIT_DEPENDENCIES += linux-pam
|
||||
POLKIT_CONF_OPTS += -Dauthfw=pam
|
||||
else
|
||||
POLKIT_CONF_OPTS += -Dauthfw=shadow
|
||||
endif
|
||||
|
||||
# polkit.{its,loc} are needed for gvfs and must be installed in $(HOST_DIR)
|
||||
# and not $(STAGING_DIR)
|
||||
define POLKIT_INSTALL_ITS
|
||||
$(INSTALL) -D -m 644 $(@D)/data/polkit.its \
|
||||
$(HOST_DIR)/share/gettext/its/polkit.its
|
||||
$(INSTALL) -D -m 644 $(@D)/data/polkit.loc \
|
||||
$(HOST_DIR)/share/gettext/its/polkit.loc
|
||||
endef
|
||||
POLKIT_POST_INSTALL_TARGET_HOOKS += POLKIT_INSTALL_ITS
|
||||
|
||||
define POLKIT_USERS
|
||||
polkitd -1 polkitd -1 * - - - Polkit Daemon
|
||||
endef
|
||||
|
||||
define POLKIT_PERMISSIONS
|
||||
/etc/polkit-1 r 750 root polkitd - - - - -
|
||||
/usr/share/polkit-1 r 750 root polkitd - - - - -
|
||||
/usr/bin/pkexec f 4755 root root - - - - -
|
||||
endef
|
||||
|
||||
define POLKIT_INSTALL_INIT_SYSTEMD
|
||||
$(INSTALL) -D -m 644 $(POLKIT_PKGDIR)/polkit.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/polkit.service
|
||||
|
||||
endef
|
||||
|
||||
define POLKIT_INSTALL_INIT_SYSV
|
||||
$(INSTALL) -D -m 0755 package/polkit/S50polkit \
|
||||
$(TARGET_DIR)/etc/init.d/S50polkit
|
||||
endef
|
||||
|
||||
$(eval $(meson-package))
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
|
||||
Description=Authorization Manager
|
||||
Documentation=man:polkit(8)
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
BusName=org.freedesktop.PolicyKit1
|
||||
ExecStart=/usr/lib/polkit-1/polkitd --no-debug
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user