[IPSEC]: Restrict socket policy loading to CAP_NET_ADMIN.
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 6 Aug 2005 13:33:15 +0000 (06:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 6 Aug 2005 13:33:15 +0000 (06:33 -0700)
The interface needs much redesigning if we wish to allow
normal users to do this in some way.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_sockglue.c
net/ipv6/ipv6_sockglue.c

index fc7c481d0d79378981841ff6989bcaebc0b14f23..ff4bd067b39727c50e4aafdd1cbd49ea0dfd849b 100644 (file)
@@ -848,6 +848,9 @@ mc_msf_out:
  
                case IP_IPSEC_POLICY:
                case IP_XFRM_POLICY:
+                       err = -EPERM;
+                       if (!capable(CAP_NET_ADMIN))
+                               break;
                        err = xfrm_user_policy(sk, optname, optval, optlen);
                        break;
 
index f3ef4c38d315fbdff7786fd04b03d435cff9270c..3bc144a79fa5cf454908b83bd32537139212b54b 100644 (file)
@@ -504,6 +504,9 @@ done:
                break;
        case IPV6_IPSEC_POLICY:
        case IPV6_XFRM_POLICY:
+               retv = -EPERM;
+               if (!capable(CAP_NET_ADMIN))
+                       break;
                retv = xfrm_user_policy(sk, optname, optval, optlen);
                break;