diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-08 11:36:18 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-08 11:36:18 +0000 |
commit | 308dec40149271d2807ef1e3939368ffddf49b31 (patch) | |
tree | 058f5230a9b4ad1471ccaaf297b66c19fb3059bc /test/socket | |
parent | 77d394ce2a52aef4ad69d875b235e66507f8ae5f (diff) | |
download | ruby-308dec40149271d2807ef1e3939368ffddf49b31.tar.gz ruby-308dec40149271d2807ef1e3939368ffddf49b31.tar.xz ruby-308dec40149271d2807ef1e3939368ffddf49b31.zip |
* ext/socket/extconf.rb: check struct sockcred.
* ext/socket/ancdata.c (anc_inspect_socket_creds): new function to
show SCM_CREDS on NetBSD.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/socket')
-rw-r--r-- | test/socket/test_unix.rb | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb index e783faff3..4d6aa23e4 100644 --- a/test/socket/test_unix.rb +++ b/test/socket/test_unix.rb @@ -306,11 +306,28 @@ class TestUNIXSocket < Test::Unit::TestCase s.setsockopt(:SOCKET, :PASSCRED, 1) c.print "a" msg, cliend_ai, rflags, cred = s.recvmsg - p cred assert_equal("a", msg) - assert_match(/pid=#{$$} /, cred.inspect) - assert_match(/uid=#{Process.uid} /, cred.inspect) - assert_match(/gid=#{Process.gid}>/, cred.inspect) + assert_match(/ pid=#{$$} /, cred.inspect) + assert_match(/ uid=#{Process.uid} /, cred.inspect) + assert_match(/ gid=#{Process.gid}>/, cred.inspect) + } + end + + def test_netbsd_cred + return if /netbsd/ !~ RUBY_PLATFORM + Dir.mktmpdir {|d| + sockpath = "#{d}/sock" + serv = Socket.unix_server_socket(sockpath) + c = Socket.unix(sockpath) + s, = serv.accept + s.setsockopt(0, Socket::LOCAL_CREDS, 1) + c.print "a" + msg, cliend_ai, rflags, cred = s.recvmsg + assert_equal("a", msg) + assert_match(/ uid=#{Process.uid} /, cred.inspect) + assert_match(/ euid=#{Process.euid} /, cred.inspect) + assert_match(/ gid=#{Process.gid} /, cred.inspect) + assert_match(/ egid=#{Process.egid} /, cred.inspect) } end |