audit: convert all sessionid declaration to unsigned int

Right now the sessionid value in the kernel is a combination of u32,
int, and unsigned int.  Just use unsigned int throughout.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
Eric Paris 2013-11-27 17:35:17 -05:00
parent ff235f51a1
commit 4440e85481
10 changed files with 29 additions and 29 deletions

View File

@ -67,7 +67,7 @@ static void tty_audit_log(const char *description, int major, int minor,
struct task_struct *tsk = current; struct task_struct *tsk = current;
uid_t uid = from_kuid(&init_user_ns, task_uid(tsk)); uid_t uid = from_kuid(&init_user_ns, task_uid(tsk));
uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(tsk)); uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(tsk));
u32 sessionid = audit_get_sessionid(tsk); unsigned int sessionid = audit_get_sessionid(tsk);
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY);
if (ab) { if (ab) {

View File

@ -95,7 +95,7 @@ extern struct group_info init_groups;
#ifdef CONFIG_AUDITSYSCALL #ifdef CONFIG_AUDITSYSCALL
#define INIT_IDS \ #define INIT_IDS \
.loginuid = INVALID_UID, \ .loginuid = INVALID_UID, \
.sessionid = -1, .sessionid = (unsigned int)-1,
#else #else
#define INIT_IDS #define INIT_IDS
#endif #endif

View File

@ -111,7 +111,7 @@ struct cipso_v4_doi;
struct netlbl_audit { struct netlbl_audit {
u32 secid; u32 secid;
kuid_t loginuid; kuid_t loginuid;
u32 sessionid; unsigned int sessionid;
}; };
/* /*

View File

@ -679,7 +679,7 @@ struct xfrm_spi_skb_cb {
struct xfrm_audit { struct xfrm_audit {
u32 secid; u32 secid;
kuid_t loginuid; kuid_t loginuid;
u32 sessionid; unsigned int sessionid;
}; };
#ifdef CONFIG_AUDITSYSCALL #ifdef CONFIG_AUDITSYSCALL
@ -697,7 +697,7 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
return audit_buf; return audit_buf;
} }
static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid, static inline void xfrm_audit_helper_usrinfo(kuid_t auid, unsigned int ses, u32 secid,
struct audit_buffer *audit_buf) struct audit_buffer *audit_buf)
{ {
char *secctx; char *secctx;
@ -714,13 +714,13 @@ static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
} }
extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
kuid_t auid, u32 ses, u32 secid); kuid_t auid, unsigned int ses, u32 secid);
extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
kuid_t auid, u32 ses, u32 secid); kuid_t auid, unsigned int ses, u32 secid);
extern void xfrm_audit_state_add(struct xfrm_state *x, int result, extern void xfrm_audit_state_add(struct xfrm_state *x, int result,
kuid_t auid, u32 ses, u32 secid); kuid_t auid, unsigned int ses, u32 secid);
extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
kuid_t auid, u32 ses, u32 secid); kuid_t auid, unsigned int ses, u32 secid);
extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
struct sk_buff *skb); struct sk_buff *skb);
extern void xfrm_audit_state_replay(struct xfrm_state *x, extern void xfrm_audit_state_replay(struct xfrm_state *x,
@ -733,22 +733,22 @@ extern void xfrm_audit_state_icvfail(struct xfrm_state *x,
#else #else
static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
kuid_t auid, u32 ses, u32 secid) kuid_t auid, unsigned int ses, u32 secid)
{ {
} }
static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
kuid_t auid, u32 ses, u32 secid) kuid_t auid, unsigned int ses, u32 secid)
{ {
} }
static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
kuid_t auid, u32 ses, u32 secid) kuid_t auid, unsigned int ses, u32 secid)
{ {
} }
static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
kuid_t auid, u32 ses, u32 secid) kuid_t auid, unsigned int ses, u32 secid)
{ {
} }

View File

@ -1611,7 +1611,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
void audit_log_session_info(struct audit_buffer *ab) void audit_log_session_info(struct audit_buffer *ab)
{ {
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
uid_t auid = from_kuid(&init_user_ns, audit_get_loginuid(current)); uid_t auid = from_kuid(&init_user_ns, audit_get_loginuid(current));
audit_log_format(ab, " auid=%u ses=%u", auid, sessionid); audit_log_format(ab, " auid=%u ses=%u", auid, sessionid);

View File

@ -1005,7 +1005,7 @@ static void audit_log_rule_change(char *action, struct audit_krule *rule, int re
{ {
struct audit_buffer *ab; struct audit_buffer *ab;
uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(current)); uid_t loginuid = from_kuid(&init_user_ns, audit_get_loginuid(current));
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
if (!audit_enabled) if (!audit_enabled)
return; return;

View File

@ -2011,7 +2011,7 @@ int audit_set_loginuid(kuid_t loginuid)
/* are we setting or clearing? */ /* are we setting or clearing? */
if (uid_valid(loginuid)) if (uid_valid(loginuid))
sessionid = atomic_inc_return(&session_id); sessionid = (unsigned int)atomic_inc_return(&session_id);
task->sessionid = sessionid; task->sessionid = sessionid;
task->loginuid = loginuid; task->loginuid = loginuid;

View File

@ -2899,12 +2899,12 @@ static void xfrm_policy_fini(struct net *net)
flush_work(&net->xfrm.policy_hash_work); flush_work(&net->xfrm.policy_hash_work);
#ifdef CONFIG_XFRM_SUB_POLICY #ifdef CONFIG_XFRM_SUB_POLICY
audit_info.loginuid = INVALID_UID; audit_info.loginuid = INVALID_UID;
audit_info.sessionid = -1; audit_info.sessionid = (unsigned int)-1;
audit_info.secid = 0; audit_info.secid = 0;
xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, &audit_info); xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, &audit_info);
#endif #endif
audit_info.loginuid = INVALID_UID; audit_info.loginuid = INVALID_UID;
audit_info.sessionid = -1; audit_info.sessionid = (unsigned int)-1;
audit_info.secid = 0; audit_info.secid = 0;
xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info); xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info);
@ -3010,7 +3010,7 @@ static void xfrm_audit_common_policyinfo(struct xfrm_policy *xp,
} }
void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
kuid_t auid, u32 sessionid, u32 secid) kuid_t auid, unsigned int sessionid, u32 secid)
{ {
struct audit_buffer *audit_buf; struct audit_buffer *audit_buf;
@ -3025,7 +3025,7 @@ void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
EXPORT_SYMBOL_GPL(xfrm_audit_policy_add); EXPORT_SYMBOL_GPL(xfrm_audit_policy_add);
void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
kuid_t auid, u32 sessionid, u32 secid) kuid_t auid, unsigned int sessionid, u32 secid)
{ {
struct audit_buffer *audit_buf; struct audit_buffer *audit_buf;

View File

@ -2043,7 +2043,7 @@ void xfrm_state_fini(struct net *net)
flush_work(&net->xfrm.state_hash_work); flush_work(&net->xfrm.state_hash_work);
audit_info.loginuid = INVALID_UID; audit_info.loginuid = INVALID_UID;
audit_info.sessionid = -1; audit_info.sessionid = (unsigned int)-1;
audit_info.secid = 0; audit_info.secid = 0;
xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info); xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info);
flush_work(&net->xfrm.state_gc_work); flush_work(&net->xfrm.state_gc_work);
@ -2109,7 +2109,7 @@ static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family,
} }
void xfrm_audit_state_add(struct xfrm_state *x, int result, void xfrm_audit_state_add(struct xfrm_state *x, int result,
kuid_t auid, u32 sessionid, u32 secid) kuid_t auid, unsigned int sessionid, u32 secid)
{ {
struct audit_buffer *audit_buf; struct audit_buffer *audit_buf;
@ -2124,7 +2124,7 @@ void xfrm_audit_state_add(struct xfrm_state *x, int result,
EXPORT_SYMBOL_GPL(xfrm_audit_state_add); EXPORT_SYMBOL_GPL(xfrm_audit_state_add);
void xfrm_audit_state_delete(struct xfrm_state *x, int result, void xfrm_audit_state_delete(struct xfrm_state *x, int result,
kuid_t auid, u32 sessionid, u32 secid) kuid_t auid, unsigned int sessionid, u32 secid)
{ {
struct audit_buffer *audit_buf; struct audit_buffer *audit_buf;

View File

@ -600,7 +600,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
int err; int err;
struct km_event c; struct km_event c;
kuid_t loginuid = audit_get_loginuid(current); kuid_t loginuid = audit_get_loginuid(current);
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
u32 sid; u32 sid;
err = verify_newsa_info(p, attrs); err = verify_newsa_info(p, attrs);
@ -679,7 +679,7 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
struct km_event c; struct km_event c;
struct xfrm_usersa_id *p = nlmsg_data(nlh); struct xfrm_usersa_id *p = nlmsg_data(nlh);
kuid_t loginuid = audit_get_loginuid(current); kuid_t loginuid = audit_get_loginuid(current);
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
u32 sid; u32 sid;
x = xfrm_user_state_lookup(net, p, attrs, &err); x = xfrm_user_state_lookup(net, p, attrs, &err);
@ -1405,7 +1405,7 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
int err; int err;
int excl; int excl;
kuid_t loginuid = audit_get_loginuid(current); kuid_t loginuid = audit_get_loginuid(current);
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
u32 sid; u32 sid;
err = verify_newpolicy_info(p); err = verify_newpolicy_info(p);
@ -1663,7 +1663,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
} }
} else { } else {
kuid_t loginuid = audit_get_loginuid(current); kuid_t loginuid = audit_get_loginuid(current);
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
u32 sid; u32 sid;
security_task_getsecid(current, &sid); security_task_getsecid(current, &sid);
@ -1959,7 +1959,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
err = 0; err = 0;
if (up->hard) { if (up->hard) {
kuid_t loginuid = audit_get_loginuid(current); kuid_t loginuid = audit_get_loginuid(current);
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
u32 sid; u32 sid;
security_task_getsecid(current, &sid); security_task_getsecid(current, &sid);
@ -2002,7 +2002,7 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh,
if (ue->hard) { if (ue->hard) {
kuid_t loginuid = audit_get_loginuid(current); kuid_t loginuid = audit_get_loginuid(current);
u32 sessionid = audit_get_sessionid(current); unsigned int sessionid = audit_get_sessionid(current);
u32 sid; u32 sid;
security_task_getsecid(current, &sid); security_task_getsecid(current, &sid);