diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-24 01:37:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-24 01:37:14 +0000 |
commit | c97a6987b62726a20570fb06681c986cf7f60141 (patch) | |
tree | 9fa981874abb554182dc2c4ed5d759364b5f7a2c /ext/tk/lib | |
parent | 61847a8279ae7ef57b1b9afff00eda76fe0a636c (diff) | |
download | ruby-c97a6987b62726a20570fb06681c986cf7f60141.tar.gz |
ext/tk: remove $SAFE 2..4 code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib')
-rw-r--r-- | ext/tk/lib/multi-tk.rb | 24 | ||||
-rw-r--r-- | ext/tk/lib/remote-tk.rb | 8 | ||||
-rw-r--r-- | ext/tk/lib/tk.rb | 28 | ||||
-rw-r--r-- | ext/tk/lib/tk/itemconfig.rb | 1 | ||||
-rw-r--r-- | ext/tk/lib/tk/optiondb.rb | 6 | ||||
-rw-r--r-- | ext/tk/lib/tk/timer.rb | 4 | ||||
-rw-r--r-- | ext/tk/lib/tk/variable.rb | 3 |
7 files changed, 12 insertions, 62 deletions
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb index 5129a6e862..c23c246551 100644 --- a/ext/tk/lib/multi-tk.rb +++ b/ext/tk/lib/multi-tk.rb @@ -1265,14 +1265,6 @@ class MultiTkIp ###################################### def initialize(master, safeip=true, keys={}) - if $SAFE >= 4 - fail SecurityError, "cannot create a new interpreter at level #{$SAFE}" - end - - if safeip == nil && $SAFE >= 2 - fail SecurityError, "cannot create a master-ip at level #{$SAFE}" - end - if master.deleted? && safeip == nil fail RuntimeError, "cannot create a slave of a deleted interpreter" end @@ -1307,7 +1299,7 @@ class MultiTkIp name, safe, safe_opts, tk_opts = _parse_slaveopts(keys) - safe = 4 if safe && !safe.kind_of?(Fixnum) + safe = 1 if safe && !safe.kind_of?(Fixnum) @safe_base = false @@ -1423,7 +1415,7 @@ class MultiTkIp safe = master.safe_level if safe < master.safe_level @safe_level = [safe] else - @safe_level = [4] + @safe_level = [1] end else @interp, @ip_name = master.__create_trusted_slave_obj(name, tk_opts) @@ -1615,7 +1607,7 @@ class << MultiTkIp end alias new_trusted_slave new_slave - def new_safe_slave(safe=4, keys={}, &blk) + def new_safe_slave(safe=1, keys={}, &blk) if safe.kind_of?(Hash) keys = safe elsif safe.kind_of?(Integer) @@ -2754,13 +2746,9 @@ class MultiTkIp if @wait_on_mainloop[0] begin @wait_on_mainloop[1] += 1 - if $SAFE >= 4 - _receiver_mainloop(check_root).join - else - @cmd_queue.enq([@system, 'call_mainloop', - Thread.current, check_root]) - Thread.stop - end + @cmd_queue.enq([@system, 'call_mainloop', + Thread.current, check_root]) + Thread.stop rescue MultiTkIp_OK => ret # return value if ret.value.kind_of?(Thread) diff --git a/ext/tk/lib/remote-tk.rb b/ext/tk/lib/remote-tk.rb index 443d66010c..f414489645 100644 --- a/ext/tk/lib/remote-tk.rb +++ b/ext/tk/lib/remote-tk.rb @@ -61,10 +61,6 @@ end class RemoteTkIp def initialize(remote_ip, displayof=nil, timeout=5) - if $SAFE >= 4 - fail SecurityError, "cannot access another interpreter at level #{$SAFE}" - end - @interp = MultiTkIp.__getip if @interp.safe? fail SecurityError, "safe-IP cannot create RemoteTkIp" @@ -199,9 +195,7 @@ class RemoteTkIp raise SecurityError, "no permission to manipulate" unless self.manipulable? p ['_appsend', [@remote, @displayof], enc_mode, async, cmds] if $DEBUG - if $SAFE >= 4 - fail SecurityError, "cannot send commands at level 4" - elsif $SAFE >= 1 && cmds.find{|obj| obj.tainted?} + if $SAFE >= 1 && cmds.find{|obj| obj.tainted?} fail SecurityError, "cannot send tainted commands at level #{$SAFE}" end diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 45f86a9253..dd29589e86 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -1785,9 +1785,7 @@ EOS end def appsend(interp, async, *args) - if $SAFE >= 4 - fail SecurityError, "cannot send Tk commands at level 4" - elsif $SAFE >= 1 && args.find{|obj| obj.tainted?} + if $SAFE >= 1 && args.find{|obj| obj.tainted?} fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}" end if async != true && async != false && async != nil @@ -1802,9 +1800,7 @@ EOS end def rb_appsend(interp, async, *args) - if $SAFE >= 4 - fail SecurityError, "cannot send Ruby commands at level 4" - elsif $SAFE >= 1 && args.find{|obj| obj.tainted?} + if $SAFE >= 1 && args.find{|obj| obj.tainted?} fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}" end if async != true && async != false && async != nil @@ -1820,9 +1816,7 @@ EOS end def appsend_displayof(interp, win, async, *args) - if $SAFE >= 4 - fail SecurityError, "cannot send Tk commands at level 4" - elsif $SAFE >= 1 && args.find{|obj| obj.tainted?} + if $SAFE >= 1 && args.find{|obj| obj.tainted?} fail SecurityError, "cannot send tainted Tk commands at level #{$SAFE}" end win = '.' if win == nil @@ -1838,9 +1832,7 @@ EOS end def rb_appsend_displayof(interp, win, async, *args) - if $SAFE >= 4 - fail SecurityError, "cannot send Ruby commands at level 4" - elsif $SAFE >= 1 && args.find{|obj| obj.tainted?} + if $SAFE >= 1 && args.find{|obj| obj.tainted?} fail SecurityError, "cannot send tainted Ruby commands at level #{$SAFE}" end win = '.' if win == nil @@ -1899,7 +1891,7 @@ EOS INTERP_ROOT_CHECK.wait(INTERP_MUTEX) status = INTERP_THREAD_STATUS.value if status && TkCore::INTERP.default_master? - INTERP_THREAD_STATUS.value = nil if $SAFE < 4 + INTERP_THREAD_STATUS.value = nil raise status if status.kind_of?(Exception) end } @@ -2209,9 +2201,6 @@ module Tk # tk_split_simplelist(INTERP._invoke('set', 'tcl_libPath')) when :PLATFORM, :TCL_PLATFORM - if $SAFE >= 4 - fail SecurityError, "can't get #{sym} when $SAFE >= 4" - end INTERP._invoke_without_enc('global', 'tcl_platform') Hash[*tk_split_simplelist(INTERP._invoke_without_enc('array', 'get', 'tcl_platform'))] @@ -3746,7 +3735,6 @@ module TkConfigMethod @mode || false end def TkConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) - fail SecurityError, "can't change the mode" if $SAFE>=4 @mode = (mode)? true: false end @@ -5650,9 +5638,6 @@ class TkWindow<TkObject end def wait_visibility(on_thread = true) - if $SAFE >= 4 - fail SecurityError, "can't wait visibility at $SAFE >= 4" - end on_thread &= (Thread.list.size != 1) if on_thread INTERP._thread_tkwait('visibility', path) @@ -5676,9 +5661,6 @@ class TkWindow<TkObject alias thread_tkwait_visibility thread_wait_visibility def wait_destroy(on_thread = true) - if $SAFE >= 4 - fail SecurityError, "can't wait destroy at $SAFE >= 4" - end on_thread &= (Thread.list.size != 1) if on_thread INTERP._thread_tkwait('window', epath) diff --git a/ext/tk/lib/tk/itemconfig.rb b/ext/tk/lib/tk/itemconfig.rb index 14396048ba..e8eb83d66c 100644 --- a/ext/tk/lib/tk/itemconfig.rb +++ b/ext/tk/lib/tk/itemconfig.rb @@ -124,7 +124,6 @@ module TkItemConfigMethod @mode || false end def TkItemConfigMethod.__set_IGNORE_UNKNOWN_CONFIGURE_OPTION__!(mode) - fail SecurityError, "can't change the mode" if $SAFE>=4 @mode = (mode)? true: false end diff --git a/ext/tk/lib/tk/optiondb.rb b/ext/tk/lib/tk/optiondb.rb index 0f3be30ff7..91d2697a86 100644 --- a/ext/tk/lib/tk/optiondb.rb +++ b/ext/tk/lib/tk/optiondb.rb @@ -22,15 +22,9 @@ module TkOptionDB end def add(pat, value, pri=None) - # if $SAFE >= 4 - # fail SecurityError, "can't call 'TkOptionDB.add' at $SAFE >= 4" - # end tk_call('option', 'add', pat, value, pri) end def clear - # if $SAFE >= 4 - # fail SecurityError, "can't call 'TkOptionDB.crear' at $SAFE >= 4" - # end tk_call_without_enc('option', 'clear') end def get(win, name, klass) diff --git a/ext/tk/lib/tk/timer.rb b/ext/tk/lib/tk/timer.rb index ddfbfce9be..29aa84b0d9 100644 --- a/ext/tk/lib/tk/timer.rb +++ b/ext/tk/lib/tk/timer.rb @@ -498,10 +498,6 @@ class TkTimer end def wait(on_thread = true, check_root = false) - if $SAFE >= 4 - fail SecurityError, "can't wait timer at $SAFE >= 4" - end - unless @running if @return_value.kind_of?(Exception) fail @return_value diff --git a/ext/tk/lib/tk/variable.rb b/ext/tk/lib/tk/variable.rb index 0487b034bd..496225a92d 100644 --- a/ext/tk/lib/tk/variable.rb +++ b/ext/tk/lib/tk/variable.rb @@ -360,9 +360,6 @@ class TkVariable end def wait(on_thread = false, check_root = false) - if $SAFE >= 4 - fail SecurityError, "can't wait variable at $SAFE >= 4" - end on_thread &= (Thread.list.size != 1) if on_thread if check_root |