[Bluetooth] Fix reference count when connection lookup fails
[pandora-kernel.git] / security / dummy.c
index 310fcdf..43874c1 100644 (file)
@@ -15,7 +15,6 @@
 #undef DEBUG
 
 #include <linux/capability.h>
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/mman.h>
@@ -506,6 +505,9 @@ static int dummy_task_getsid (struct task_struct *p)
        return 0;
 }
 
+static void dummy_task_getsecid (struct task_struct *p, u32 *secid)
+{ }
+
 static int dummy_task_setgroups (struct group_info *group_info)
 {
        return 0;
@@ -521,6 +523,11 @@ static int dummy_task_setioprio (struct task_struct *p, int ioprio)
        return 0;
 }
 
+static int dummy_task_getioprio (struct task_struct *p)
+{
+       return 0;
+}
+
 static int dummy_task_setrlimit (unsigned int resource, struct rlimit *new_rlim)
 {
        return 0;
@@ -548,7 +555,7 @@ static int dummy_task_wait (struct task_struct *p)
 }
 
 static int dummy_task_kill (struct task_struct *p, struct siginfo *info,
-                           int sig)
+                           int sig, u32 secid)
 {
        return 0;
 }
@@ -675,9 +682,9 @@ static int dummy_netlink_send (struct sock *sk, struct sk_buff *skb)
        return 0;
 }
 
-static int dummy_netlink_recv (struct sk_buff *skb)
+static int dummy_netlink_recv (struct sk_buff *skb, int cap)
 {
-       if (!cap_raised (NETLINK_CB (skb).eff_cap, CAP_NET_ADMIN))
+       if (!cap_raised (NETLINK_CB (skb).eff_cap, cap))
                return -EPERM;
        return 0;
 }
@@ -702,10 +709,10 @@ static int dummy_socket_create (int family, int type,
        return 0;
 }
 
-static void dummy_socket_post_create (struct socket *sock, int family, int type,
-                                     int protocol, int kern)
+static int dummy_socket_post_create (struct socket *sock, int family, int type,
+                                    int protocol, int kern)
 {
-       return;
+       return 0;
 }
 
 static int dummy_socket_bind (struct socket *sock, struct sockaddr *address,
@@ -784,8 +791,7 @@ static int dummy_socket_getpeersec_stream(struct socket *sock, char __user *optv
        return -ENOPROTOOPT;
 }
 
-static int dummy_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata,
-                                        u32 *seclen)
+static int dummy_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
 {
        return -ENOPROTOOPT;
 }
@@ -799,14 +805,38 @@ static inline void dummy_sk_free_security (struct sock *sk)
 {
 }
 
-static unsigned int dummy_sk_getsid(struct sock *sk, struct flowi *fl, u8 dir)
+static inline void dummy_sk_clone_security (const struct sock *sk, struct sock *newsk)
+{
+}
+
+static inline void dummy_sk_getsecid(struct sock *sk, u32 *secid)
+{
+}
+
+static inline void dummy_sock_graft(struct sock* sk, struct socket *parent)
+{
+}
+
+static inline int dummy_inet_conn_request(struct sock *sk,
+                       struct sk_buff *skb, struct request_sock *req)
 {
        return 0;
 }
+
+static inline void dummy_inet_csk_clone(struct sock *newsk,
+                       const struct request_sock *req)
+{
+}
+
+static inline void dummy_req_classify_flow(const struct request_sock *req,
+                       struct flowi *fl)
+{
+}
 #endif /* CONFIG_SECURITY_NETWORK */
 
 #ifdef CONFIG_SECURITY_NETWORK_XFRM
-static int dummy_xfrm_policy_alloc_security(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
+static int dummy_xfrm_policy_alloc_security(struct xfrm_policy *xp,
+               struct xfrm_user_sec_ctx *sec_ctx, struct sock *sk)
 {
        return 0;
 }
@@ -825,7 +855,8 @@ static int dummy_xfrm_policy_delete_security(struct xfrm_policy *xp)
        return 0;
 }
 
-static int dummy_xfrm_state_alloc_security(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx)
+static int dummy_xfrm_state_alloc_security(struct xfrm_state *x,
+       struct xfrm_user_sec_ctx *sec_ctx, struct xfrm_sec_ctx *pol, u32 secid)
 {
        return 0;
 }
