projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a2e7ffc
)
prosody: sandboxed require(): Point __index of _G at current env for modules that...
author
Matthew Wild
<mwild1@gmail.com>
Mon, 23 Jan 2012 01:04:15 +0000
(
01:04
+0000)
committer
Matthew Wild
<mwild1@gmail.com>
Mon, 23 Jan 2012 01:04:15 +0000
(
01:04
+0000)
prosody
patch
|
blob
|
history
diff --git
a/prosody
b/prosody
index 385997a65bba4f77e5bd8105f658a0759a4a2c4b..f79910b723b9f3985e313cfa7ca43b3a1336fa16 100755
(executable)
--- a/
prosody
+++ b/
prosody
@@
-150,10
+150,14
@@
function sandbox_require()
local curr_env_mt = getmetatable(getfenv(2));
local _realG_mt = getmetatable(_realG);
if curr_env_mt and curr_env_mt.__index and not curr_env_mt.__newindex and _realG_mt then
local curr_env_mt = getmetatable(getfenv(2));
local _realG_mt = getmetatable(_realG);
if curr_env_mt and curr_env_mt.__index and not curr_env_mt.__newindex and _realG_mt then
- local old_newindex
+ local old_newindex
, old_index;
old_newindex, _realG_mt.__newindex = _realG_mt.__newindex, curr_env;
old_newindex, _realG_mt.__newindex = _realG_mt.__newindex, curr_env;
+ old_index, _realG_mt.__index = _realG_mt.__index, function (_G, k)
+ return rawget(curr_env, k);
+ end;
local ret = _real_require(...);
_realG_mt.__newindex = old_newindex;
local ret = _real_require(...);
_realG_mt.__newindex = old_newindex;
+ _realG_mt.__index = old_index;
return ret;
end
return _real_require(...);
return ret;
end
return _real_require(...);