• Jan Rybar's avatar
    Use JS_EncodeStringToUTF8 consistently with JavaScript · 2bc4e656
    Jan Rybar authored
    When strings handled by the jsbackendauthority contain non-ASCII, the
    code will fail.  For example, on a system having a user with a
    non-ASCII name, the following message will appear when a USB stick is
    plugged in.
    
    mar 04 21:47:31 mimmi polkitd[17163]: Error evaluating authorization rules
    
    The user will not be allowed to do the mount.
    
    The problem is that strings were variously encoded back to C strings
    with JS_EncodeString and JS_EncodeStringToUTF8.  According to the
    documentation
    (https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_EncodeString#Description)
    the former will simply drop the high byte from each character.  If
    that happens to a username, it will no longer be found as a valid user
    name on the system.  Explicitly encoding to UTF-8 will at least work
    in UTF-8 locales, which is the increasingly dominant encoding.
    2bc4e656
Name
Last commit
Last update
actions Loading commit data...
buildutil Loading commit data...
data Loading commit data...
docs Loading commit data...
po Loading commit data...
src Loading commit data...
test Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
COPYING Loading commit data...
ChangeLog Loading commit data...
HACKING Loading commit data...
Makefile.am Loading commit data...
NEWS Loading commit data...
README Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
git.mk Loading commit data...