aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRasmus Thomsen <oss@cogitri.dev>2019-05-19 13:09:00 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2019-05-27 20:41:23 +0100
commit391e7de6ced1a96c2dac812e0b12f1d7e0ea705e (patch)
tree4424f12c0f4a83e7e4b37e612874a3401fb84d1b
parent9bc9928814f96a4de01d942cf29091282a41e700 (diff)
downloadaports-391e7de6ced1a96c2dac812e0b12f1d7e0ea705e.tar.bz2
aports-391e7de6ced1a96c2dac812e0b12f1d7e0ea705e.tar.xz
main/polkit: upgrade to 0.116
-rw-r--r--main/polkit/APKBUILD30
-rw-r--r--main/polkit/CVE-2018-19788.patch150
-rw-r--r--main/polkit/alpine-pam.patch18
-rw-r--r--main/polkit/alpine-polkit.pam7
-rw-r--r--main/polkit/make-innetgr-optional.patch236
-rw-r--r--main/polkit/mozjs60-1.patch28
-rw-r--r--main/polkit/mozjs60-2.patch158
7 files changed, 230 insertions, 397 deletions
diff --git a/main/polkit/APKBUILD b/main/polkit/APKBUILD
index 468ed6db71..ddb15f9f0c 100644
--- a/main/polkit/APKBUILD
+++ b/main/polkit/APKBUILD
@@ -2,30 +2,24 @@
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=polkit
-pkgver=0.115
-pkgrel=2
+pkgver=0.116
+pkgrel=0
pkgdesc="Application development toolkit for controlling system-wide privileges"
url="https://www.freedesktop.org/wiki/Software/polkit/"
arch="all"
license="GPL-2.0-or-later"
-options="suid !check"
+options="suid !check" # Needs a functioning dbus daemon
depends_dev="dbus-glib-dev"
makedepends="$depends_dev expat-dev glib-dev gtk-doc gobject-introspection-dev
intltool autoconf automake libtool bash mozjs60-dev linux-pam-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="https://www.freedesktop.org/software/polkit/releases/polkit-$pkgver.tar.gz
- CVE-2018-19788.patch
make-innetgr-optional.patch
- mozjs60-1.patch
- mozjs60-2.patch
- alpine-pam.patch
-"
+ alpine-polkit.pam"
install="polkit.pre-install polkit.pre-upgrade"
pkgusers="polkitd"
pkggroups="polkitd"
-builddir="$srcdir/$pkgname-$pkgver"
-
prepare() {
cd "$builddir"
default_prepare
@@ -67,14 +61,16 @@ package() {
# Set SHELL as a workaround for #10081
make SHELL=/bin/bash DESTDIR="$pkgdir" install
- # Required to run the polkitd daemon as non-root
+ # Use our own polkit rules, upstream may change them
+ install -m644 "$srcdir"/alpine-polkit.pam "$pkgdir"/etc/pam.d/polkit-1
+
+ # See polkit's configure script which tells us what permissions to set
chown -R polkitd:polkitd "$pkgdir"/etc/polkit-1/rules.d "$pkgdir"/usr/share/polkit-1/rules.d
chmod -R 700 "$pkgdir"/etc/polkit-1/rules.d "$pkgdir"/usr/share/polkit-1/rules.d
+ chmod 4755 "$pkgdir"/usr/lib/polkit-1/polkit-agent-helper-1
+ chmod 4755 "$pkgdir"/usr/bin/pkexec
}
-sha512sums="1153011fa93145b2c184e6b3446d3ca21b38918641aeccd8fac3985ac3e30ec6bc75be6973985fde90f2a24236592f1595be259155061c2d33358dd17c4ee4fc polkit-0.115.tar.gz
-5b951d7532b0ad51214cf63814cb863fe83ebc57722245cef3f5f003bba368ffd18fab03b9f23bbef8ed30972ad32f074d25491c3fe338389e02e279b4ced62c CVE-2018-19788.patch
-1e679eda2cacb25ad0d7409ab7c5811697519e46d3873a86a9ff2d8d3d3664e63c925ab13e5faf643031ea27e8e35730556121c96e06acd28c5f690848a8ce00 make-innetgr-optional.patch
-8d71494ddfc3f8d24b6c7dbab2b0440d9ab9df49d9e095c90f3802054bf858f4c81c644d1ab64872a6ea61ae70c58a181e47123a4c50bd8a339b27a23bfffaaa mozjs60-1.patch
-d7dc9fc3189a0897e8f484f7dfcee3722f75694401f7a01cac3eb1f0f6cb639081136e86e4bf467c908f77c847d4ddf310817c722fd21a73662ca6b908ce8d53 mozjs60-2.patch
-077a3e10ada918e6f9879ce50bba9145229bd92d3f13d4c6454147eb051086afbcf8d0a683a5ebe583ba00f956db011aa1afd3d9e99d7693e288737191468b8f alpine-pam.patch"
+sha512sums="b66b01cc2bb4349de70147f41f161f0f6f41e7230b581dfb054058b48969ec57041ab05b51787c749ccfc36aa5f317952d7e7ba337b4f6f6c0a923ed5866c2d5 polkit-0.116.tar.gz
+05a4fa21a42237a68d40f581d70a84937ba94f703e5342f37a59cca171ed5446acf7ae83fd5b05a3a92600ad38ad74d0c735a20f1b932750f91c0988ba900f60 make-innetgr-optional.patch
+f5102dc00d390b3a3c957b62e1712db778c7ffb7378f3d8e816c0757c11a308c5d5303e42595b0d6add9839247c773880cd34e56afacc89eb6efaadf9aae7826 alpine-polkit.pam"
diff --git a/main/polkit/CVE-2018-19788.patch b/main/polkit/CVE-2018-19788.patch
deleted file mode 100644
index c48df46fa3..0000000000
--- a/main/polkit/CVE-2018-19788.patch
+++ /dev/null
@@ -1,150 +0,0 @@
---- a/src/polkit/polkitunixgroup.c
-+++ b/src/polkit/polkitunixgroup.c
-@@ -71,6 +71,7 @@ G_DEFINE_TYPE_WITH_CODE (PolkitUnixGroup, polkit_unix_group, G_TYPE_OBJECT,
- static void
- polkit_unix_group_init (PolkitUnixGroup *unix_group)
- {
-+ unix_group->gid = -1; /* (git_t) -1 is not a valid GID under Linux */
- }
-
- static void
-@@ -100,11 +101,14 @@ polkit_unix_group_set_property (GObject *object,
- GParamSpec *pspec)
- {
- PolkitUnixGroup *unix_group = POLKIT_UNIX_GROUP (object);
-+ gint val;
-
- switch (prop_id)
- {
- case PROP_GID:
-- unix_group->gid = g_value_get_int (value);
-+ val = g_value_get_int (value);
-+ g_return_if_fail (val != -1);
-+ unix_group->gid = val;
- break;
-
- default:
-@@ -131,9 +135,9 @@ polkit_unix_group_class_init (PolkitUnixGroupClass *klass)
- g_param_spec_int ("gid",
- "Group ID",
- "The UNIX group ID",
-- 0,
-+ G_MININT,
- G_MAXINT,
-- 0,
-+ -1,
- G_PARAM_CONSTRUCT |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
-@@ -166,9 +170,10 @@ polkit_unix_group_get_gid (PolkitUnixGroup *group)
- */
- void
- polkit_unix_group_set_gid (PolkitUnixGroup *group,
-- gint gid)
-+ gint gid)
- {
- g_return_if_fail (POLKIT_IS_UNIX_GROUP (group));
-+ g_return_if_fail (gid != -1);
- group->gid = gid;
- }
-
-@@ -183,6 +188,8 @@ polkit_unix_group_set_gid (PolkitUnixGroup *group,
- PolkitIdentity *
- polkit_unix_group_new (gint gid)
- {
-+ g_return_val_if_fail (gid != -1, NULL);
-+
- return POLKIT_IDENTITY (g_object_new (POLKIT_TYPE_UNIX_GROUP,
- "gid", gid,
- NULL));
---- a/src/polkit/polkitunixprocess.c
-+++ b/src/polkit/polkitunixprocess.c
-@@ -159,9 +159,14 @@ polkit_unix_process_set_property (GObject *object,
- polkit_unix_process_set_pid (unix_process, g_value_get_int (value));
- break;
-
-- case PROP_UID:
-- polkit_unix_process_set_uid (unix_process, g_value_get_int (value));
-+ case PROP_UID: {
-+ gint val;
-+
-+ val = g_value_get_int (value);
-+ g_return_if_fail (val != -1);
-+ polkit_unix_process_set_uid (unix_process, val);
- break;
-+ }
-
- case PROP_START_TIME:
- polkit_unix_process_set_start_time (unix_process, g_value_get_uint64 (value));
-@@ -239,7 +244,7 @@ polkit_unix_process_class_init (PolkitUnixProcessClass *klass)
- g_param_spec_int ("uid",
- "User ID",
- "The UNIX user ID",
-- -1,
-+ G_MININT,
- G_MAXINT,
- -1,
- G_PARAM_CONSTRUCT |
-@@ -303,7 +308,6 @@ polkit_unix_process_set_uid (PolkitUnixProcess *process,
- gint uid)
- {
- g_return_if_fail (POLKIT_IS_UNIX_PROCESS (process));
-- g_return_if_fail (uid >= -1);
- process->uid = uid;
- }
-
---- a/src/polkit/polkitunixuser.c
-+++ b/src/polkit/polkitunixuser.c
-@@ -72,6 +72,7 @@ G_DEFINE_TYPE_WITH_CODE (PolkitUnixUser, polkit_unix_user, G_TYPE_OBJECT,
- static void
- polkit_unix_user_init (PolkitUnixUser *unix_user)
- {
-+ unix_user->uid = -1; /* (uid_t) -1 is not a valid UID under Linux */
- unix_user->name = NULL;
- }
-
-@@ -112,11 +113,14 @@ polkit_unix_user_set_property (GObject *object,
- GParamSpec *pspec)
- {
- PolkitUnixUser *unix_user = POLKIT_UNIX_USER (object);
-+ gint val;
-
- switch (prop_id)
- {
- case PROP_UID:
-- unix_user->uid = g_value_get_int (value);
-+ val = g_value_get_int (value);
-+ g_return_if_fail (val != -1);
-+ unix_user->uid = val;
- break;
-
- default:
-@@ -144,9 +148,9 @@ polkit_unix_user_class_init (PolkitUnixUserClass *klass)
- g_param_spec_int ("uid",
- "User ID",
- "The UNIX user ID",
-- 0,
-+ G_MININT,
- G_MAXINT,
-- 0,
-+ -1,
- G_PARAM_CONSTRUCT |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_NAME |
-@@ -182,6 +186,7 @@ polkit_unix_user_set_uid (PolkitUnixUser *user,
- gint uid)
- {
- g_return_if_fail (POLKIT_IS_UNIX_USER (user));
-+ g_return_if_fail (uid != -1);
- user->uid = uid;
- }
-
-@@ -196,6 +201,8 @@ polkit_unix_user_set_uid (PolkitUnixUser *user,
- PolkitIdentity *
- polkit_unix_user_new (gint uid)
- {
-+ g_return_val_if_fail (uid != -1, NULL);
-+
- return POLKIT_IDENTITY (g_object_new (POLKIT_TYPE_UNIX_USER,
- "uid", uid,
- NULL));
diff --git a/main/polkit/alpine-pam.patch b/main/polkit/alpine-pam.patch
deleted file mode 100644
index 662e7c4d99..0000000000
--- a/main/polkit/alpine-pam.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Point /etc/pam.d/polkit-1 to the right PAM files.
-
-diff --git configure.ac configure.ac
-index 36df239..53b5573 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -470,6 +470,11 @@ elif test x$with_os_type = xfreebsd -o x$with_os_type = xnetbsd; then
- PAM_FILE_INCLUDE_ACCOUNT=system
- PAM_FILE_INCLUDE_PASSWORD=system
- PAM_FILE_INCLUDE_SESSION=system
-+elif test x$with_os_type = xalpine; then
-+ PAM_FILE_INCLUDE_AUTH=base-auth
-+ PAM_FILE_INCLUDE_ACCOUNT=base-account
-+ PAM_FILE_INCLUDE_PASSWORD=base-password
-+ PAM_FILE_INCLUDE_SESSION=base-session
- else
- PAM_FILE_INCLUDE_AUTH=system-auth
- PAM_FILE_INCLUDE_ACCOUNT=system-auth
diff --git a/main/polkit/alpine-polkit.pam b/main/polkit/alpine-polkit.pam
new file mode 100644
index 0000000000..e718f7ee15
--- /dev/null
+++ b/main/polkit/alpine-polkit.pam
@@ -0,0 +1,7 @@
+auth requisite pam_nologin.so
+auth required pam_env.so
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
+session required pam_limits.so
+password required pam_unix.so
diff --git a/main/polkit/make-innetgr-optional.patch b/main/polkit/make-innetgr-optional.patch
index 338c201745..36eabbbd7b 100644
--- a/main/polkit/make-innetgr-optional.patch
+++ b/main/polkit/make-innetgr-optional.patch
@@ -1,3 +1,36 @@
+See https://gitlab.freedesktop.org/polkit/polkit/merge_requests/10
+
+From 778bb45e0e0cbabe2b04adf67a500af1dab09768 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Wed, 11 Jul 2018 04:54:26 -0500
+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.
+
+Closes polkit/polkit#14.
+
+Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
+---
+ configure.ac | 2 +-
+ src/polkit/polkitidentity.c | 16 ++++++++++++++++
+ src/polkit/polkitunixnetgroup.c | 3 +++
+ .../polkitbackendinteractiveauthority.c | 14 ++++++++------
+ src/polkitbackend/polkitbackendjsauthority.cpp | 2 ++
+ test/polkit/polkitidentitytest.c | 9 ++++++++-
+ test/polkit/polkitunixnetgrouptest.c | 3 +++
+ .../test-polkitbackendjsauthority.c | 2 ++
+ 8 files changed, 43 insertions(+), 8 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5cedb4e..87aa0ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,7 +99,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
@@ -5,64 +38,215 @@
AC_SUBST(EXPAT_LIBS)
-AC_CHECK_FUNCS(clearenv fdatasync)
-+AC_CHECK_FUNCS(clearenv fdatasync getnetgrent)
++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/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
+index 056d9a8..36c2f3d 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
-@@ -2228,6 +2228,7 @@ get_users_in_net_group (PolkitIdentity *group,
+@@ -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));
-+#if defined HAVE_GETNETGRENT
- #ifdef HAVE_SETNETGRENT_RETURN
+-#ifdef HAVE_SETNETGRENT_RETURN
++# ifdef HAVE_SETNETGRENT_RETURN
if (setnetgrent (name) == 0)
{
-@@ -2236,6 +2237,7 @@ get_users_in_net_group (PolkitIdentity *group,
+ g_warning ("Error looking up net group with name %s: %s", name, g_strerror (errno));
+ goto out;
}
- #else
+-#else
++# else
setnetgrent (name);
-+#endif
- #endif
+-#endif
++# endif /* HAVE_SETNETGRENT_RETURN */
for (;;)
-@@ -2248,8 +2250,10 @@ get_users_in_net_group (PolkitIdentity *group,
+ {
+-#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;
-+#if defined HAVE_GETNETGRENT
- if (getnetgrent (&hostname, &username, &domainname) == 0)
- break;
-+#endif
-
- /* Skip NULL entries since we never want to make everyone an admin
- * Skip "-" entries which mean "no match ever" in netgroup land */
-@@ -2274,7 +2278,9 @@ get_users_in_net_group (PolkitIdentity *group,
- ret = g_list_reverse (ret);
+@@ -2282,6 +2283,7 @@ get_users_in_net_group (PolkitIdentity *group,
out:
-+#if defined HAVE_GETNETGRENT
endnetgrent ();
-+#endif
++#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
-@@ -1499,6 +1499,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
+@@ -1502,6 +1502,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
-+#if defined HAVE_GETNETGRENT
- user = JS_EncodeString (cx, args[0].toString());
- netgroup = JS_EncodeString (cx, args[1].toString());
++#ifdef HAVE_SETNETGRENT
+ JS::RootedString usrstr (authority->priv->cx);
+ usrstr = args[0].toString();
+ user = JS_EncodeStringToUTF8 (cx, usrstr);
+@@ -1519,6 +1520,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
-@@ -1514,6 +1515,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
+ JS_free (cx, netgroup);
JS_free (cx, user);
++#endif
ret = true;
+
+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
- args.rval ().setBoolean (is_in_netgroup);
+ 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.18.1
+
diff --git a/main/polkit/mozjs60-1.patch b/main/polkit/mozjs60-1.patch
deleted file mode 100644
index d76a3350b3..0000000000
--- a/main/polkit/mozjs60-1.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Upstream: yes
-From c9cd7024140b837b5693d7c1bbaad1b0cd31cce6 Mon Sep 17 00:00:00 2001
-From: Emmanuele Bassi <ebassi@gnome.org>
-Date: Fri, 31 Aug 2018 13:32:16 +0100
-Subject: Depend on mozjs-60
-
-This is the new ESR version of the Mozilla JS engine, superceding
-mozjs-52.
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index 5c37e48..5cedb4e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -79,7 +79,7 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
- AC_SUBST(GLIB_CFLAGS)
- AC_SUBST(GLIB_LIBS)
-
--PKG_CHECK_MODULES(LIBJS, [mozjs-52])
-+PKG_CHECK_MODULES(LIBJS, [mozjs-60])
-
- AC_SUBST(LIBJS_CFLAGS)
- AC_SUBST(LIBJS_CXXFLAGS)
---
-cgit v1.1
-
diff --git a/main/polkit/mozjs60-2.patch b/main/polkit/mozjs60-2.patch
deleted file mode 100644
index 22369bc985..0000000000
--- a/main/polkit/mozjs60-2.patch
+++ /dev/null
@@ -1,158 +0,0 @@
-Upstream: yes
-From dd00683e8781d230a45781d509d86ad676138564 Mon Sep 17 00:00:00 2001
-From: Emmanuele Bassi <ebassi@gnome.org>
-Date: Fri, 31 Aug 2018 13:33:20 +0100
-Subject: Port the JS authority to mozjs-60
-
-API changes in mozjs that need to be reflected in the JS authority:
-
- - the JS::CompileOptions constructor and the JS::CompartmentOptions
- do not allow setting a JS version any more
-
- - do not use NULL comparisons for C++ objects
-
- - the resize() method for a vector has a return value that needs
- to be handled
-
- - JSClassOps has different fields
----
- src/polkitbackend/polkitbackendjsauthority.cpp | 65 +++++++++++++-------------
- 1 file changed, 32 insertions(+), 33 deletions(-)
-
-diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
-index 7602714..984a0f0 100644
---- a/src/polkitbackend/polkitbackendjsauthority.cpp
-+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
-@@ -150,18 +150,17 @@ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BAC
- /* ---------------------------------------------------------------------------------------------------- */
-
- static const struct JSClassOps js_global_class_ops = {
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL
-+ nullptr, // addProperty
-+ nullptr, // deleteProperty
-+ nullptr, // enumerate
-+ nullptr, // newEnumerate
-+ nullptr, // resolve
-+ nullptr, // mayResolve
-+ nullptr, // finalize
-+ nullptr, // call
-+ nullptr, // hasInstance
-+ nullptr, // construct
-+ JS_GlobalObjectTraceHook
- };
-
- static JSClass js_global_class = {
-@@ -172,18 +171,17 @@ static JSClass js_global_class = {
-
- /* ---------------------------------------------------------------------------------------------------- */
- static const struct JSClassOps js_polkit_class_ops = {
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL,
-- NULL
-+ nullptr, // addProperty
-+ nullptr, // deleteProperty
-+ nullptr, // enumerate
-+ nullptr, // newEnumerate
-+ nullptr, // resolve
-+ nullptr, // mayResolve
-+ nullptr, // finalize
-+ nullptr, // call
-+ nullptr, // hasInstance
-+ nullptr, // construct
-+ nullptr // trace
- };
-
- static JSClass js_polkit_class = {
-@@ -469,19 +467,18 @@ polkit_backend_js_authority_constructed (GObject *object)
-
- {
- JS::CompartmentOptions compart_opts;
-- compart_opts.behaviors().setVersion(JSVERSION_LATEST);
-+
- JS::RootedObject global(authority->priv->cx);
-
- authority->priv->js_global = new JS::Heap<JSObject*> (JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL, JS::FireOnNewGlobalHook, compart_opts));
-
- global = authority->priv->js_global->get ();
--
-- if (global == NULL)
-+ if (!global)
- goto fail;
-
- authority->priv->ac = new JSAutoCompartment(authority->priv->cx, global);
-
-- if (authority->priv->ac == NULL)
-+ if (!authority->priv->ac)
- goto fail;
-
- if (!JS_InitStandardClasses (authority->priv->cx, global))
-@@ -493,7 +490,7 @@ polkit_backend_js_authority_constructed (GObject *object)
-
- polkit = authority->priv->js_polkit->get ();
-
-- if (polkit == NULL)
-+ if (!polkit)
- goto fail;
-
- if (!JS_DefineProperty(authority->priv->cx, global, "polkit", polkit, JSPROP_ENUMERATE))
-@@ -504,7 +501,7 @@ polkit_backend_js_authority_constructed (GObject *object)
- js_polkit_functions))
- goto fail;
-
-- JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
-+ JS::CompileOptions options(authority->priv->cx);
- JS::RootedValue rval(authority->priv->cx);
- if (!JS::Evaluate (authority->priv->cx,
- options,
-@@ -684,7 +681,9 @@ set_property_strv (PolkitBackendJsAuthority *authority,
- JS::AutoValueVector elems(authority->priv->cx);
- guint n;
-
-- elems.resize(value->len);
-+ if (!elems.resize(value->len))
-+ g_error ("Unable to resize vector");
-+
- for (n = 0; n < value->len; n++)
- {
- const char *c_string = (const char *) g_ptr_array_index(value, n);
-@@ -741,7 +740,7 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
- GError **error)
- {
- gboolean ret = FALSE;
-- JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
-+ JS::CompileOptions options(authority->priv->cx);
- const char *src;
- JS::RootedObject obj(authority->priv->cx);
- pid_t pid;
-@@ -868,7 +867,7 @@ action_and_details_to_jsval (PolkitBackendJsAuthority *authority,
- GError **error)
- {
- gboolean ret = FALSE;
-- JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
-+ JS::CompileOptions options(authority->priv->cx);
- const char *src;
- JS::RootedObject obj(authority->priv->cx);
- gchar **keys;
---
-cgit v1.1
-