mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Remove unused test files related $SAFE>=2
unused since r14024 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
11b147ece9
commit
310e91f505
3 changed files with 1 additions and 87 deletions
|
@ -15,7 +15,7 @@ class DRbService
|
||||||
DRb::ExtServManager.command[nm] = @@ruby + ["#{dir}/#{nm}"]
|
DRb::ExtServManager.command[nm] = @@ruby + ["#{dir}/#{nm}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(ut_drb.rb ut_array.rb ut_port.rb ut_large.rb ut_safe1.rb ut_eval.rb ut_eq.rb).each do |nm|
|
%w(ut_drb.rb ut_array.rb ut_port.rb ut_large.rb ut_safe1.rb ut_eq.rb).each do |nm|
|
||||||
add_service_command(nm)
|
add_service_command(nm)
|
||||||
end
|
end
|
||||||
@server = @@server = DRb::DRbServer.new('druby://localhost:0', @@manager, {})
|
@server = @@server = DRb::DRbServer.new('druby://localhost:0', @@manager, {})
|
||||||
|
|
|
@ -240,55 +240,6 @@ class TestDRbSafe1 < TestDRbAry
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestDRbEval # < Test::Unit::TestCase
|
|
||||||
def setup
|
|
||||||
super
|
|
||||||
@ext = DRbService.ext_service('ut_eval.rb')
|
|
||||||
@there = @ext.front
|
|
||||||
end
|
|
||||||
|
|
||||||
def teardown
|
|
||||||
@ext.stop_service if @ext
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_01_safe1_safe4_eval
|
|
||||||
assert_raise(SecurityError) do
|
|
||||||
@there.method_missing(:instance_eval, 'ENV.inspect')
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_raise(SecurityError) do
|
|
||||||
@there.method_missing(:send, :eval, 'ENV.inspect')
|
|
||||||
end
|
|
||||||
|
|
||||||
remote_class = @there.remote_class
|
|
||||||
|
|
||||||
assert_raise(SecurityError) do
|
|
||||||
remote_class.class_eval('ENV.inspect')
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_raise(SecurityError) do
|
|
||||||
remote_class.module_eval('ENV.inspect')
|
|
||||||
end
|
|
||||||
|
|
||||||
four = @there.four
|
|
||||||
assert_equal(1, four.method_missing(:send, :eval, '1'))
|
|
||||||
|
|
||||||
remote_class = four.remote_class
|
|
||||||
|
|
||||||
assert_equal(1, remote_class.class_eval('1'))
|
|
||||||
|
|
||||||
assert_equal(1, remote_class.module_eval('1'))
|
|
||||||
|
|
||||||
assert_raise(SecurityError) do
|
|
||||||
remote_class.class_eval('ENV = {}')
|
|
||||||
end
|
|
||||||
|
|
||||||
assert_raise(SecurityError) do
|
|
||||||
remote_class.module_eval('ENV = {}')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class TestDRbLarge < Test::Unit::TestCase
|
class TestDRbLarge < Test::Unit::TestCase
|
||||||
include DRbBase
|
include DRbBase
|
||||||
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
# frozen_string_literal: false
|
|
||||||
require 'drb/drb'
|
|
||||||
require 'drb/extserv'
|
|
||||||
|
|
||||||
module DRbTests
|
|
||||||
|
|
||||||
class EvalAttack
|
|
||||||
def initialize
|
|
||||||
@four = DRb::DRbServer.new('druby://localhost:0', self, {:safe_level => 4})
|
|
||||||
end
|
|
||||||
|
|
||||||
def four
|
|
||||||
DRbObject.new_with_uri(@four.uri)
|
|
||||||
end
|
|
||||||
|
|
||||||
def remote_class
|
|
||||||
DRbObject.new(self.class)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if __FILE__ == $0
|
|
||||||
def ARGV.shift
|
|
||||||
it = super()
|
|
||||||
raise "usage: #{$0} <uri> <name>" unless it
|
|
||||||
it
|
|
||||||
end
|
|
||||||
|
|
||||||
$SAFE = 1
|
|
||||||
|
|
||||||
DRb.start_service('druby://localhost:0', DRbTests::EvalAttack.new, {:safe_level => 2})
|
|
||||||
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
|
|
||||||
DRb.thread.join
|
|
||||||
es.stop_service if es.alive?
|
|
||||||
end
|
|
Loading…
Reference in a new issue