Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 681692
Collapse All | Expand All

(-)a/sys-auth/polkit/files/polkit-0.115-spidermonkey-60.patch (+180 lines)
Line 0 Link Here
1
From c9cd7024140b837b5693d7c1bbaad1b0cd31cce6 Mon Sep 17 00:00:00 2001
2
From: Emmanuele Bassi <ebassi@gnome.org>
3
Date: Fri, 31 Aug 2018 13:32:16 +0100
4
Subject: [PATCH] Depend on mozjs-60
5
6
This is the new ESR version of the Mozilla JS engine, superceding
7
mozjs-52.
8
---
9
 configure.ac | 2 +-
10
 1 file changed, 1 insertion(+), 1 deletion(-)
11
12
diff --git a/configure.ac b/configure.ac
13
index 5c37e48..5cedb4e 100644
14
--- a/configure.ac
15
+++ b/configure.ac
16
@@ -79,7 +79,7 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
17
 AC_SUBST(GLIB_CFLAGS)
18
 AC_SUBST(GLIB_LIBS)
19
 
20
-PKG_CHECK_MODULES(LIBJS, [mozjs-52])
21
+PKG_CHECK_MODULES(LIBJS, [mozjs-60])
22
 
23
 AC_SUBST(LIBJS_CFLAGS)
24
 AC_SUBST(LIBJS_CXXFLAGS)
25
26
27
From dd00683e8781d230a45781d509d86ad676138564 Mon Sep 17 00:00:00 2001
28
From: Emmanuele Bassi <ebassi@gnome.org>
29
Date: Fri, 31 Aug 2018 13:33:20 +0100
30
Subject: [PATCH] Port the JS authority to mozjs-60
31
32
API changes in mozjs that need to be reflected in the JS authority:
33
34
 - the JS::CompileOptions constructor and the JS::CompartmentOptions
35
   do not allow setting a JS version any more
36
37
 - do not use NULL comparisons for C++ objects
38
39
 - the resize() method for a vector has a return value that needs
40
   to be handled
41
42
 - JSClassOps has different fields
43
---
44
 .../polkitbackendjsauthority.cpp              | 65 +++++++++----------
45
 1 file changed, 32 insertions(+), 33 deletions(-)
46
47
diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
48
index 7602714..984a0f0 100644
49
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
50
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
51
@@ -150,18 +150,17 @@ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BAC
52
 /* ---------------------------------------------------------------------------------------------------- */
53
 
54
 static const struct JSClassOps js_global_class_ops = {
55
-  NULL,
56
-  NULL,
57
-  NULL,
58
-  NULL,
59
-  NULL,
60
-  NULL,
61
-  NULL,
62
-  NULL,
63
-  NULL,
64
-  NULL,
65
-  NULL,
66
-  NULL
67
+  nullptr,  // addProperty
68
+  nullptr,  // deleteProperty
69
+  nullptr,  // enumerate
70
+  nullptr,  // newEnumerate
71
+  nullptr,  // resolve
72
+  nullptr,  // mayResolve
73
+  nullptr,  // finalize
74
+  nullptr,  // call
75
+  nullptr,  // hasInstance
76
+  nullptr,  // construct
77
+  JS_GlobalObjectTraceHook
78
 };
79
 
