mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/ancdata.c (ancillary_unix_rights): check message type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8746e342bc
commit
2ba6eec1fa
3 changed files with 20 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Feb 28 18:28:58 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/ancdata.c (ancillary_unix_rights): check message type.
|
||||||
|
|
||||||
Sat Feb 28 16:18:39 2009 Tanaka Akira <akr@fsij.org>
|
Sat Feb 28 16:18:39 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* lib/net/http.rb: suppress warnings of non-existing instance variable
|
* lib/net/http.rb: suppress warnings of non-existing instance variable
|
||||||
|
|
|
@ -254,6 +254,14 @@ static VALUE
|
||||||
ancillary_unix_rights(VALUE self)
|
ancillary_unix_rights(VALUE self)
|
||||||
{
|
{
|
||||||
#ifdef SCM_RIGHTS
|
#ifdef SCM_RIGHTS
|
||||||
|
int level, type;
|
||||||
|
|
||||||
|
level = ancillary_level(self);
|
||||||
|
type = ancillary_type(self);
|
||||||
|
|
||||||
|
if (level != SOL_SOCKET || type != SCM_RIGHTS)
|
||||||
|
rb_raise(rb_eTypeError, "SCM_RIGHTS ancillary data expected");
|
||||||
|
|
||||||
VALUE v = rb_attr_get(self, rb_intern("unix_rights"));
|
VALUE v = rb_attr_get(self, rb_intern("unix_rights"));
|
||||||
return v;
|
return v;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -55,4 +55,12 @@ class TestSocketAncData < Test::Unit::TestCase
|
||||||
assert(!ancdata.cmsg_is?(:IP, :PKTINFO))
|
assert(!ancdata.cmsg_is?(:IP, :PKTINFO))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if defined?(Socket::SCM_RIGHTS) && defined?(Socket::SCM_TIMESTAMP)
|
||||||
|
def test_unix_rights
|
||||||
|
assert_raise(TypeError) {
|
||||||
|
Socket::AncillaryData.int(:UNIX, :SOL_SOCKET, :TIMESTAMP, 1).unix_rights
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
end if defined? Socket::AncillaryData
|
end if defined? Socket::AncillaryData
|
||||||
|
|
Loading…
Add table
Reference in a new issue