1
0
forked from mirrors/0ad

Fix Unicode support in lobby.

Fix EncryptPassword being called with the wrong argument order, and
encrypting username instead of password. (This will break all existing
lobby accounts.)

Fix EncryptPassword not using all of salt_base.

This was SVN commit r14123.
This commit is contained in:
Ykkrosh
2013-11-09 23:26:17 +00:00
parent 35d48d2fe8
commit d7ec8c47a6
4 changed files with 114 additions and 77 deletions
@@ -803,6 +803,24 @@ bool ScriptInterface::SetProperty_(jsval obj, const char* name, jsval value, boo
return true;
}
bool ScriptInterface::SetProperty_(jsval obj, const wchar_t* name, jsval value, bool constant, bool enumerate)
{
uintN attrs = 0;
if (constant)
attrs |= JSPROP_READONLY | JSPROP_PERMANENT;
if (enumerate)
attrs |= JSPROP_ENUMERATE;
if (! JSVAL_IS_OBJECT(obj))
return false;
JSObject* object = JSVAL_TO_OBJECT(obj);
utf16string name16(name, name + wcslen(name));
if (! JS_DefineUCProperty(m->m_cx, object, reinterpret_cast<const jschar*>(name16.c_str()), name16.length(), value, NULL, NULL, attrs))
return false;
return true;
}
bool ScriptInterface::SetPropertyInt_(jsval obj, int name, jsval value, bool constant, bool enumerate)
{
uintN attrs = 0;