aboutsummaryrefslogtreecommitdiffstats
path: root/ext/tk/lib/multi-tk.rb
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-07 07:10:44 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-07 07:10:44 +0000
commit865ff7fb4f11bbf1f0e139e16470727828f54e63 (patch)
tree09e2f00bbd85e05ba96774c32f6ee3b6f543ae64 /ext/tk/lib/multi-tk.rb
parenta7357c196559f3181e359662d92cb06d7b18e3cb (diff)
downloadruby-865ff7fb4f11bbf1f0e139e16470727828f54e63.tar.gz
* tcltklib.c (lib_mainloop_core): fixed signal-trap bug
* multi-tk.rb, tk.rb, tkafter.rb, tkcanvas.rb, tkfont.rb, tktext.rb, tkvirtevent.rb : Ruby/Tk works at $SAFE == 4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/multi-tk.rb')
-rw-r--r--ext/tk/lib/multi-tk.rb51
1 files changed, 32 insertions, 19 deletions
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index 12ed7aceff..7053dddef9 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -35,16 +35,16 @@ MultiTkIp_OK.freeze
################################################
# methods for construction
class MultiTkIp
- SLAVE_IP_ID = ['slave'.freeze, '0'].freeze
+ SLAVE_IP_ID = ['slave'.freeze, '0'.taint].freeze
- @@IP_TABLE = {}
+ @@IP_TABLE = {}.taint
- @@INIT_IP_ENV = [] # table of Procs
- @@ADD_TK_PROCS = [] # table of [name, args, body]
+ @@INIT_IP_ENV = [].taint # table of Procs
+ @@ADD_TK_PROCS = [].taint # table of [name, args, body]
- @@TK_TABLE_LIST = []
+ @@TK_TABLE_LIST = [].taint
- @@TK_CMD_TBL = {}
+ @@TK_CMD_TBL = {}.taint
######################################
@@ -64,7 +64,7 @@ class MultiTkIp
rescue Exception
end
end
- }
+ }.freeze
######################################
@@ -200,13 +200,13 @@ class MultiTkIp
@@DEFAULT_MASTER = self.allocate
@@DEFAULT_MASTER.instance_eval{
- @encoding = []
+ @encoding = [].taint
- @tk_windows = {}
+ @tk_windows = {}.taint
- @tk_table_list = []
+ @tk_table_list = [].taint
- @slave_ip_tbl = {}
+ @slave_ip_tbl = {}.taint
unless keys.kind_of? Hash
fail ArgumentError, "expecting a Hash object for the 2nd argument"
@@ -266,6 +266,7 @@ class MultiTkIp
'nested'.freeze,
'deleteHook'.freeze
].freeze
+
def _parse_slaveopts(keys)
name = nil
safe = false
@@ -462,18 +463,24 @@ class MultiTkIp
fail SecurityError, "slave-ip cannot create master-ip"
end
+ if safeip == nil && $SAFE >= 4
+ fail SecurityError, "cannot create master-ip at level #{$SAFE}"
+ end
+
unless keys.kind_of? Hash
fail ArgumentError, "expecting a Hash object for the 2nd argument"
end
@encoding = []
-
@tk_windows = {}
-
@tk_table_list = []
-
@slave_ip_tbl = {}
+ @encoding.taint unless @encoding.tainted?
+ @tk_windows.taint unless @tk_windows.tainted?
+ @tk_table_list.taint unless @tk_table_list.tainted?
+ @slave_ip_tbl.taint unless @slave_ip_tbl.tainted?
+
name, safe, safe_opts, tk_opts = _parse_slaveopts(keys)
if safeip == nil
@@ -508,7 +515,10 @@ class MultiTkIp
@@IP_TABLE[@threadgroup] = self
_init_ip_internal(@@INIT_IP_ENV, @@ADD_TK_PROCS)
- @@TK_TABLE_LIST.size.times{ @tk_table_list << {} }
+ @@TK_TABLE_LIST.size.times{
+ (tbl = {}).tainted? || tbl.taint
+ @tk_table_list << tbl
+ }
self.freeze # defend against modification
end
@@ -661,7 +671,10 @@ class MultiTkIp
end
def _add_new_tables
- (@@TK_TABLE_LIST.size - @tk_table_list.size).times{ @tk_table_list << {} }
+ (@@TK_TABLE_LIST.size - @tk_table_list.size).times{
+ (tbl = {}).tainted? || tbl.taint
+ @tk_table_list << tbl
+ }
end
def _init_ip_env(script)
@@ -701,9 +714,9 @@ class MultiTkIp
__getip._tk_table_list[id]
end
def self.create_table
- if __getip.slave?
- raise SecurityError, "slave-IP has no permission creating a new table"
- end
+ #if __getip.slave?
+ # raise SecurityError, "slave-IP has no permission creating a new table"
+ #end
id = @@TK_TABLE_LIST.size
obj = Object.new
@@TK_TABLE_LIST << obj