1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/socket/option.c (inspect_peercred): struct ucred contains

effective uid/gid.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-02-08 17:04:40 +00:00
parent 0fe7022c0b
commit 64f12a46d5
3 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Mon Feb 9 02:04:03 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/option.c (inspect_peercred): struct ucred contains
effective uid/gid.
Mon Feb 9 00:44:45 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/option.c (sockopt_inspect): add ifdef guard for

View file

@ -246,7 +246,7 @@ inspect_peercred(int level, int optname, VALUE data, VALUE ret)
if (RSTRING_LEN(data) == sizeof(struct ucred)) {
struct ucred cred;
memcpy(&cred, RSTRING_PTR(data), sizeof(struct ucred));
rb_str_catf(ret, " pid=%u uid=%u gid=%u", cred.pid, cred.uid, cred.gid);
rb_str_catf(ret, " pid=%u euid=%u egid=%u", cred.pid, cred.uid, cred.gid);
rb_str_cat2(ret, " (ucred)");
return 0;
}

View file

@ -306,8 +306,8 @@ class TestUNIXSocket < Test::Unit::TestCase
cred = s.getsockopt(:SOCKET, :PEERCRED)
inspect = cred.inspect
assert_match(/ pid=#{$$} /, inspect)
assert_match(/ uid=#{Process.uid} /, inspect)
assert_match(/ gid=#{Process.gid} /, inspect)
assert_match(/ euid=#{Process.euid} /, inspect)
assert_match(/ egid=#{Process.egid} /, inspect)
assert_match(/ \(ucred\)/, inspect)
}
end