* Only allow raw sockets for root.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37843 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-08-02 14:18:26 +00:00
parent 8e855d520a
commit cb8adf5ed2

View File

@ -1034,6 +1034,10 @@ ipv4_open(net_protocol* _protocol)
{ {
ipv4_protocol* protocol = (ipv4_protocol*)_protocol; ipv4_protocol* protocol = (ipv4_protocol*)_protocol;
// Only root may open raw sockets
if (geteuid() != 0)
return B_NOT_ALLOWED;
RawSocket* raw = new (std::nothrow) RawSocket(protocol->socket); RawSocket* raw = new (std::nothrow) RawSocket(protocol->socket);
if (raw == NULL) if (raw == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;