summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authortinywrkb2020-11-28 19:30:33 +0200
committertinywrkb2020-11-28 19:30:33 +0200
commit4bf3d1898280f8c7207926920ed5e8ecd325d2a6 (patch)
tree6a26ee8bd5e23a29424a5e652cd5f1c76216ac0d
parent1a2056c0857a024c9156e8bbd4908093b8582636 (diff)
downloadaur-4bf3d1898280f8c7207926920ed5e8ecd325d2a6.tar.gz
bump to 0.118-3: update duktape patch
-rw-r--r--.SRCINFO4
-rw-r--r--0001-Add-duktape-as-javascript-engine.patch118
-rw-r--r--PKGBUILD8
3 files changed, 78 insertions, 52 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e524f3ed7b7a..c70174ea130d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = polkit-duktape
pkgdesc = polkit with duktape as the javascript engine
pkgver = 0.118
- pkgrel = 2
+ pkgrel = 3
url = https://www.freedesktop.org/wiki/Software/polkit/
arch = x86_64
license = LGPL
@@ -21,7 +21,7 @@ pkgbase = polkit-duktape
source = git+https://gitlab.freedesktop.org/polkit/polkit.git#commit=ff4c2144f0fb1325275887d9e254117fcd8a1b52
source = 0001-Add-duktape-as-javascript-engine.patch
sha256sums = SKIP
- sha256sums = SKIP
+ sha256sums = 4b6b90ca0f2fa44115027cc6bb98fa43fede46e7fa31a6fd52f8ec142c0073f1
pkgname = polkit-duktape
diff --git a/0001-Add-duktape-as-javascript-engine.patch b/0001-Add-duktape-as-javascript-engine.patch
index 43c156a80f2f..34ddd2fd4d30 100644
--- a/0001-Add-duktape-as-javascript-engine.patch
+++ b/0001-Add-duktape-as-javascript-engine.patch
@@ -1,4 +1,4 @@
-From 3df6a51feef96d5bf3402ce3df0c20ed0cc5cef8 Mon Sep 17 00:00:00 2001
+From b920ce94b3fb3765ea5b35b01639325155cd1609 Mon Sep 17 00:00:00 2001
From: Wu Xiaotian <yetist@gmail.com>
Date: Wed, 24 Jul 2019 15:55:17 +0800
Subject: [PATCH] Add duktape as javascript engine.
@@ -6,8 +6,8 @@ Subject: [PATCH] Add duktape as javascript engine.
---
configure.ac | 28 +-
src/polkitbackend/Makefile.am | 14 +-
- .../polkitbackendduktapeauthority.c | 1402 +++++++++++++++++
- 3 files changed, 1436 insertions(+), 8 deletions(-)
+ .../polkitbackendduktapeauthority.c | 1428 +++++++++++++++++
+ 3 files changed, 1462 insertions(+), 8 deletions(-)
create mode 100644 src/polkitbackend/polkitbackendduktapeauthority.c
diff --git a/configure.ac b/configure.ac
@@ -101,10 +101,10 @@ index e48b739..9572b06 100644
diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
new file mode 100644
-index 0000000..ae98453
+index 0000000..4b4f8fd
--- /dev/null
+++ b/src/polkitbackend/polkitbackendduktapeauthority.c
-@@ -0,0 +1,1402 @@
+@@ -0,0 +1,1428 @@
+/*
+ * Copyright (C) 2008-2012 Red Hat, Inc.
+ * Copyright (C) 2015 Tangent Space <jstpierre@mecheye.net>
@@ -133,7 +133,11 @@ index 0000000..ae98453
+#include <errno.h>
+#include <pwd.h>
+#include <grp.h>
++#ifdef HAVE_NETGROUP_H
++#include <netgroup.h>
++#else
+#include <netdb.h>
++#endif
+#include <string.h>
+#include <glib/gstdio.h>
+#include <locale.h>
@@ -172,7 +176,6 @@ index 0000000..ae98453
+ duk_context *cx;
+};
+
-+#define WATCHDOG_TIMEOUT (15 * G_TIME_SPAN_SECOND)
+
+static void utils_spawn (const gchar *const *argv,
+ guint timeout_seconds,
@@ -228,6 +231,18 @@ index 0000000..ae98453
+
+/* ---------------------------------------------------------------------------------------------------- */
+
++static duk_ret_t js_polkit_log (duk_context *cx);
++static duk_ret_t js_polkit_spawn (duk_context *cx);
++static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx);
++
++static const duk_function_list_entry js_polkit_functions[] =
++{
++ { "log", js_polkit_log, 1 },
++ { "spawn", js_polkit_spawn, 1 },
++ { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 },
++ { NULL, NULL, 0 },
++};
++
+static void
+polkit_backend_js_authority_init (PolkitBackendJsAuthority *authority)
+{
@@ -310,18 +325,22 @@ index 0000000..ae98453
+
+ for (l = files; l != NULL; l = l->next)
+ {
-+ const gchar *filename = l->data;
-+
++ const gchar *filename = (gchar *)l->data;
+#if (DUK_VERSION >= 20000)
-+ gchar *contents;
-+ gsize length;
-+ GError *error = NULL;
-+ if (!g_file_get_contents (filename, &contents, &length, &error)){
-+ g_warning("Error when file contents of %s: %s\n", filename, error->message);
-+ g_error_free (error);
-+ continue;
-+ }
-+ if (duk_peval_lstring_noresult(cx, contents,length) != 0)
++ GFile *file = g_file_new_for_path (filename);
++ char *contents;
++ gsize len;
++ if (!g_file_load_contents (file, NULL, &contents, &len, NULL, NULL))
++ {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error compiling script %s",
++ filename);
++ g_object_unref (file);
++ continue;
++ }
++
++ g_object_unref (file);
++ if (duk_peval_lstring_noresult(cx, contents,len) != 0)
+#else
+ if (duk_peval_file_noresult (cx, filename) != 0)
+#endif
@@ -352,7 +371,11 @@ index 0000000..ae98453
+ duk_context *cx = authority->priv->cx;
+
+ duk_set_top (cx, 0);
-+ duk_get_global_string (cx, "polkit");
++ if (!duk_get_global_string (cx, "polkit")) {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error deleting old rules, not loading new ones");
++ return;
++ }
+ duk_push_string (cx, "_deleteRules");
+
+ duk_call_prop (cx, 0, 0);
@@ -442,18 +465,6 @@ index 0000000..ae98453
+ authority->priv->dir_monitors = (GFileMonitor**) g_ptr_array_free (p, FALSE);
+}
+
-+static duk_ret_t js_polkit_log (duk_context *cx);
-+static duk_ret_t js_polkit_spawn (duk_context *cx);
-+static duk_ret_t js_polkit_user_is_in_netgroup (duk_context *cx);
-+
-+static const duk_function_list_entry js_polkit_functions[] =
-+{
-+ { "log", js_polkit_log, 1 },
-+ { "spawn", js_polkit_spawn, 1 },
-+ { "_userIsInNetGroup", js_polkit_user_is_in_netgroup, 2 },
-+ { NULL, NULL, 0 },
-+};
-+
+static void
+polkit_backend_js_authority_constructed (GObject *object)
+{
@@ -649,7 +660,10 @@ index 0000000..ae98453
+ char *seat_str = NULL;
+ char *session_str = NULL;
+
-+ duk_get_global_string (cx, "Subject");
++ if (!duk_get_global_string (cx, "Subject")) {
++ return FALSE;
++ }
++
+ duk_new (cx, 0);
+
+ if (POLKIT_IS_UNIX_PROCESS (subject))
@@ -755,7 +769,10 @@ index 0000000..ae98453
+ gchar **keys;
+ guint n;
+
-+ duk_get_global_string (cx, "Action");
++ if (!duk_get_global_string (cx, "Action")) {
++ return FALSE;
++ }
++
+ duk_new (cx, 0);
+
+ set_property_str (cx, "id", action_id);
@@ -798,7 +815,12 @@ index 0000000..ae98453
+ duk_context *cx = authority->priv->cx;
+
+ duk_set_top (cx, 0);
-+ duk_get_global_string (cx, "polkit");
++ if (!duk_get_global_string (cx, "polkit")) {
++ polkit_backend_authority_log (POLKIT_BACKEND_AUTHORITY (authority),
++ "Error deleting old rules, not loading new ones");
++ goto out;
++ }
++
+ duk_push_string (cx, "_runAdminRules");
+
+ if (!push_action_and_details (cx, action_id, details, &error))
@@ -881,7 +903,10 @@ index 0000000..ae98453
+ duk_context *cx = authority->priv->cx;
+
+ duk_set_top (cx, 0);
-+ duk_get_global_string (cx, "polkit");
++ if (!duk_get_global_string (cx, "polkit")) {
++ goto out;
++ }
++
+ duk_push_string (cx, "_runRules");
+
+ if (!push_action_and_details (cx, action_id, details, &error))
@@ -928,7 +953,8 @@ index 0000000..ae98453
+ out:
+ if (!good)
+ ret = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED;
-+ g_free (ret_str);
++ if (ret_str != NULL)
++ g_free (ret_str);
+
+ return ret;
+}
@@ -999,8 +1025,8 @@ index 0000000..ae98453
+ GAsyncResult *res,
+ gpointer user_data)
+{
-+ SpawnData *data = user_data;
-+ data->res = g_object_ref (res);
++ SpawnData *data = (SpawnData *)user_data;
++ data->res = (GAsyncResult*)g_object_ref (res);
+ g_main_loop_quit (data->loop);
+}
+
@@ -1275,7 +1301,7 @@ index 0000000..ae98453
+utils_on_cancelled (GCancellable *cancellable,
+ gpointer user_data)
+{
-+ UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ GError *error;
+
+ error = NULL;
@@ -1290,7 +1316,7 @@ index 0000000..ae98453
+ GIOCondition condition,
+ gpointer user_data)
+{
-+ UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ gchar buf[1024];
+ gsize bytes_read;
+
@@ -1304,7 +1330,7 @@ index 0000000..ae98453
+ GIOCondition condition,
+ gpointer user_data)
+{
-+ UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ gchar buf[1024];
+ gsize bytes_read;
+
@@ -1318,7 +1344,7 @@ index 0000000..ae98453
+ gint status,
+ gpointer user_data)
+{
-+ UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+ gchar *buf;
+ gsize buf_size;
+
@@ -1347,7 +1373,7 @@ index 0000000..ae98453
+static gboolean
+utils_timeout_cb (gpointer user_data)
+{
-+ UtilsSpawnData *data = user_data;
++ UtilsSpawnData *data = (UtilsSpawnData *)user_data;
+
+ data->timed_out = TRUE;
+
@@ -1376,12 +1402,12 @@ index 0000000..ae98453
+ data->simple = g_simple_async_result_new (NULL,
+ callback,
+ user_data,
-+ utils_spawn);
++ (gpointer*)utils_spawn);
+ data->main_context = g_main_context_get_thread_default ();
+ if (data->main_context != NULL)
+ g_main_context_ref (data->main_context);
+
-+ data->cancellable = cancellable != NULL ? g_object_ref (cancellable) : NULL;
++ data->cancellable = cancellable != NULL ? (GCancellable*)g_object_ref (cancellable) : NULL;
+
+ data->child_stdout = g_string_new (NULL);
+ data->child_stderr = g_string_new (NULL);
@@ -1481,7 +1507,7 @@ index 0000000..ae98453
+ if (g_simple_async_result_propagate_error (simple, error))
+ goto out;
+
-+ data = g_simple_async_result_get_op_res_gpointer (simple);
++ data = (UtilsSpawnData*)g_simple_async_result_get_op_res_gpointer (simple);
+
+ if (data->timed_out)
+ {
@@ -1508,5 +1534,5 @@ index 0000000..ae98453
+ return ret;
+}
--
-2.28.0
+2.29.2
diff --git a/PKGBUILD b/PKGBUILD
index b6c417fc9a85..d2898e2acbb9 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,10 +1,9 @@
-# Maintainer: tinywrkb <tinywrkb@gmail.com>
-# Contributor: Jan de Groot <jgc@archlinux.org>
+# Maintainer: Jan de Groot <jgc@archlinux.org>
_pkgname=polkit
pkgname=${_pkgname}-duktape
pkgver=0.118
-pkgrel=2
+pkgrel=3
pkgdesc="polkit with duktape as the javascript engine"
arch=(x86_64)
license=(LGPL)
@@ -17,7 +16,8 @@ backup=(etc/pam.d/polkit-1)
_commit=ff4c2144f0fb1325275887d9e254117fcd8a1b52
source=("git+https://gitlab.freedesktop.org/polkit/polkit.git#commit=$_commit"
"0001-Add-duktape-as-javascript-engine.patch")
-sha256sums=('SKIP' 'SKIP')
+sha256sums=('SKIP'
+ '4b6b90ca0f2fa44115027cc6bb98fa43fede46e7fa31a6fd52f8ec142c0073f1')
pkgver() {
cd $_pkgname