80
 static JSClass js_global_class = {
81
@@ -172,18 +171,17 @@ static JSClass js_global_class = {
82
 
83
 /* ---------------------------------------------------------------------------------------------------- */
84
 static const struct JSClassOps js_polkit_class_ops = {
85
-  NULL,
86
-  NULL,
87
-  NULL,
88
-  NULL,
89
-  NULL,
90
-  NULL,
91
-  NULL,
92
-  NULL,
93
-  NULL,
94
-  NULL,
95
-  NULL,
96
-  NULL
97
+  nullptr,  // addProperty
98
+  nullptr,  // deleteProperty
99
+  nullptr,  // enumerate
100
+  nullptr,  // newEnumerate
101
+  nullptr,  // resolve
102
+  nullptr,  // mayResolve
103
+  nullptr,  // finalize
104
+  nullptr,  // call
105
+  nullptr,  // hasInstance
106
+  nullptr,  // construct
107
+  nullptr   // trace
108
 };
109
 
110
 static JSClass js_polkit_class = {
111
@@ -469,19 +467,18 @@ polkit_backend_js_authority_constructed (GObject *object)
112
 
113
   {
114
     JS::CompartmentOptions compart_opts;
115
-    compart_opts.behaviors().setVersion(JSVERSION_LATEST);
116
+
117
     JS::RootedObject global(authority->priv->cx);
118
 
119
     authority->priv->js_global = new JS::Heap<JSObject*> (JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL, JS::FireOnNewGlobalHook, compart_opts));
120
 
121
     global = authority->priv->js_global->get ();
122
-
123
-    if (global == NULL)
124
+    if (!global)
125
       goto fail;
126
 
127
     authority->priv->ac = new JSAutoCompartment(authority->priv->cx,  global);
128
 
129
-    if (authority->priv->ac == NULL)
130
+    if (!authority->priv->ac)
131
       goto fail;
132
 
133
     if (!JS_InitStandardClasses (authority->priv->cx, global))
134
@@ -493,7 +490,7 @@ polkit_backend_js_authority_constructed (GObject *object)
135
 
136
     polkit = authority->priv->js_polkit->get ();
137
 
138
-    if (polkit == NULL)
139
+    if (!polkit)
140
       goto fail;
141
 
142
     if (!JS_DefineProperty(authority->priv->cx, global, "polkit", polkit, JSPROP_ENUMERATE))
143
@@ -504,7 +501,7 @@ polkit_backend_js_authority_constructed (GObject *object)
144
                              js_polkit_functions))
145
       goto fail;
146
 
147
-    JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
148
+    JS::CompileOptions options(authority->priv->cx);
149
     JS::RootedValue rval(authority->priv->cx);
150
     if (!JS::Evaluate (authority->priv->cx,
151
                        options,
152
@@ -684,7 +681,9 @@ set_property_strv (PolkitBackendJsAuthority  *authority,
153
   JS::AutoValueVector elems(authority->priv->cx);
154
   guint n;
155
 
156
-  elems.resize(value->len);
157
+  if (!elems.resize(value->len))
158
+    g_error ("Unable to resize vector");
159
+
160
   for (n = 0; n < value->len; n++)
161
     {
162
       const char *c_string = (const char *) g_ptr_array_index(value, n);
163
@@ -741,7 +740,7 @@ subject_to_jsval (PolkitBackendJsAuthority  *authority,
164
                   GError                   **error)
165
 {
166
   gboolean ret = FALSE;
167
-  JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
168
+  JS::CompileOptions options(authority->priv->cx);
169
   const char *src;
170
   JS::RootedObject obj(authority->priv->cx);
171
   pid_t pid;
172
@@ -868,7 +867,7 @@ action_and_details_to_jsval (PolkitBackendJsAuthority  *authority,
173
                              GError                   **error)
174
 {
175
   gboolean ret = FALSE;
176
-  JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
177
+  JS::CompileOptions options(authority->priv->cx);
178
   const char *src;
179
   JS::RootedObject obj(authority->priv->cx);
180
   gchar **keys;
(-)a/sys-auth/polkit/polkit-0.115-r4.ebuild (-1 / +143 lines)
Line 0 Link Here
0
- 
1
# Copyright 1999-2019 Gentoo Authors
2
# Distributed under the terms of the GNU General Public License v2
3
4
EAPI=7
5
6
inherit autotools pam pax-utils systemd user xdg-utils
7
8
DESCRIPTION="Policy framework for controlling privileges for system-wide services"
9
HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://gitlab.freedesktop.org/polkit/polkit"
10
SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz"
11
12
LICENSE="LGPL-2"
13
SLOT="0"
14
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
15
IUSE="elogind examples gtk +introspection jit kde nls pam selinux systemd test"
16
17
REQUIRED_USE="?? ( elogind systemd )"
18
19
BDEPEND="
20
	app-text/docbook-xml-dtd:4.1.2
21
	app-text/docbook-xsl-stylesheets
22
	dev-libs/gobject-introspection-common
23
	dev-libs/libxslt
24
	dev-util/glib-utils
25
	dev-util/gtk-doc-am
26
	dev-util/intltool
27
	sys-devel/gettext
28
	virtual/pkgconfig
29
	introspection? ( dev-libs/gobject-introspection )
30
"
31
DEPEND="
32
	dev-lang/spidermonkey:60[-debug]
33
	dev-libs/glib:2
34
	dev-libs/expat
35
	elogind? ( sys-auth/elogind )
36
	pam? (
37
		sys-auth/pambase
38
		virtual/pam
39
	)
40
	systemd? ( sys-apps/systemd:0=[policykit] )
41
"
42
RDEPEND="${DEPEND}
43
	selinux? ( sec-policy/selinux-policykit )
44
"
45
PDEPEND="
46
	gtk? ( || (
47
		>=gnome-extra/polkit-gnome-0.105
48
		>=lxde-base/lxsession-0.5.2
49
	) )
50
	kde? ( kde-plasma/polkit-kde-agent )
51
	!systemd? ( !elogind? ( sys-auth/consolekit[policykit] ) )
52
"
53
54
DOCS=( docs/TODO HACKING NEWS README )
55
56
PATCHES=(
57
	# bug 660880
58
	"${FILESDIR}"/polkit-0.115-elogind.patch
59
	"${FILESDIR}"/CVE-2018-19788.patch
60
	"${FILESDIR}"/polkit-0.115-spidermonkey-60.patch
61
)
62
63
QA_MULTILIB_PATHS="
64
	usr/lib/polkit-1/polkit-agent-helper-1
65
	usr/lib/polkit-1/polkitd"
66
67
pkg_setup() {
68
	local u=polkitd
69
	local g=polkitd
70
	local h=/var/lib/polkit-1
71
72
	enewgroup ${g}
73
	enewuser ${u} -1 -1 ${h} ${g}
74
	esethome ${u} ${h}
75
}
76
77
src_prepare() {
78
	default
79
80
	sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die #401513
81
82
	# Workaround upstream hack around standard gtk-doc behavior, bug #552170
83
	sed -i -e 's/@ENABLE_GTK_DOC_TRUE@\(TARGET_DIR\)/\1/' \
84
		-e '/install-data-local:/,/uninstall-local:/ s/@ENABLE_GTK_DOC_TRUE@//' \
85
		-e 's/@ENABLE_GTK_DOC_FALSE@install-data-local://' \
86
		docs/polkit/Makefile.in || die
87
88
	# disable broken test - bug #624022
89
	sed -i -e "/^SUBDIRS/s/polkitbackend//" test/Makefile.am || die
90
91
	# Fix cross-building, bug #590764, elogind patch, bug #598615
92
	eautoreconf
93
}
94
95
src_configure() {
96
	xdg_environment_reset
97
98
	local myeconfargs=(
99
		--localstatedir="${EPREFIX}"/var
100
		--disable-static
101
		--enable-man-pages
102
		--disable-gtk-doc
103
		--disable-examples
104
		$(use_enable elogind libelogind)
105
		$(use_enable introspection)
106
		$(use_enable nls)
107
		$(usex pam "--with-pam-module-dir=$(getpam_mod_dir)" '')
108
		--with-authfw=$(usex pam pam shadow)
109
		$(use_enable systemd libsystemd-login)
110
		--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
111
		$(use_enable test)
112
		--with-os-type=gentoo
113
	)
114
	econf "${myeconfargs[@]}"
115
}
116
117
src_compile() {
118
	default
119
120
	# Required for polkitd on hardened/PaX due to spidermonkey's JIT
121
	pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest
122
}
123
124
src_install() {
125
	default
126
127
	fowners -R polkitd:root /{etc,usr/share}/polkit-1/rules.d
128
129
	diropts -m0700 -o polkitd -g polkitd
130
	keepdir /var/lib/polkit-1
131
132
	if use examples; then
133
		insinto /usr/share/doc/${PF}/examples
134
		doins src/examples/{*.c,*.policy*}
135
	fi
136
137
	find "${ED}" -name '*.la' -delete || die
138
}
139
140
pkg_postinst() {
141
	chown -R polkitd:root "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
142
	chown -R polkitd:polkitd "${EROOT}"/var/lib/polkit-1
143
}

Return to bug 681692