libsemanage: Include user name in ROLE_REMOVE audit events
Use "previous" user name when no new user is available in semanage_seuser_audit. Otherwise "id=0" is logged instead of "acct=user_name" ("id=0" is hard coded value). Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1622045
This commit is contained in:
parent
70b9658d8c
commit
343442e99b
1 changed files with 6 additions and 5 deletions
|
@ -71,17 +71,18 @@ static int semanage_seuser_audit(semanage_handle_t * handle,
|
|||
const char *sep = "-";
|
||||
int rc = -1;
|
||||
strcpy(msg, "login");
|
||||
if (previous) {
|
||||
name = semanage_seuser_get_name(seuser);
|
||||
psename = semanage_seuser_get_sename(previous);
|
||||
pmls = semanage_seuser_get_mlsrange(previous);
|
||||
proles = semanage_user_roles(handle, psename);
|
||||
}
|
||||
if (seuser) {
|
||||
name = semanage_seuser_get_name(seuser);
|
||||
sename = semanage_seuser_get_sename(seuser);
|
||||
mls = semanage_seuser_get_mlsrange(seuser);
|
||||
roles = semanage_user_roles(handle, sename);
|
||||
}
|
||||
if (previous) {
|
||||
psename = semanage_seuser_get_sename(previous);
|
||||
pmls = semanage_seuser_get_mlsrange(previous);
|
||||
proles = semanage_user_roles(handle, psename);
|
||||
}
|
||||
if (audit_type != AUDIT_ROLE_REMOVE) {
|
||||
if (sename && (!psename || strcmp(psename, sename) != 0)) {
|
||||
strcat(msg,sep);
|
||||
|
|
Loading…
Reference in a new issue