mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/ancdata.c (anc_inspect_passcred_credentials): new
function to show SCM_CREDENTIALS on GNU/Linux. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
25d14edf29
commit
a23547cafa
2 changed files with 25 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Feb 8 18:46:15 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/ancdata.c (anc_inspect_passcred_credentials): new
|
||||||
|
function to show SCM_CREDENTIALS on GNU/Linux.
|
||||||
|
|
||||||
Sun Feb 8 18:34:43 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Feb 8 18:34:43 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (rb_io_s_binread): ensures file path. [ruby-dev:37940]
|
* io.c (rb_io_s_binread): ensures file path. [ruby-dev:37940]
|
||||||
|
|
|
@ -376,6 +376,23 @@ anc_inspect_socket_rights(int level, int type, VALUE data, VALUE ret)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SCM_CREDENTIALS) /* GNU/Linux */
|
||||||
|
static int
|
||||||
|
anc_inspect_passcred_credentials(int level, int type, VALUE data, VALUE ret)
|
||||||
|
{
|
||||||
|
if (level == SOL_SOCKET && type == SCM_CREDENTIALS &&
|
||||||
|
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);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(IPPROTO_IP) && defined(IP_RECVDSTADDR) /* 4.4BSD */
|
#if defined(IPPROTO_IP) && defined(IP_RECVDSTADDR) /* 4.4BSD */
|
||||||
static int
|
static int
|
||||||
anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret)
|
anc_inspect_ip_recvdstaddr(int level, int type, VALUE data, VALUE ret)
|
||||||
|
@ -496,6 +513,9 @@ ancillary_inspect(VALUE self)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
# if defined(SCM_RIGHTS) /* 4.4BSD */
|
# if defined(SCM_RIGHTS) /* 4.4BSD */
|
||||||
case SCM_RIGHTS: if (anc_inspect_socket_rights(level, type, data, ret) == -1) goto dump; break;
|
case SCM_RIGHTS: if (anc_inspect_socket_rights(level, type, data, ret) == -1) goto dump; break;
|
||||||
|
# endif
|
||||||
|
# if defined(SCM_CREDENTIALS) /* GNU/Linux */
|
||||||
|
case SCM_CREDENTIALS: if (anc_inspect_passcred_credentials(level, type, data, ret) == -1) goto dump; break;
|
||||||
# endif
|
# endif
|
||||||
default: goto dump;
|
default: goto dump;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue