From 45d9d07563f4ce1e491afaa1c5968e78b00de2f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Tue, 4 Apr 2017 21:56:55 +0200 Subject: [PATCH] Revert "Update mozjs38 patch" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 52aeecd450b3e5af3a57598d919573bab578576c. The updated patch is still not correct enough, namely it processes cases where the JS .rules do not provide an answer and the “implicit” value should be returned incorrectly. --- .gitignore | 29 +++++++++++++- polkit-mozjs38.patch | 95 ++++++++++++++++++++------------------------ polkit.spec | 6 +-- 3 files changed, 72 insertions(+), 58 deletions(-) diff --git a/.gitignore b/.gitignore index 69083e7..1278c71 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,27 @@ -/polkit-*.tar.gz -/polkit-*.sign +/.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 diff --git a/polkit-mozjs38.patch b/polkit-mozjs38.patch index 929bc59..0b0b91d 100644 --- a/polkit-mozjs38.patch +++ b/polkit-mozjs38.patch @@ -15,11 +15,9 @@ polkit in step with gnome. Signed-off-by: Jeremy Linton --- - v1->v2: Switch back to using initjs.j rather than init.js - configure.ac | 2 +- - src/polkitbackend/polkitbackendjsauthority.cpp | 430 ++++++++++++------------- - 2 files changed, 216 insertions(+), 216 deletions(-) + src/polkitbackend/polkitbackendjsauthority.cpp | 422 +++++++++++++------------ + 2 files changed, 213 insertions(+), 211 deletions(-) diff --git a/configure.ac b/configure.ac index af2c8dd..093f5ea 100644 @@ -35,7 +33,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..292e344 100644 +index 6a0b4ab..68bc147 100644 --- a/src/polkitbackend/polkitbackendjsauthority.cpp +++ b/src/polkitbackend/polkitbackendjsauthority.cpp @@ -30,6 +30,7 @@ @@ -260,10 +258,6 @@ index 6a0b4ab..292e344 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); @@ -271,7 +265,10 @@ index 6a0b4ab..292e344 100644 + if (!JS::Evaluate(authority->priv->cx, + *authority->priv->js_global, + options, -+ init_js, strlen(init_js), + "init.js", /* filename */ +- 0, /* lineno */ +- NULL)) /* rval */ +- { + &result + )) goto fail; @@ -383,7 +380,7 @@ index 6a0b4ab..292e344 100644 } /* ---------------------------------------------------------------------------------------------------- */ -@@ -732,13 +725,11 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, +@@ -732,11 +725,10 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, PolkitIdentity *user_for_subject, gboolean subject_is_local, gboolean subject_is_active, @@ -394,11 +391,9 @@ index 6a0b4ab..292e344 100644 gboolean ret = FALSE; - jsval ret_jsval; const char *src; -- JSObject *obj; + JSObject *obj; pid_t pid; - uid_t uid; - gchar *user_name = NULL; -@@ -747,19 +738,21 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, +@@ -747,19 +739,21 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, char *seat_str = NULL; char *session_str = NULL; @@ -427,7 +422,7 @@ index 6a0b4ab..292e344 100644 if (POLKIT_IS_UNIX_PROCESS (subject)) { pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject)); -@@ -832,14 +825,17 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, +@@ -832,14 +826,17 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, } } @@ -453,7 +448,7 @@ index 6a0b4ab..292e344 100644 ret = TRUE; out: -@@ -849,9 +845,6 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, +@@ -849,9 +846,6 @@ subject_to_jsval (PolkitBackendJsAuthority *authority, if (groups != NULL) g_ptr_array_unref (groups); @@ -463,7 +458,7 @@ index 6a0b4ab..292e344 100644 return ret; } -@@ -862,48 +855,49 @@ static gboolean +@@ -862,48 +856,50 @@ static gboolean action_and_details_to_jsval (PolkitBackendJsAuthority *authority, const gchar *action_id, PolkitDetails *details, @@ -474,7 +469,7 @@ index 6a0b4ab..292e344 100644 gboolean ret = FALSE; - jsval ret_jsval; const char *src; -- JSObject *obj; + JSObject *obj; gchar **keys; guint n; @@ -536,7 +531,7 @@ index 6a0b4ab..292e344 100644 return ret; } -@@ -939,7 +933,7 @@ runaway_killer_thread_func (gpointer user_data) +@@ -939,7 +935,7 @@ runaway_killer_thread_func (gpointer user_data) /* ---------------------------------------------------------------------------------------------------- */ @@ -545,7 +540,7 @@ index 6a0b4ab..292e344 100644 js_operation_callback (JSContext *cx) { PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (JS_GetContextPrivate (cx)); -@@ -953,7 +947,7 @@ js_operation_callback (JSContext *cx) +@@ -953,7 +949,7 @@ js_operation_callback (JSContext *cx) if (!authority->priv->rkt_timeout_pending) { g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex); @@ -554,7 +549,7 @@ index 6a0b4ab..292e344 100644 } authority->priv->rkt_timeout_pending = FALSE; g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex); -@@ -962,12 +956,11 @@ js_operation_callback (JSContext *cx) +@@ -962,12 +958,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 */ @@ -570,7 +565,7 @@ index 6a0b4ab..292e344 100644 } static gboolean -@@ -980,7 +973,7 @@ rkt_on_timeout (gpointer user_data) +@@ -980,7 +975,7 @@ rkt_on_timeout (gpointer user_data) g_mutex_unlock (&authority->priv->rkt_timeout_pending_mutex); /* Supposedly this is thread-safe... */ @@ -579,7 +574,7 @@ index 6a0b4ab..292e344 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 +997,48 @@ runaway_killer_setup (PolkitBackendJsAuthority *authority) +@@ -1004,49 +999,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 */ @@ -644,7 +639,7 @@ index 6a0b4ab..292e344 100644 rval); runaway_killer_teardown (authority); return ret; -@@ -1066,17 +1058,18 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA +@@ -1066,17 +1060,18 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA { PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); GList *ret = NULL; @@ -667,7 +662,7 @@ index 6a0b4ab..292e344 100644 { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Error converting action and details to JS object: %s", -@@ -1090,7 +1083,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA +@@ -1090,7 +1085,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA user_for_subject, subject_is_local, subject_is_active, @@ -676,7 +671,7 @@ index 6a0b4ab..292e344 100644 &error)) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -@@ -1099,11 +1092,12 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA +@@ -1099,11 +1094,12 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA g_clear_error (&error); goto out; } @@ -692,7 +687,7 @@ index 6a0b4ab..292e344 100644 &rval)) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -@@ -1111,14 +1105,17 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA +@@ -1111,14 +1107,17 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA goto out; } @@ -713,7 +708,7 @@ index 6a0b4ab..292e344 100644 if (ret_str == NULL) { g_warning ("Error converting resulting string to UTF-8: %s", error->message); -@@ -1136,8 +1133,8 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA +@@ -1136,8 +1135,8 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA if (identity == NULL) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), @@ -724,7 +719,7 @@ index 6a0b4ab..292e344 100644 } else { -@@ -1148,7 +1145,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA +@@ -1148,7 +1147,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA out: g_strfreev (ret_strs); @@ -733,7 +728,7 @@ index 6a0b4ab..292e344 100644 /* fallback to root password auth */ if (ret == NULL) ret = g_list_prepend (ret, polkit_unix_user_new (0)); -@@ -1175,17 +1172,18 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu +@@ -1175,17 +1174,18 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu { PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority); PolkitImplicitAuthorization ret = implicit; @@ -757,7 +752,7 @@ index 6a0b4ab..292e344 100644 { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), "Error converting action and details to JS object: %s", -@@ -1199,7 +1197,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu +@@ -1199,7 +1199,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu user_for_subject, subject_is_local, subject_is_active, @@ -766,7 +761,7 @@ index 6a0b4ab..292e344 100644 &error)) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -@@ -1209,10 +1207,13 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu +@@ -1209,10 +1209,13 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu goto out; } @@ -782,7 +777,7 @@ index 6a0b4ab..292e344 100644 &rval)) { polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority), -@@ -1220,22 +1221,17 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu +@@ -1220,22 +1223,17 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu goto out; } @@ -811,7 +806,7 @@ index 6a0b4ab..292e344 100644 if (ret_str == NULL) { g_warning ("Error converting resulting string to UTF-8: %s", error->message); -@@ -1257,7 +1253,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu +@@ -1257,7 +1255,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu out: if (!good) ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED; @@ -820,7 +815,7 @@ index 6a0b4ab..292e344 100644 JS_MaybeGC (authority->priv->cx); -@@ -1268,27 +1264,27 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu +@@ -1268,26 +1266,26 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu /* ---------------------------------------------------------------------------------------------------- */ @@ -847,15 +842,13 @@ index 6a0b4ab..292e344 100644 - ret = JS_TRUE; + ret = true; -+ -+ args.rval().setUndefined(); //returned undefined - JS_SET_RVAL (cx, vp, JSVAL_VOID); /* return undefined */ -- out: ++ args.rval().setUndefined(); //returned undefined + out: return ret; } - -@@ -1353,13 +1349,13 @@ spawn_cb (GObject *source_object, +@@ -1353,13 +1351,13 @@ spawn_cb (GObject *source_object, g_main_loop_quit (data->loop); } @@ -872,7 +865,7 @@ index 6a0b4ab..292e344 100644 JSObject *array_object; gchar *standard_output = NULL; gchar *standard_error = NULL; -@@ -1372,11 +1368,13 @@ js_polkit_spawn (JSContext *cx, +@@ -1372,11 +1370,13 @@ js_polkit_spawn (JSContext *cx, GMainLoop *loop = NULL; SpawnData data = {0}; guint n; @@ -881,15 +874,15 @@ index 6a0b4ab..292e344 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 +1385,19 @@ js_polkit_spawn (JSContext *cx, +@@ -1387,18 +1387,19 @@ js_polkit_spawn (JSContext *cx, { jsval elem_val; char *s; @@ -914,7 +907,7 @@ index 6a0b4ab..292e344 100644 argv[n] = g_strdup (s); JS_free (cx, s); } -@@ -1456,10 +1455,10 @@ js_polkit_spawn (JSContext *cx, +@@ -1456,10 +1457,10 @@ js_polkit_spawn (JSContext *cx, goto out; } @@ -927,7 +920,7 @@ index 6a0b4ab..292e344 100644 out: g_strfreev (argv); -@@ -1476,21 +1475,22 @@ js_polkit_spawn (JSContext *cx, +@@ -1476,21 +1477,22 @@ js_polkit_spawn (JSContext *cx, /* ---------------------------------------------------------------------------------------------------- */ @@ -955,7 +948,7 @@ index 6a0b4ab..292e344 100644 user = JS_EncodeString (cx, user_str); netgroup = JS_EncodeString (cx, netgroup_str); -@@ -1500,16 +1500,16 @@ js_polkit_user_is_in_netgroup (JSContext *cx, +@@ -1500,15 +1502,15 @@ js_polkit_user_is_in_netgroup (JSContext *cx, user, NULL)) /* domain */ { @@ -968,13 +961,11 @@ index 6a0b4ab..292e344 100644 - ret = JS_TRUE; + ret = true; -+ -+ args.rval().setBoolean(is_in_netgroup); - JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (is_in_netgroup)); -- out: ++ args.rval().setBoolean(is_in_netgroup); + out: return ret; } - -- 2.11.0 diff --git a/polkit.spec b/polkit.spec index 75b8f2a..ff75d62 100644 --- a/polkit.spec +++ b/polkit.spec @@ -20,7 +20,6 @@ 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 @@ -92,14 +91,13 @@ Libraries files for polkit. %build %if 0%{?enable_autoreconf} -NOCONFIGURE=1 ./autogen.sh +./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