Do not fail on missing SELinux User Record when adding login record

This commit is contained in:
Dan Walsh 2013-09-25 12:46:19 -04:00
parent a7e3a97407
commit 2a9c9b49a7
2 changed files with 10 additions and 11 deletions

View File

@ -199,10 +199,10 @@ index 57ef49f..4b040c3 100644
return retval; return retval;
} }
diff --git a/libsemanage/src/seuser_record.c b/libsemanage/src/seuser_record.c diff --git a/libsemanage/src/seuser_record.c b/libsemanage/src/seuser_record.c
index 8823b1e..d92633e 100644 index 8823b1e..cfcd039 100644
--- a/libsemanage/src/seuser_record.c --- a/libsemanage/src/seuser_record.c
+++ b/libsemanage/src/seuser_record.c +++ b/libsemanage/src/seuser_record.c
@@ -140,19 +140,50 @@ const char *semanage_seuser_get_sename(const semanage_seuser_t * seuser) @@ -140,19 +140,46 @@ const char *semanage_seuser_get_sename(const semanage_seuser_t * seuser)
hidden_def(semanage_seuser_get_sename) hidden_def(semanage_seuser_get_sename)
@ -234,15 +234,11 @@ index 8823b1e..d92633e 100644
+ semanage_user_key_free(key); + semanage_user_key_free(key);
+ if (rc == STATUS_ERR) + if (rc == STATUS_ERR)
+ goto err; + goto err;
+ else if (rc == STATUS_NODATA) { + else if (rc == STATUS_SUCCESS) {
+ ERR(handle, "SELinux user %s does not exist", sename); + mls_range = semanage_user_get_mlsrange(u);
+ errno = EINVAL; + semanage_seuser_set_mlsrange(handle, seuser, mls_range);
+ rc = STATUS_ERR; + semanage_user_free(u);
+ goto err;
+ } + }
+ mls_range = semanage_user_get_mlsrange(u);
+ semanage_seuser_set_mlsrange(handle, seuser, mls_range);
+ semanage_user_free(u);
+ } + }
free(seuser->sename); free(seuser->sename);
seuser->sename = tmp_sename; seuser->sename = tmp_sename;

View File

@ -7,7 +7,7 @@
Summary: SELinux binary policy manipulation library Summary: SELinux binary policy manipulation library
Name: libsemanage Name: libsemanage
Version: 2.1.10 Version: 2.1.10
Release: 11%{?dist} Release: 12%{?dist}
License: LGPLv2+ License: LGPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
Source: libsemanage-%{version}.tgz Source: libsemanage-%{version}.tgz
@ -179,6 +179,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif # if with_python3 %endif # if with_python3
%changelog %changelog
* Wed Sep 25 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.10-12
- Do not fail on missing SELinux User Record when adding login record
* Mon Sep 23 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.10-11 * Mon Sep 23 2013 Dan Walsh <dwalsh@redhat.com> - 2.1.10-11
- Add msg to audit records - Add msg to audit records