Subject: [PATCH][LSM] remove net related includes from security.h

From: Arnaldo Carvalho de Melo <[email-masked]>
Date: Tue, 19 Oct 2004 15:21:51 -0300

Hi Chris,

	As discussed on irc.

Best Regards,

- Arnaldo
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================

[email-masked], 2004-10-19 15:00:01-03:00, [email-masked]
  [LSM] remove net related includes from security.h
  
  With this we're back to the times when changing skbuff.h
  only triggers rebuild of _net_ related stuff 8)
  
  This uncovered a bug in rmap.h, that was not including
  mm.h to get the definition of struct vm_area_struct,
  working by luck.
  
  Signed-off-by: Arnaldo Carvalho de Melo <[email-masked]>
  Signed-off-by: Chris Wright <[email-masked]>

 include/linux/rmap.h     |    1 +
 include/linux/security.h |   20 +++++++-------------
 security/commoncap.c     |   17 +++++++++++++++++
 3 files changed, 25 insertions(+), 13 deletions(-)

diff -Nru a/include/linux/rmap.h b/include/linux/rmap.h
--- a/include/linux/rmap.h	2004-10-19 15:19:36 -03:00
+++ b/include/linux/rmap.h	2004-10-19 15:19:36 -03:00
@@ -7,6 +7,7 @@
 #include <linux/config.h>
 #include <linux/list.h>
 #include <linux/slab.h>
+#include <linux/mm.h>
 #include <linux/spinlock.h>
 
 /*
diff -Nru a/include/linux/security.h b/include/linux/security.h
--- a/include/linux/security.h	2004-10-19 15:19:36 -03:00
+++ b/include/linux/security.h	2004-10-19 15:19:36 -03:00
@@ -31,8 +31,6 @@
 #include <linux/shm.h>
 #include <linux/msg.h>
 #include <linux/sched.h>
-#include <linux/skbuff.h>
-#include <linux/netlink.h>
 
 /*
  * These functions are in security/capability.c and are used
@@ -53,18 +51,14 @@
 extern int cap_syslog (int type);
 extern int cap_vm_enough_memory (long pages);
 
-static inline int cap_netlink_send (struct sock *sk, struct sk_buff *skb)
-{
-	NETLINK_CB (skb).eff_cap = current->cap_effective;
-	return 0;
-}
+struct msghdr;
+struct sk_buff;
+struct sock;
+struct sockaddr;
+struct socket;
 
-static inline int cap_netlink_recv (struct sk_buff *skb)
-{
-	if (!cap_raised (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN))
-		return -EPERM;
-	return 0;
-}
+extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
+extern int cap_netlink_recv(struct sk_buff *skb);
 
 /*
  * Values used in the task_security_ops calls
diff -Nru a/security/commoncap.c b/security/commoncap.c
--- a/security/commoncap.c	2004-10-19 15:19:36 -03:00
+++ b/security/commoncap.c	2004-10-19 15:19:36 -03:00
@@ -24,6 +24,23 @@
 #include <linux/xattr.h>
 #include <linux/hugetlb.h>
 
+int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
+{
+	NETLINK_CB(skb).eff_cap = current->cap_effective;
+	return 0;
+}
+
+EXPORT_SYMBOL(cap_netlink_send);
+
+int cap_netlink_recv(struct sk_buff *skb)
+{
+	if (!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN))
+		return -EPERM;
+	return 0;
+}
+
+EXPORT_SYMBOL(cap_netlink_recv);
+
 int cap_capable (struct task_struct *tsk, int cap)
 {
 	/* Derived from include/linux/sched.h:capable. */

===================================================================

This BitKeeper patch contains the following changesets:
1.2119
## Wrapped with gzip_uu ##

=&M3H_M\@,E5R6C?%9A &@P%-./D/)"G3TW$1