summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-08 15:37:55 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-08 15:37:55 +0000
commit9548a8f9c5eba7ee3667e96f036021be3b9238ba (patch)
tree4d300dde5220bac968cac17be6ccbd103e7b8edc /test
parent60b5c4d97eb5b277dad4054a34253cb6e75bcd78 (diff)
downloadruby-9548a8f9c5eba7ee3667e96f036021be3b9238ba.tar.gz
ruby-9548a8f9c5eba7ee3667e96f036021be3b9238ba.tar.xz
ruby-9548a8f9c5eba7ee3667e96f036021be3b9238ba.zip
* ext/socket/extconf.rb: check sys/param.h and sys/ucred.h.
* ext/socket/rubysocket.h: include sys/param.h and sys/ucred.h. * ext/socket/option.c (inspect_local_peercred): new function to show LOCAL_PEERCRED socket option on FreeBSD. (sockopt_inspect): show as LOCAL_* socket option if AF_UNIX and level is 0. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/socket/test_unix.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index d05fd15a9..6799e52fd 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -312,6 +312,20 @@ class TestUNIXSocket < Test::Unit::TestCase
}
end
+ def test_getcred_xucred
+ return if /freebsd/ !~ RUBY_PLATFORM
+ Dir.mktmpdir {|d|
+ sockpath = "#{d}/sock"
+ serv = Socket.unix_server_socket(sockpath)
+ c = Socket.unix(sockpath)
+ s, = serv.accept
+ cred = s.getsockopt(0, Socket::LOCAL_PEERCRED)
+ inspect = cred.inspect
+ assert_match(/ uid=#{Process.uid} /, inspect)
+ assert_match(/ \(xucred\)/, inspect)
+ }
+ end
+
def test_sendcred_ucred
return if /linux/ !~ RUBY_PLATFORM
Dir.mktmpdir {|d|