Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4d3fb709
Commit
4d3fb709
authored
Apr 30, 2013
by
Eric Paris
Committed by
Eric Paris
Apr 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
helper for some session id stuff
parent
b122c376
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
include/linux/audit.h
include/linux/audit.h
+2
-0
kernel/audit.c
kernel/audit.c
+12
-8
No files found.
include/linux/audit.h
View file @
4d3fb709
...
@@ -89,6 +89,8 @@ extern int audit_classify_arch(int arch);
...
@@ -89,6 +89,8 @@ extern int audit_classify_arch(int arch);
struct
filename
;
struct
filename
;
extern
void
audit_log_session_info
(
struct
audit_buffer
*
ab
);
#ifdef CONFIG_AUDITSYSCALL
#ifdef CONFIG_AUDITSYSCALL
/* These are defined in auditsc.c */
/* These are defined in auditsc.c */
/* Public API */
/* Public API */
...
...
kernel/audit.c
View file @
4d3fb709
...
@@ -269,14 +269,12 @@ static int audit_log_config_change(char *function_name, int new, int old,
...
@@ -269,14 +269,12 @@ static int audit_log_config_change(char *function_name, int new, int old,
{
{
struct
audit_buffer
*
ab
;
struct
audit_buffer
*
ab
;
int
rc
=
0
;
int
rc
=
0
;
u32
sessionid
=
audit_get_sessionid
(
current
);
uid_t
auid
=
from_kuid
(
&
init_user_ns
,
audit_get_loginuid
(
current
));
ab
=
audit_log_start
(
NULL
,
GFP_KERNEL
,
AUDIT_CONFIG_CHANGE
);
ab
=
audit_log_start
(
NULL
,
GFP_KERNEL
,
AUDIT_CONFIG_CHANGE
);
if
(
unlikely
(
!
ab
))
if
(
unlikely
(
!
ab
))
return
rc
;
return
rc
;
audit_log_format
(
ab
,
"%s=%d old=%d
auid=%u ses=%u"
,
function_name
,
new
,
audit_log_format
(
ab
,
"%s=%d old=%d
"
,
function_name
,
new
,
old
);
old
,
auid
,
sessionid
);
audit_log_session_info
(
ab
);
rc
=
audit_log_task_context
(
ab
);
rc
=
audit_log_task_context
(
ab
);
if
(
rc
)
if
(
rc
)
allow_changes
=
0
;
/* Something weird, deny request */
allow_changes
=
0
;
/* Something weird, deny request */
...
@@ -611,9 +609,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
...
@@ -611,9 +609,7 @@ static int audit_netlink_ok(struct sk_buff *skb, u16 msg_type)
static
int
audit_log_common_recv_msg
(
struct
audit_buffer
**
ab
,
u16
msg_type
)
static
int
audit_log_common_recv_msg
(
struct
audit_buffer
**
ab
,
u16
msg_type
)
{
{
int
rc
=
0
;
int
rc
=
0
;
u32
sessionid
=
audit_get_sessionid
(
current
);
uid_t
uid
=
from_kuid
(
&
init_user_ns
,
current_uid
());
uid_t
uid
=
from_kuid
(
&
init_user_ns
,
current_uid
());
uid_t
auid
=
from_kuid
(
&
init_user_ns
,
audit_get_loginuid
(
current
));
if
(
!
audit_enabled
)
{
if
(
!
audit_enabled
)
{
*
ab
=
NULL
;
*
ab
=
NULL
;
...
@@ -623,8 +619,8 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)
...
@@ -623,8 +619,8 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type)
*
ab
=
audit_log_start
(
NULL
,
GFP_KERNEL
,
msg_type
);
*
ab
=
audit_log_start
(
NULL
,
GFP_KERNEL
,
msg_type
);
if
(
unlikely
(
!*
ab
))
if
(
unlikely
(
!*
ab
))
return
rc
;
return
rc
;
audit_log_format
(
*
ab
,
"pid=%d uid=%u
auid=%u ses=%u"
,
audit_log_format
(
*
ab
,
"pid=%d uid=%u
"
,
task_tgid_vnr
(
current
),
uid
);
task_tgid_vnr
(
current
),
uid
,
auid
,
sessionid
);
audit_log_session_info
(
*
ab
);
audit_log_task_context
(
*
ab
);
audit_log_task_context
(
*
ab
);
return
rc
;
return
rc
;
...
@@ -1376,6 +1372,14 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
...
@@ -1376,6 +1372,14 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
kfree
(
pathname
);
kfree
(
pathname
);
}
}
void
audit_log_session_info
(
struct
audit_buffer
*
ab
)
{
u32
sessionid
=
audit_get_sessionid
(
current
);
uid_t
auid
=
from_kuid
(
&
init_user_ns
,
audit_get_loginuid
(
current
));
audit_log_format
(
ab
,
"auid=%u ses=%u
\n
"
,
auid
,
sessionid
);
}
void
audit_log_key
(
struct
audit_buffer
*
ab
,
char
*
key
)
void
audit_log_key
(
struct
audit_buffer
*
ab
,
char
*
key
)
{
{
audit_log_format
(
ab
,
" key="
);
audit_log_format
(
ab
,
" key="
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment