Update mozjs38 patch

This commit is contained in:
Peter Robinson 2017-04-04 20:16:50 +01:00
parent 85e785c922
commit 52aeecd450
3 changed files with 58 additions and 72 deletions

29
.gitignore vendored
View File

@ -1,27 +1,2 @@
/.project
polkit-0.92.tar.gz
polkit-0.93.tar.gz
polkit-0.94.tar.gz
polkit-0.95.git20090913.tar.gz
polkit-0.95.tar.gz
polkit-0.96.tar.gz
polkit-0.97.tar.gz
polkit-0.98.tar.gz
/polkit-0.100.tar.gz
/polkit-0.101.tar.gz
/polkit-0.102.tar.gz
/polkit-0.103.tar.gz
/polkit-0.104.tar.gz
/polkit-0.105.tar.gz
/polkit-0.106.tar.gz
/polkit-0.107.tar.gz
/polkit-0.108.tar.gz
/polkit-0.109.tar.gz
/polkit-0.110.tar.gz
/polkit-0.111.tar.gz
/polkit-0.111.tar.gz.sign
/polkit-0.112.tar.gz
/polkit-0.112.tar.gz.sign
/polkit-0.113.tar.gz
/polkit-0.113.tar.gz.sign
/polkit-0.113-2919920.tar.gz
/polkit-*.tar.gz
/polkit-*.sign

View File