@@ -843,6 +874,24 @@ static int dummy_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir)
 {
        return 0;
 }
+
+static int dummy_xfrm_state_pol_flow_match(struct xfrm_state *x,
+                               struct xfrm_policy *xp, struct flowi *fl)
+{
+       return 1;
+}
+
+static int dummy_xfrm_flow_state_match(struct flowi *fl, struct xfrm_state *xfrm,
+                               struct xfrm_policy *xp)
+{
+       return 1;
+}
+
+static int dummy_xfrm_decode_session(struct sk_buff *skb, u32 *fl, int ckall)
+{
+       return 0;
+}
+
 #endif /* CONFIG_SECURITY_NETWORK_XFRM */
 static int dummy_register_security (const char *name, struct security_operations *ops)
 {
@@ -869,6 +918,15 @@ static int dummy_setprocattr(struct task_struct *p, char *name, void *value, siz
        return -EINVAL;
 }
 
+static int dummy_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
+{
+       return -EOPNOTSUPP;
+}
+
+static void dummy_release_secctx(char *secdata, u32 seclen)
+{
+}
+
 #ifdef CONFIG_KEYS
 static inline int dummy_key_alloc(struct key *key, struct task_struct *ctx,
                                  unsigned long flags)
@@ -981,9 +1039,11 @@ void security_fixup_ops (struct security_operations *ops)
        set_to_dummy_if_null(ops, task_setpgid);
        set_to_dummy_if_null(ops, task_getpgid);
        set_to_dummy_if_null(ops, task_getsid);
+       set_to_dummy_if_null(ops, task_getsecid);
        set_to_dummy_if_null(ops, task_setgroups);
        set_to_dummy_if_null(ops, task_setnice);
        set_to_dummy_if_null(ops, task_setioprio);
+       set_to_dummy_if_null(ops, task_getioprio);
        set_to_dummy_if_null(ops, task_setrlimit);
        set_to_dummy_if_null(ops, task_setscheduler);
        set_to_dummy_if_null(ops, task_getscheduler);
@@ -1019,6 +1079,8 @@ void security_fixup_ops (struct security_operations *ops)
        set_to_dummy_if_null(ops, d_instantiate);
        set_to_dummy_if_null(ops, getprocattr);
        set_to_dummy_if_null(ops, setprocattr);
+       set_to_dummy_if_null(ops, secid_to_secctx);
+       set_to_dummy_if_null(ops, release_secctx);
 #ifdef CONFIG_SECURITY_NETWORK
        set_to_dummy_if_null(ops, unix_stream_connect);
        set_to_dummy_if_null(ops, unix_may_send);
@@ -1041,7 +1103,12 @@ void security_fixup_ops (struct security_operations *ops)
        set_to_dummy_if_null(ops, socket_getpeersec_dgram);
        set_to_dummy_if_null(ops, sk_alloc_security);
        set_to_dummy_if_null(ops, sk_free_security);
-       set_to_dummy_if_null(ops, sk_getsid);
+       set_to_dummy_if_null(ops, sk_clone_security);
+       set_to_dummy_if_null(ops, sk_getsecid);
+       set_to_dummy_if_null(ops, sock_graft);
+       set_to_dummy_if_null(ops, inet_conn_request);
+       set_to_dummy_if_null(ops, inet_csk_clone);
+       set_to_dummy_if_null(ops, req_classify_flow);
  #endif        /* CONFIG_SECURITY_NETWORK */
 #ifdef  CONFIG_SECURITY_NETWORK_XFRM
        set_to_dummy_if_null(ops, xfrm_policy_alloc_security);
@@ -1052,6 +1119,9 @@ void security_fixup_ops (struct security_operations *ops)
        set_to_dummy_if_null(ops, xfrm_state_free_security);
        set_to_dummy_if_null(ops, xfrm_state_delete_security);
        set_to_dummy_if_null(ops, xfrm_policy_lookup);
+       set_to_dummy_if_null(ops, xfrm_state_pol_flow_match);
+       set_to_dummy_if_null(ops, xfrm_flow_state_match);
+       set_to_dummy_if_null(ops, xfrm_decode_session);
 #endif /* CONFIG_SECURITY_NETWORK_XFRM */
 #ifdef CONFIG_KEYS
        set_to_dummy_if_null(ops, key_alloc);