* ext/socket/option.c (inspect_local_peercred): cr_uid is a effective

uid, not a real uid.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-02-08 15:42:17 +00:00
Родитель 9e45748143
Коммит f11d2b55f7
3 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Mon Feb 9 00:37:06 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/option.c (inspect_local_peercred): cr_uid is a effective
uid, not a real uid.
Mon Feb 9 00:30:56 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/extconf.rb: check sys/param.h and sys/ucred.h.

Просмотреть файл

@ -264,7 +264,7 @@ inspect_local_peercred(int level, int optname, VALUE data, VALUE ret)
struct xucred cred;
memcpy(&cred, RSTRING_PTR(data), sizeof(struct xucred));
rb_str_catf(ret, " version=%u", cred.cr_version);
rb_str_catf(ret, " uid=%u", cred.cr_uid);
rb_str_catf(ret, " euid=%u", cred.cr_uid);
if (cred.cr_ngroups) {
int i;
char *sep = " groups=";

Просмотреть файл

@ -321,7 +321,7 @@ class TestUNIXSocket < Test::Unit::TestCase
s, = serv.accept
cred = s.getsockopt(0, Socket::LOCAL_PEERCRED)
inspect = cred.inspect
assert_match(/ uid=#{Process.uid} /, inspect)
assert_match(/ euid=#{Process.euid} /, inspect)
assert_match(/ \(xucred\)/, inspect)
}
end