@ -15,9 +15,11 @@ polkit in step with gnome.
Signed-off-by: Jeremy Linton <jeremy.linton at arm.com>
---
v1->v2: Switch back to using initjs.j rather than init.js
configure.ac | 2 +-
src/polkitbackend/polkitbackendjsauthority.cpp | 422 +++++++++++++------------
2 files changed, 213 insertions(+), 211 deletions(-)
src/polkitbackend/polkitbackendjsauthority.cpp | 430 ++++++++++++-------------
2 files changed, 216 insertions(+), 216 deletions(-)
diff --git a/configure.ac b/configure.ac
index af2c8dd..093f5ea 100644
@ -33,7 +35,7 @@ index af2c8dd..093f5ea 100644
AC_SUBST(LIBJS_CFLAGS)
AC_SUBST(LIBJS_CXXFLAGS)
diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
index 6a0b4ab..68bc147 100644
index 6a0b4ab..292e344 100644
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
@@ -30,6 +30,7 @@
@ -258,6 +260,10 @@ index 6a0b4ab..68bc147 100644
- if (!JS_EvaluateScript (authority->priv->cx,
- authority->priv->js_global,
- init_js, strlen (init_js), /* init.js */
- "init.js", /* filename */
- 0, /* lineno */
- NULL)) /* rval */
- {
+ JS::CompileOptions options(authority->priv->cx);
+ options.setUTF8(true);
+ JS::RootedValue result(authority->priv->cx);
@ -265,10 +271,7 @@ index 6a0b4ab..68bc147 100644
+ if (!JS::Evaluate(authority->priv->cx,
+ *authority->priv->js_global,
+ options,
"init.js", /* filename */
- 0, /* lineno */
- NULL)) /* rval */
- {
+ init_js, strlen(init_js),
+ &result
+ ))
goto fail;
@ -380,7 +383,7 @@ index 6a0b4ab..68bc147 100644
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -732,11 +725,10 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
@@ -732,13 +725,11 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
PolkitIdentity *user_for_subject,
gboolean subject_is_local,
gboolean subject_is_active,
@ -391,9 +394,11 @@ index 6a0b4ab..68bc147 100644
gboolean ret = FALSE;
- jsval ret_jsval;
const char *src;
JSObject *obj;
- JSObject *obj;
pid_t pid;
@@ -747,19 +739,21 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
uid_t uid;
gchar *user_name = NULL;
@@ -747,19 +738,21 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
char *seat_str = NULL;
char *session_str = NULL;
@ -422,7 +427,7 @@ index 6a0b4ab..68bc147 100644
if (POLKIT_IS_UNIX_PROCESS (subject))
{
pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject));
@@ -832,14 +826,17 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
@@ -832,14 +825,17 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
}
}
@ -448,7 +453,7 @@ index 6a0b4ab..68bc147 100644
ret = TRUE;
out:
@@ -849,9 +846,6 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
@@ -849,9 +845,6 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
if (groups != NULL)
g_ptr_array_unref (groups);
@ -458,7 +463,7 @@ index 6a0b4ab..68bc147 100644
return ret;
}
@@ -862,48 +856,50 @@ static gboolean
@@ -862,48 +855,49 @@ static gboolean
action_and_details_to_jsval (PolkitBackendJsAuthority *authority,
const gchar *action_id,
PolkitDetails *details,
@ -469,7 +474,7 @@ index 6a0b4ab..68bc147 100644
gboolean ret = FALSE;
- jsval ret_jsval;
const char *src;
JSObject *obj;
- JSObject *obj;
gchar **keys;
guint n;
@ -531,7 +536,7 @@ index 6a0b4ab..68bc147 100644
return ret;
}
@@ -939,7 +935,7 @@ runaway_killer_thread_func (gpointer user_data)
@@ -939,7 +933,7 @@ runaway_killer_thread_func (gpointer user_data)
/* ---------------------------------------------------------------------------------------------------- */
@ -540,7 +545,7 @@ index 6a0b4ab..68bc147 100644
js_operation_callback (JSContext *cx)
{
PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx));
@@ -953,7 +949,7 @@ js_operation_callback (JSContext *cx)
@@ -953,7 +947,7 @@ js_operation_callback (JSContext *cx)
if (!authority->priv->rkt_timeout_pending)
{
g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex);
@ -549,7 +554,7 @@ index 6a0b4ab..68bc147 100644
}
authority->priv->rkt_timeout_pending = FALSE;
g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex);
@@ -962,12 +958,11 @@ js_operation_callback (JSContext *cx)
@@ -962,12 +956,11 @@ js_operation_callback (JSContext *cx)
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Terminating runaway script");
/* Throw an exception - this way the JS code can ignore the runaway script handling */
@ -565,7 +570,7 @@ index 6a0b4ab..68bc147 100644
}
static gboolean
@@ -980,7 +975,7 @@ rkt_on_timeout (gpointer user_data)
@@ -980,7 +973,7 @@ rkt_on_timeout (gpointer user_data)
g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex);
/* Supposedly this is thread-safe... */
@ -574,7 +579,7 @@ index 6a0b4ab..68bc147 100644
/* keep source around so we keep trying to kill even if the JS bit catches the exception
* thrown in js_operation_callback()
@@ -1004,49 +999,48 @@ runaway_killer_setup (PolkitBackendJsAuthority *authority)
@@ -1004,49 +997,48 @@ runaway_killer_setup (PolkitBackendJsAuthority *authority)
/* ... rkt_on_timeout() will then poke the JSContext so js_operation_callback() is
* called... and from there we throw an exception
*/
@ -639,7 +644,7 @@ index 6a0b4ab..68bc147 100644
rval);
runaway_killer_teardown (authority);
return ret;
@@ -1066,17 +1060,18 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
@@ -1066,17 +1058,18 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
{
PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
GList *ret = NULL;
@ -662,7 +667,7 @@ index 6a0b4ab..68bc147 100644
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
"Error converting action and details to JS object: %s",
@@ -1090,7 +1085,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
@@ -1090,7 +1083,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
user_for_subject,
subject_is_local,
subject_is_active,
@ -671,7 +676,7 @@ index 6a0b4ab..68bc147 100644
&error))
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
@@ -1099,11 +1094,12 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
@@ -1099,11 +1092,12 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
g_clear_error (&error);
goto out;
}
@ -687,7 +692,7 @@ index 6a0b4ab..68bc147 100644
&rval))
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
@@ -1111,14 +1107,17 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
@@ -1111,14 +1105,17 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
goto out;
}
@ -708,7 +713,7 @@ index 6a0b4ab..68bc147 100644
if (ret_str == NULL)
{
g_warning ("Error converting resulting string to UTF-8: %s", error->message);
@@ -1136,8 +1135,8 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
@@ -1136,8 +1133,8 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
if (identity == NULL)
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
@ -719,7 +724,7 @@ index 6a0b4ab..68bc147 100644
}
else
{
@@ -1148,7 +1147,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
@@ -1148,7 +1145,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
out:
g_strfreev (ret_strs);
@ -728,7 +733,7 @@ index 6a0b4ab..68bc147 100644
/* fallback to root password auth */
if (ret == NULL)
ret = g_list_prepend (ret, polkit_unix_user_new (0));
@@ -1175,17 +1174,18 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
@@ -1175,17 +1172,18 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
{
PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
PolkitImplicitAuthorization ret = implicit;
@ -752,7 +757,7 @@ index 6a0b4ab..68bc147 100644
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
"Error converting action and details to JS object: %s",
@@ -1199,7 +1199,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
@@ -1199,7 +1197,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
user_for_subject,
subject_is_local,
subject_is_active,
@ -761,7 +766,7 @@ index 6a0b4ab..68bc147 100644
&error))
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
@@ -1209,10 +1209,13 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
@@ -1209,10 +1207,13 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
goto out;
}
@ -777,7 +782,7 @@ index 6a0b4ab..68bc147 100644
&rval))
{
polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
@@ -1220,22 +1223,17 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
@@ -1220,22 +1221,17 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
goto out;
}
@ -806,7 +811,7 @@ index 6a0b4ab..68bc147 100644
if (ret_str == NULL)
{
g_warning ("Error converting resulting string to UTF-8: %s", error->message);
@@ -1257,7 +1255,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
@@ -1257,7 +1253,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
out:
if (!good)
ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED;
@ -815,7 +820,7 @@ index 6a0b4ab..68bc147 100644
JS_MaybeGC (authority->priv->cx);
@@ -1268,26 +1266,26 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
@@ -1268,27 +1264,27 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
/* ---------------------------------------------------------------------------------------------------- */
@ -842,13 +847,15 @@ index 6a0b4ab..68bc147 100644
- ret = JS_TRUE;
+ ret = true;
+
+ args.rval().setUndefined(); //returned undefined
- JS_SET_RVAL (cx, vp, JSVAL_VOID); /* return undefined */
+ args.rval().setUndefined(); //returned undefined
out:
- out:
return ret;
}
@@ -1353,13 +1351,13 @@ spawn_cb (GObject *source_object,
@@ -1353,13 +1349,13 @@ spawn_cb (GObject *source_object,
g_main_loop_quit (data->loop);
}
@ -865,7 +872,7 @@ index 6a0b4ab..68bc147 100644
JSObject *array_object;
gchar *standard_output = NULL;
gchar *standard_error = NULL;
@@ -1372,11 +1370,13 @@ js_polkit_spawn (JSContext *cx,
@@ -1372,11 +1368,13 @@ js_polkit_spawn (JSContext *cx,
GMainLoop *loop = NULL;
SpawnData data = {0};
guint n;
@ -874,15 +881,15 @@ index 6a0b4ab..68bc147 100644
- if (!JS_ConvertArguments (cx, js_argc, JS_ARGV (cx, vp), "o", &array_object))
- goto out;
+ array_object=JS::ToObject(cx, args[0]);
+
+ JS::RootedObject opts(cx, array_object);
- if (!JS_GetArrayLength (cx, array_object, &array_len))
+ JS::RootedObject opts(cx, array_object);
+
+ if (!JS_GetArrayLength (cx, opts, &array_len))
{
JS_ReportError (cx, "Failed to get array length");
goto out;
@@ -1387,18 +1387,19 @@ js_polkit_spawn (JSContext *cx,
@@ -1387,18 +1385,19 @@ js_polkit_spawn (JSContext *cx,
{
jsval elem_val;
char *s;
@ -907,7 +914,7 @@ index 6a0b4ab..68bc147 100644
argv[n] = g_strdup (s);
JS_free (cx, s);
}
@@ -1456,10 +1457,10 @@ js_polkit_spawn (JSContext *cx,
@@ -1456,10 +1455,10 @@ js_polkit_spawn (JSContext *cx,
goto out;
}
@ -920,7 +927,7 @@ index 6a0b4ab..68bc147 100644
out:
g_strfreev (argv);
@@ -1476,21 +1477,22 @@ js_polkit_spawn (JSContext *cx,
@@ -1476,21 +1475,22 @@ js_polkit_spawn (JSContext *cx,
/* ---------------------------------------------------------------------------------------------------- */
@ -948,7 +955,7 @@ index 6a0b4ab..68bc147 100644
user = JS_EncodeString (cx, user_str);
netgroup = JS_EncodeString (cx, netgroup_str);
@@ -1500,15 +1502,15 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
@@ -1500,16 +1500,16 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
user,
NULL)) /* domain */
{
@ -961,11 +968,13 @@ index 6a0b4ab..68bc147 100644
- ret = JS_TRUE;
+ ret = true;
+
+ args.rval().setBoolean(is_in_netgroup);
- JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (is_in_netgroup));
+ args.rval().setBoolean(is_in_netgroup);
out:
- out:
return ret;
}
--
2.11.0

View File

@ -20,6 +20,7 @@ Patch0: polkit-0.113-agent-leaks.patch
# https://lists.freedesktop.org/archives/polkit-devel/2017-March/000527.html
Patch1: polkit-mozjs38.patch
BuildRequires: gcc-c++
BuildRequires: glib2-devel >= 2.30.0
BuildRequires: expat-devel
BuildRequires: pam-devel
@ -91,13 +92,14 @@ Libraries files for polkit.
%build
%if 0%{?enable_autoreconf}
./autogen.sh
NOCONFIGURE=1 ./autogen.sh
%endif
%configure --enable-gtk-doc \
--disable-static \
--enable-introspection \
--disable-examples \
--enable-libsystemd-login=yes --with-mozjs=mozjs-38.0
--enable-libsystemd-login=yes \
--with-mozjs=mozjs-38.0
make %{?_smp_mflags} V=1