Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 88452
b: refs/heads/master
c: 3e11217
h: refs/heads/master
v: v3
  • Loading branch information
Paul Moore authored and James Morris committed Apr 18, 2008
1 parent 177f5b0 commit 9177876
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 832cbd9aa1293cba57d06571f5fc8f0917c672af
refs/heads/master: 3e11217263d0521e212cb8a017fbc2a1514db78f
1 change: 1 addition & 0 deletions trunk/security/selinux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ selinux-y := avc.o \
nlmsgtab.o \
netif.o \
netnode.o \
netport.o \
exports.o

selinux-$(CONFIG_SECURITY_NETWORK_XFRM) += xfrm.o
Expand Down
20 changes: 8 additions & 12 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include "objsec.h"
#include "netif.h"
#include "netnode.h"
#include "netport.h"
#include "xfrm.h"
#include "netlabel.h"

Expand Down Expand Up @@ -3670,10 +3671,8 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in
inet_get_local_port_range(&low, &high);

if (snum < max(PROT_SOCK, low) || snum > high) {
err = security_port_sid(sk->sk_family,
sk->sk_type,
sk->sk_protocol, snum,
&sid);
err = sel_netport_sid(sk->sk_protocol,
snum, &sid);
if (err)
goto out;
AVC_AUDIT_DATA_INIT(&ad,NET);
Expand Down Expand Up @@ -3761,8 +3760,7 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address,
snum = ntohs(addr6->sin6_port);
}

err = security_port_sid(sk->sk_family, sk->sk_type,
sk->sk_protocol, snum, &sid);
err = sel_netport_sid(sk->sk_protocol, snum, &sid);
if (err)
goto out;

Expand Down Expand Up @@ -3993,9 +3991,8 @@ static int selinux_sock_rcv_skb_iptables_compat(struct sock *sk,

if (!recv_perm)
return 0;
err = security_port_sid(sk->sk_family, sk->sk_type,
sk->sk_protocol, ntohs(ad->u.net.sport),
&port_sid);
err = sel_netport_sid(sk->sk_protocol,
ntohs(ad->u.net.sport), &port_sid);
if (unlikely(err)) {
printk(KERN_WARNING
"SELinux: failure in"
Expand Down Expand Up @@ -4416,9 +4413,8 @@ static int selinux_ip_postroute_iptables_compat(struct sock *sk,
if (send_perm != 0)
return 0;

err = security_port_sid(sk->sk_family, sk->sk_type,
sk->sk_protocol, ntohs(ad->u.net.dport),
&port_sid);
err = sel_netport_sid(sk->sk_protocol,
ntohs(ad->u.net.dport), &port_sid);
if (unlikely(err)) {
printk(KERN_WARNING
"SELinux: failure in"
Expand Down
6 changes: 6 additions & 0 deletions trunk/security/selinux/include/objsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ struct netnode_security_struct {
u16 family; /* address family */
};

struct netport_security_struct {
u32 sid; /* SID for this node */
u16 port; /* port number */
u8 protocol; /* transport protocol */
};

struct sk_security_struct {
u32 sid; /* SID of this object */
u32 peer_sid; /* SID of peer */
Expand Down
3 changes: 1 addition & 2 deletions trunk/security/selinux/include/security.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ int security_context_to_sid_default(char *scontext, u32 scontext_len,
int security_get_user_sids(u32 callsid, char *username,
u32 **sids, u32 *nel);

int security_port_sid(u16 domain, u16 type, u8 protocol, u16 port,
u32 *out_sid);
int security_port_sid(u8 protocol, u16 port, u32 *out_sid);

int security_netif_sid(char *name, u32 *if_sid);

Expand Down
8 changes: 1 addition & 7 deletions trunk/security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -1472,17 +1472,11 @@ int security_load_policy(void *data, size_t len)

/**
* security_port_sid - Obtain the SID for a port.
* @domain: communication domain aka address family
* @type: socket type
* @protocol: protocol number
* @port: port number
* @out_sid: security identifier
*/
int security_port_sid(u16 domain,
u16 type,
u8 protocol,
u16 port,
u32 *out_sid)
int security_port_sid(u8 protocol, u16 port, u32 *out_sid)
{
struct ocontext *c;
int rc = 0;
Expand Down

0 comments on commit 9177876

Please sign in to comment.