From 5ee251bdad423b244b7127e609a0bf2fec81e7a3 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Fri, 23 Oct 2009 16:44:41 +0000 Subject: * ext/ext/dl/handle.c (rb_dlhandle_initialize) added rb_secure(2) [ruby-core:25762] * ext/dl/dl.c (rb_dl_dlopen) removed rb_secure(2) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/dl/test_handle.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/dl/test_handle.rb (limited to 'test/dl') diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb new file mode 100644 index 0000000000..d46e16c084 --- /dev/null +++ b/test/dl/test_handle.rb @@ -0,0 +1,27 @@ +require 'test_base' + +module DL + class TestHandle < TestBase + def test_dlopen_returns_handle + assert_instance_of DL::Handle, dlopen(LIBC_SO) + end + + def test_dlopen_safe + assert_raises(SecurityError) do + Thread.new do + $SAFE = 2 + dlopen(LIBC_SO) + end.join + end + end + + def test_initialize_safe + assert_raises(SecurityError) do + Thread.new do + $SAFE = 2 + DL::Handle.new(LIBC_SO) + end.join + end + end + end +end -- cgit v1.2.3