adhoc patch for [druby-ja:123]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4f6e8bade5
commit
d822ffdc04
@ -1,3 +1,10 @@
|
|||||||
|
Mon Apr 11 23:36:04 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
|
* lib/drb/drb.r: [druby-ja:123] fix: When reference of my object is
|
||||||
|
loaded, the object is tainted.
|
||||||
|
|
||||||
|
* test/drb/test_drb.rb: ditto.
|
||||||
|
|
||||||
Mon Apr 11 22:18:23 2005 WATANABE Hirofumi <eban@ruby-lang.org>
|
Mon Apr 11 22:18:23 2005 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* dir.c, file.c (lstat): avoid warnings for mingw.
|
* dir.c, file.c (lstat): avoid warnings for mingw.
|
||||||
|
@ -575,10 +575,19 @@ module DRb
|
|||||||
end
|
end
|
||||||
raise(DRbConnError, 'connection closed') if str.nil?
|
raise(DRbConnError, 'connection closed') if str.nil?
|
||||||
raise(DRbConnError, 'premature marshal format(can\'t read)') if str.size < sz
|
raise(DRbConnError, 'premature marshal format(can\'t read)') if str.size < sz
|
||||||
|
Thread.exclusive do
|
||||||
begin
|
begin
|
||||||
|
save = Thread.current[:drb_untaint]
|
||||||
|
Thread.current[:drb_untaint] = []
|
||||||
Marshal::load(str)
|
Marshal::load(str)
|
||||||
rescue NameError, ArgumentError
|
rescue NameError, ArgumentError
|
||||||
DRbUnknown.new($!, str)
|
DRbUnknown.new($!, str)
|
||||||
|
ensure
|
||||||
|
Thread.current[:drb_untaint].each do |x|
|
||||||
|
x.untaint
|
||||||
|
end
|
||||||
|
Thread.current[:drb_untaint] = save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -988,8 +997,13 @@ module DRb
|
|||||||
# created to act as a stub for the remote referenced object.
|
# created to act as a stub for the remote referenced object.
|
||||||
def self._load(s)
|
def self._load(s)
|
||||||
uri, ref = Marshal.load(s)
|
uri, ref = Marshal.load(s)
|
||||||
|
|
||||||
if DRb.here?(uri)
|
if DRb.here?(uri)
|
||||||
return DRb.to_obj(ref)
|
obj = DRb.to_obj(ref)
|
||||||
|
if ((! obj.tainted?) && Thread.current[:drb_untaint])
|
||||||
|
Thread.current[:drb_untaint].push(obj)
|
||||||
|
end
|
||||||
|
return obj
|
||||||
end
|
end
|
||||||
|
|
||||||
self.new_with(uri, ref)
|
self.new_with(uri, ref)
|
||||||
|
@ -102,6 +102,15 @@ class TestDRbYield < Test::Unit::TestCase
|
|||||||
@there.xarray_each {|x| assert_kind_of(XArray, x)}
|
@there.xarray_each {|x| assert_kind_of(XArray, x)}
|
||||||
@there.xarray_each {|*x| assert_kind_of(XArray, x[0])}
|
@there.xarray_each {|*x| assert_kind_of(XArray, x[0])}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_06_taint
|
||||||
|
x = proc {}
|
||||||
|
assert(! x.tainted?)
|
||||||
|
@there.echo_yield(x) {|o|
|
||||||
|
assert_equal(x, o)
|
||||||
|
assert(! x.tainted?)
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestRubyYield < TestDRbYield
|
class TestRubyYield < TestDRbYield
|
||||||
|
Loading…
x
Reference in New Issue
Block a user