PolicyKit: Branch 'master' - 3 commits
Miloslav Trmac
mitr at kemper.freedesktop.org
Mon May 6 11:07:41 PDT 2013
src/polkitbackend/init.js | 2 +-
src/polkitbackend/polkitbackendjsauthority.c | 18 ++++++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)
New commits:
commit 18f9d2608b145a3cc39e88b3e8aa74c742d47190
Author: Miloslav TrmaÄ <mitr at redhat.com>
Date: Thu Apr 18 20:32:05 2013 +0200
Refuse non-string parameters to Polkit.spawn()
Using integers or floating-point numbers could have resulted in a crash.
Use JSVAL_IS_STRING() instead of implicit conversion through
JS_ValueToString(); hopefully this will nudge the rule writer toward
thinking more about the string conversion and the format of the
resulting string.
https://bugs.freedesktop.org/show_bug.cgi?id=63575
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index 0dd9548..bc2fe22 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -1357,6 +1357,12 @@ js_polkit_spawn (JSContext *cx,
JS_ReportError (cx, "Failed to get element %d", n);
goto out;
}
+ if (!JSVAL_IS_STRING (elem_val))
+ {
+ JS_ReportError (cx, "Element %d is not a string", n);
+ goto out;
+ }
+ s = JS_EncodeString (cx, JSVAL_TO_STRING (elem_val));
s = JS_EncodeString (cx, JSVAL_TO_STRING (elem_val));
argv[n] = g_strdup (s);
JS_free (cx, s);
commit 8085a29c67c4a6e1f58f8975e0f7426d09d0fa99
Author: Miloslav TrmaÄ <mitr at redhat.com>
Date: Thu Apr 18 20:31:48 2013 +0200
Fix handling of null returned from _runRules
https://bugs.freedesktop.org/show_bug.cgi?id=63575
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index 3eeca21..0dd9548 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -1188,20 +1188,20 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
goto out;
}
- if (!JSVAL_IS_STRING (rval) && !JSVAL_IS_NULL (rval))
+ if (JSVAL_IS_NULL (rval))
{
- g_warning ("Expected a string");
+ /* this fine, means there was no match, use implicit authorizations */
+ good = TRUE;
goto out;
}
- ret_jsstr = JSVAL_TO_STRING (rval);
- if (ret_jsstr == NULL)
+ if (!JSVAL_IS_STRING (rval))
{
- /* this fine, means there was no match, use implicit authorizations */
- good = TRUE;
+ g_warning ("Expected a string");
goto out;
}
+ ret_jsstr = JSVAL_TO_STRING (rval);
ret_utf16 = JS_GetStringCharsZ (authority->priv->cx, ret_jsstr);
ret_str = g_utf16_to_utf8 (ret_utf16, -1, NULL, NULL, &error);
if (ret_str == NULL)
commit 25298f4dea7970d7b0f3adefd4b56f7154ae9335
Author: Miloslav TrmaÄ <mitr at redhat.com>
Date: Tue Apr 9 20:50:38 2013 +0200
Fix a TypeError when no admin rules are registered
https://bugs.freedesktop.org/show_bug.cgi?id=63575
diff --git a/src/polkitbackend/init.js b/src/polkitbackend/init.js
index af85d05..79c80b6 100644
--- a/src/polkitbackend/init.js
+++ b/src/polkitbackend/init.js
@@ -59,7 +59,7 @@ polkit._runAdminRules = function(action, subject) {
break
}
}
- return ret.join(",");
+ return ret ? ret.join(",") : "";
};
polkit._ruleFuncs = [];
More information about the hal-commit
mailing list