Mercurial Hosting > luan
diff core/src/luan/modules/PackageLuan.java @ 229:2a54cb7d1cf4
improve security
git-svn-id: https://luan-java.googlecode.com/svn/trunk@230 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 24 Sep 2014 21:13:46 +0000 |
parents | ec016471c6eb |
children | 4dfa86dbca45 |
line wrap: on
line diff
--- a/core/src/luan/modules/PackageLuan.java Wed Sep 24 03:39:34 2014 +0000 +++ b/core/src/luan/modules/PackageLuan.java Wed Sep 24 21:13:46 2014 +0000 @@ -26,8 +26,6 @@ module.put( "jpath", jpath ); try { module.put("require",requireFn); - add( module, "block_path", LuanState.class, String.class ); - add( module, "is_blocked_path", LuanState.class, String.class ); add( module, "load", LuanState.class, String.class ); add( module, "load_lib", LuanState.class, String.class ); add( module, "search_path", String.class, String.class ); @@ -197,19 +195,17 @@ }; - public static void block_path(LuanState luan,String path) { - blocked(luan).put(path,true); + public static void block(LuanState luan,String key) { + blocked(luan).put(key,true); } - public static boolean is_blocked_path(LuanState luan,String path) { - return blocked(luan).get(path) != null; + public static boolean is_blocked(LuanState luan,String key) { + return blocked(luan).get(key) != null; } public static LuanFunction load_lib(LuanState luan,String path) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, LuanException { - if( is_blocked_path(luan,path) ) - throw luan.exception(path+" is blocked"); int i = path.lastIndexOf('.'); String clsPath = path.substring(0,i); String fld = path.substring(i+1);