diff --git a/.gitignore b/.gitignore index e69de29..a885a13 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,148 @@ +libsemanage-1.0.tgz +libsemanage-1.1.4.tgz +libsemanage-1.1.6.tgz +libsemanage-1.3.1.tgz +libsemanage-1.3.2.tgz +libsemanage-1.3.3.tgz +libsemanage-1.3.4.tgz +libsemanage-1.3.5.tgz +libsemanage-1.3.7.tgz +libsemanage-1.3.8.tgz +libsemanage-1.3.9.tgz +libsemanage-1.3.10.tgz +libsemanage-1.3.11.tgz +libsemanage-1.3.14.tgz +libsemanage-1.3.18.tgz +libsemanage-1.3.20.tgz +libsemanage-1.3.23.tgz +libsemanage-1.3.24.tgz +libsemanage-1.3.28.tgz +libsemanage-1.3.30.tgz +libsemanage-1.3.31.tgz +libsemanage-1.3.32.tgz +libsemanage-1.3.34.tgz +libsemanage-1.3.35.tgz +libsemanage-1.3.36.tgz +libsemanage-1.3.38.tgz +libsemanage-1.3.39.tgz +libsemanage-1.3.40.tgz +libsemanage-1.3.41.tgz +libsemanage-1.3.43.tgz +libsemanage-1.3.45.tgz +libsemanage-1.3.48.tgz +libsemanage-1.3.51.tgz +libsemanage-1.3.52.tgz +libsemanage-1.3.53.tgz +libsemanage-1.3.56.tgz +libsemanage-1.3.59.tgz +libsemanage-1.3.61.tgz +libsemanage-1.3.63.tgz +libsemanage-1.3.64.tgz +libsemanage-1.4.tgz +libsemanage-1.5.1.tgz +libsemanage-1.5.2.tgz +libsemanage-1.5.3.tgz +libsemanage-1.5.4.tgz +libsemanage-1.5.6.tgz +libsemanage-1.5.8.tgz +libsemanage-1.5.9.tgz +libsemanage-1.5.11.tgz +libsemanage-1.5.14.tgz +libsemanage-1.5.15.tgz +libsemanage-1.5.16.tgz +libsemanage-1.5.18.tgz +libsemanage-1.5.19.tgz +libsemanage-1.5.20.tgz +libsemanage-1.5.21.tgz +libsemanage-1.5.23.tgz +libsemanage-1.5.26.tgz +libsemanage-1.5.28.tgz +libsemanage-1.5.29.tgz +libsemanage-1.5.31.tgz +libsemanage-1.6.tgz +libsemanage-1.6.2.tgz +libsemanage-1.6.3.tgz +libsemanage-1.6.5.tgz +libsemanage-1.6.6.tgz +libsemanage-1.6.7.tgz +libsemanage-1.6.8.tgz +libsemanage-1.6.9.tgz +libsemanage-1.6.11.tgz +libsemanage-1.6.12.tgz +libsemanage-1.6.13.tgz +libsemanage-1.6.15.tgz +libsemanage-1.6.16.tgz +libsemanage-1.6.17.tgz +libsemanage-1.8.tgz +libsemanage-1.9.1.tgz +libsemanage-1.9.2.tgz +libsemanage-1.10.0.tgz +libsemanage-1.10.1.tgz +libsemanage-2.0.0.tgz +libsemanage-2.0.1.tgz +libsemanage-2.0.2.tgz +libsemanage-2.0.3.tgz +libsemanage-2.0.4.tgz +libsemanage-2.0.5.tgz +libsemanage-2.0.6.tgz +libsemanage-2.0.9.tgz +libsemanage-2.0.10.tgz +libsemanage-2.0.11.tgz +libsemanage-2.0.12.tgz +libsemanage-2.0.14.tgz +libsemanage-2.0.15.tgz +libsemanage-2.0.16.tgz +libsemanage-2.0.18.tgz +libsemanage-2.0.19.tgz +libsemanage-2.0.20.tgz +libsemanage-2.0.22.tgz +libsemanage-2.0.23.tgz +libsemanage-2.0.24.tgz +libsemanage-2.0.25.tgz +libsemanage-2.0.26.tgz +libsemanage-2.0.27.tgz +libsemanage-2.0.28.tgz +libsemanage-2.0.29.tgz +libsemanage-2.0.30.tgz +libsemanage-2.0.31.tgz +libsemanage-2.0.32.tgz +libsemanage-2.0.33.tgz +libsemanage-2.0.35.tgz +libsemanage-2.0.36.tgz +libsemanage-2.0.37.tgz +libsemanage-2.0.38.tgz +libsemanage-2.0.39.tgz +libsemanage-2.0.40.tgz +libsemanage-2.0.41.tgz +libsemanage-2.0.42.tgz +libsemanage-2.0.43.tgz +libsemanage-2.0.44.tgz +libsemanage-2.0.45.tgz +/libsemanage-2.0.46.tgz +/libsemanage-2.1.0.tgz +/libsemanage-2.1.2.tgz +/libsemanage-2.1.3.tgz +/libsemanage-2.1.4.tgz +/libsemanage-2.1.5.tgz +/libsemanage-2.1.6.tgz +/libsemanage-2.1.7.tgz +/libsemanage-2.1.8.tgz +/libsemanage-2.1.9.tgz +/libsemanage-2.1.10.tgz +/libsemanage-2.2.tgz +/libsemanage-2.3.tgz +/libsemanage-2.4.tar.gz +/libsemanage-2.5-rc1.tar.gz +/libsemanage-2.5.tar.gz +/libsemanage-2.6.tar.gz +/libsemanage-2.7.tar.gz +/libsemanage-2.8-rc1.tar.gz +/libsemanage-2.8-rc2.tar.gz +/libsemanage-2.8-rc3.tar.gz +/libsemanage-2.8.tar.gz +/libsemanage-2.9-rc1.tar.gz +/libsemanage-2.9-rc2.tar.gz +/libsemanage-2.9.tar.gz +/libsemanage-3.0-rc1.tar.gz +/libsemanage-3.0.tar.gz +/libsemanage-3.1.tar.gz diff --git a/0001-libsemanage-Fix-RESOURCE_LEAK-and-USE_AFTER_FREE-cov.patch b/0001-libsemanage-Fix-RESOURCE_LEAK-and-USE_AFTER_FREE-cov.patch new file mode 100644 index 0000000..13dea09 --- /dev/null +++ b/0001-libsemanage-Fix-RESOURCE_LEAK-and-USE_AFTER_FREE-cov.patch @@ -0,0 +1,66 @@ +From 4a8aa78cd21b400c13b1895c03a97a8974aeff47 Mon Sep 17 00:00:00 2001 +From: Petr Lautrbach +Date: Wed, 7 Nov 2018 18:17:34 +0100 +Subject: [PATCH] libsemanage: Fix RESOURCE_LEAK and USE_AFTER_FREE coverity + scan defects + +--- + libsemanage/src/direct_api.c | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c +index 1088a0ac6165..79aa72b98cf5 100644 +--- a/libsemanage/src/direct_api.c ++++ b/libsemanage/src/direct_api.c +@@ -1028,7 +1028,7 @@ static int semanage_direct_write_langext(semanage_handle_t *sh, + + fp = NULL; + +- ret = 0; ++ return 0; + + cleanup: + if (fp != NULL) fclose(fp); +@@ -2184,7 +2184,6 @@ cleanup: + semanage_module_info_destroy(sh, modinfo); + free(modinfo); + +- if (fp != NULL) fclose(fp); + return status; + } + +@@ -2349,16 +2348,6 @@ static int semanage_direct_get_module_info(semanage_handle_t *sh, + free(tmp); + tmp = NULL; + +- if (fclose(fp) != 0) { +- ERR(sh, +- "Unable to close %s module lang ext file.", +- (*modinfo)->name); +- status = -1; +- goto cleanup; +- } +- +- fp = NULL; +- + /* lookup enabled/disabled status */ + ret = semanage_module_get_path(sh, + *modinfo, +@@ -2402,7 +2391,13 @@ cleanup: + free(modinfos); + } + +- if (fp != NULL) fclose(fp); ++ if (fp != NULL && fclose(fp) != 0) { ++ ERR(sh, ++ "Unable to close %s module lang ext file.", ++ (*modinfo)->name); ++ status = -1; ++ } ++ + return status; + } + +-- +2.23.0 + diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..af6eb32 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,16 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_testing +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} + diff --git a/libsemanage.spec b/libsemanage.spec new file mode 100644 index 0000000..2abbd60 --- /dev/null +++ b/libsemanage.spec @@ -0,0 +1,1531 @@ +%define libsepolver 3.1-3 +%define libselinuxver 3.1-2 + +Summary: SELinux binary policy manipulation library +Name: libsemanage +Version: 3.1 +Release: 2%{?dist} +License: LGPLv2+ +Source0: https://github.com/SELinuxProject/selinux/releases/download/20200710/libsemanage-3.1.tar.gz +# fedora-selinux/selinux: git format-patch -N libsemanage-3.1 -- libsemanage +# i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done +# Patch list start +Patch0001: 0001-libsemanage-Fix-RESOURCE_LEAK-and-USE_AFTER_FREE-cov.patch +# Patch list end +URL: https://github.com/SELinuxProject/selinux/wiki +Source1: semanage.conf + +BuildRequires: gcc +BuildRequires: libselinux-devel >= %{libselinuxver} swig +BuildRequires: libsepol-devel >= %{libsepolver} +BuildRequires: audit-libs-devel +BuildRequires: bison flex bzip2-devel + +BuildRequires: python3 +BuildRequires: python3-devel + +Requires: bzip2-libs audit-libs +Requires: libselinux%{?_isa} >= %{libselinuxver} + +%description +Security-enhanced Linux is a feature of the Linux® kernel and a number +of utilities with enhanced security functionality designed to add +mandatory access controls to Linux. The Security-enhanced Linux +kernel contains new architectural components originally developed to +improve the security of the Flask operating system. These +architectural components provide general support for the enforcement +of many kinds of mandatory access control policies, including those +based on the concepts of Type Enforcement®, Role-based Access +Control, and Multi-level Security. + +libsemanage provides an API for the manipulation of SELinux binary policies. +It is used by checkpolicy (the policy compiler) and similar tools, as well +as by programs like load_policy that need to perform specific transformations +on binary policies such as customizing policy boolean settings. + +%package static +Summary: Static library used to build policy manipulation tools +Requires: libsemanage-devel%{_isa} = %{version}-%{release} + +%description static +The semanage-static package contains the static libraries +needed for developing applications that manipulate binary policies. + +%package devel +Summary: Header files and libraries used to build policy manipulation tools +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The semanage-devel package contains the libraries and header files +needed for developing applications that manipulate binary policies. + +%package -n python3-libsemanage +Summary: semanage python 3 bindings for libsemanage +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: libselinux-python3 +%{?python_provide:%python_provide python3-libsemanage} +# Remove before F30 +Provides: %{name}-python3 = %{version}-%{release} +Provides: %{name}-python3%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-python3 < %{version}-%{release} + +%description -n python3-libsemanage +The libsemanage-python3 package contains the python 3 bindings for developing +SELinux management applications. + +%prep +%autosetup -n libsemanage-%{version} -p 2 + + +%build +# Disable LTO +%define _lto_cflags %{nil} +%set_build_flags +CFLAGS="$CFLAGS -fno-semantic-interposition" + +# To support building the Python wrapper against multiple Python runtimes +# Define a function, for how to perform a "build" of the python wrapper against +# a specific runtime: +BuildPythonWrapper() { + BinaryName=$1 + + # Perform the build from the upstream Makefile: + make \ + PYTHON=$BinaryName \ + LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" \ + pywrap +} + +make clean +make swigify +%make_build LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all + +BuildPythonWrapper \ + %{__python3} + +%install +InstallPythonWrapper() { + BinaryName=$1 + + make \ + PYTHON=$BinaryName \ + DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" \ + install-pywrap +} + +mkdir -p ${RPM_BUILD_ROOT}%{_libdir} +mkdir -p ${RPM_BUILD_ROOT}%{_includedir} +mkdir -p ${RPM_BUILD_ROOT}%{_sharedstatedir}/selinux +mkdir -p ${RPM_BUILD_ROOT}%{_sharedstatedir}/selinux/tmp +%make_install LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" + +InstallPythonWrapper \ + %{__python3} \ + $(python3-config --extension-suffix) + +cp %{SOURCE1} ${RPM_BUILD_ROOT}/etc/selinux/semanage.conf +ln -sf %{_libdir}/libsemanage.so.1 ${RPM_BUILD_ROOT}/%{_libdir}/libsemanage.so + +%files +%{!?_licensedir:%global license %%doc} +%license COPYING +%dir %{_sysconfdir}/selinux +%config(noreplace) %{_sysconfdir}/selinux/semanage.conf +%{_libdir}/libsemanage.so.1 +%{_mandir}/man5/* +%{_mandir}/ru/man5/* +%dir %{_libexecdir}/selinux +%dir %{_sharedstatedir}/selinux +%dir %{_sharedstatedir}/selinux/tmp + +%ldconfig_scriptlets + +%files static +%{_libdir}/libsemanage.a + +%files devel +%{_libdir}/libsemanage.so +%{_libdir}/pkgconfig/libsemanage.pc +%dir %{_includedir}/semanage +%{_includedir}/semanage/*.h +%{_mandir}/man3/* + +%files -n python3-libsemanage +%{python3_sitearch}/*.so +%{python3_sitearch}/semanage.py* +%{python3_sitearch}/__pycache__/semanage* +%{_libexecdir}/selinux/semanage_migrate_store + +%changelog +* Mon Jul 13 2020 Tom Stellard - 3.1-2 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro +- Use -fno-semantic-interposition and more make macros + +* Fri Jul 10 2020 Petr Lautrbach - 3.1-1 +- SELinux userspace 3.1 release + +* Tue May 26 2020 Miro Hrončok - 3.0-4 +- Rebuilt for Python 3.9 + +* Wed Jan 29 2020 Fedora Release Engineering - 3.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jan 22 2020 Ondrej Mosnacek - 3.0-2 +- Enable policy optimization + +* Fri Dec 6 2019 Petr Lautrbach - 3.0-1 +- SELinux userspace 3.0 release + +* Mon Nov 11 2019 Petr Lautrbach - 3.0-0.rc1.1 +- SELinux userspace 3.0-rc1 release candidate + +* Thu Oct 03 2019 Miro Hrončok - 2.9-5 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Sun Aug 18 2019 Zbigniew Jędrzejewski-Szmek - 2.9-4 +- Rebuilt for Python 3.8 + +* Tue Aug 13 2019 Petr Lautrbach - 2.9-3 +- Drop python2-libsemanage (#1738466) + +* Thu Jul 25 2019 Fedora Release Engineering - 2.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Mar 18 2019 Petr Lautrbach - 2.9-1 +- SELinux userspace 2.9 release + +* Mon Mar 11 2019 Petr Lautrbach - 2.9-0.rc2.1 +- SELinux userspace 2.9-rc2 release + +* Fri Feb 01 2019 Fedora Release Engineering - 2.9-0.rc1.1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jan 25 2019 Petr Lautrbach - 2.9-0.rc1.1 +- SELinux userspace 2.9-rc1 release + +* Mon Jan 21 2019 Petr Lautrbach - 2.8-8 +- Always set errno to 0 before calling getpwent() +- Set selinux policy root around calls to selinux_boolean_sub + +* Mon Dec 10 2018 Petr Lautrbach - 2.8-7 +- genhomedircon - improve handling large groups + +* Tue Nov 13 2018 Petr Lautrbach - 2.8-6 +- Fix RESOURCE_LEAK and USE_AFTER_FREE coverity scan defects + +* Mon Sep 17 2018 Petr Lautrbach - 2.8-5 +- Include user name in ROLE_REMOVE audit events + +* Tue Sep 4 2018 Petr Lautrbach - 2.8-4 +- Reset umask before creating directories (#1186422) + +* Fri Jul 13 2018 Fedora Release Engineering - 2.8-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 2.8-2 +- Rebuilt for Python 3.7 + +* Fri May 25 2018 Petr Lautrbach - 2.8-1 +- SELinux userspace 2.8 release + +* Mon May 14 2018 Petr Lautrbach - 2.8-0.rc3.1 +- SELinux userspace 2.8-rc3 release candidate + +* Fri May 4 2018 Petr Lautrbach - 2.8-0.rc2.1 +- SELinux userspace 2.8-rc2 release candidate + +* Mon Apr 23 2018 Petr Lautrbach - 2.8-0.rc1.1 +- SELinux userspace 2.8-rc1 release candidate + +* Wed Mar 21 2018 Petr Lautrbach - 2.7-12 +- build: Replace PYSITEDIR with PYTHONLIBDIR +- direct_api.c: Fix iterating over array (#1557468) + +* Fri Mar 16 2018 Petr Lautrbach - 2.7-11 +- Revert "remove access() check to make setuid programs work" (#1557468) + +* Tue Mar 13 2018 Petr Lautrbach - 2.7-10 +- properly check return value of iterate function +- Use umask(0077) for fopen() write operations +- Return commit number if save-previous false +- Allow tmp files to be kept if a compile fails +- build: follow standard semantics for DESTDIR and PREFIX +- Improve warning for installing disabled module +- silence clang static analyzer report +- remove access() check to make setuid programs work + +* Fri Feb 09 2018 Igor Gnatenko - 2.7-9 +- Escape macros in %%changelog + +* Wed Feb 07 2018 Fedora Release Engineering - 2.7-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Feb 03 2018 Igor Gnatenko - 2.7-7 +- Switch to %%ldconfig_scriptlets + +* Tue Jan 09 2018 Iryna Shcherbina - 2.7-6 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Wed Nov 22 2017 Petr Lautrbach - 2.7-5 +- free genhomedircon fallback user +- Rebuild with libsepol-2.7-3 and libselinux-2.7-6 + +* Fri Oct 20 2017 Petr Lautrbach - 2.7-4 +- Add support for listing fcontext.homedirs file (#1409813) + +* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek - 2.7-3 +- Add Provides for the old names without %%_isa + +* Thu Aug 10 2017 Zbigniew Jędrzejewski-Szmek - 2.7-2 +- Python 2 binary package renamed to python2-libsemanage + See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 +- Python 3 binary package renamed to python3-libsemanage + +* Mon Aug 07 2017 Petr Lautrbach - 2.7-1 +- Update to upstream release 2017-08-04 +- Use 'sefcontext_compile -r' when it's run during SELinux policy build + +* Thu Aug 03 2017 Fedora Release Engineering - 2.6-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 2.6-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Apr 28 2017 Petr Lautrbach - 2.6-4 +- Follow upstream and rename _semanage.so to _semanage.cpython-36m-x86_64-linux-gnu.so + +* Tue Apr 18 2017 Petr Lautrbach - 2.6-3 +- Do not list duplicate port entries after setting a boolean (#1439875) + +* Thu Mar 02 2017 Petr Lautrbach - 2.6-2 +- Fix FTBFS - fatal error (#1427903) + +* Mon Feb 20 2017 Petr Lautrbach - 2.6-1.1 +- Update to upstream release 2016-10-14 + +* Fri Feb 10 2017 Fedora Release Engineering - 2.5-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Dec 09 2016 Charalampos Stratakis - 2.5-9 +- Rebuild for Python 3.6 + +* Mon Oct 03 2016 Petr Lautrbach 2.5-8 +- Fixes bug preventing the installation of base modules +- make distclean target work +- Do not always print a module name warning +- Use pp module name instead of filename when installing module +- tests: Do not force using gcc +- genhomedircon: remove hardcoded refpolicy strings +- genhomedircon: add support for %%group syntax +- genhomedircon: generate contexts for logins mapped to the default user +- Validate and compile file contexts before installing +- Swap tcp and udp protocol numbers + +* Mon Aug 01 2016 Petr Lautrbach 2.5-7 +- Rebuilt with libsepol-2.5-9 and libselinux-2.5-11 + +* Tue Jul 19 2016 Fedora Release Engineering - 2.5-6 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Jun 23 2016 Petr Lautrbach - 2.5-5 +- Sort object files for deterministic linking order +- Support overriding Makefile RANLIB +- Respect CC and PKG_CONFIG environment variable + +* Fri May 06 2016 Petr Lautrbach - 2.5-4 +- Fix multiple spelling errors +- genhomedircon: %%{USERID} and %%{USERNAME} support and code cleanup + +* Mon Mar 21 2016 Petr Lautrbach - 2.5-3 +- Enable expand-check by default (#1319652) + +* Sun Feb 28 2016 Petr Lautrbach 2.5-2 +- Use fully versioned arch-specific requires + +* Tue Feb 23 2016 Petr Lautrbach 2.5-1 +- Update to upstream release 2016-02-23 + +* Sun Feb 21 2016 Petr Lautrbach 2.5-0.1.rc1 +- Update to upstream rc1 release 2016-01-07 + +* Thu Feb 04 2016 Fedora Release Engineering - 2.4-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Nov 04 2015 Robert Kuska - 2.4-5 +- Rebuilt for Python3.5 rebuild + +* Fri Sep 04 2015 Petr Lautrbach 2.4-4 +- Save homedir_template in the policy store for genhomedircon + https://bugs.gentoo.org/558686 + +* Fri Aug 14 2015 Adam Jackson 2.4-3 +- Pass ldflags into the build so hardening works + +* Thu Jul 30 2015 Petr Lautrbach 2.4-2 +- semanage_migrate_store: use /usr/bin/python3 +- move semanage_migrate_store script to libsemanage-python3 + +* Wed Jun 24 2015 Petr Lautrbach 2.4-0.6 +- Allow to use compressed modules without a compression extension + +* Wed Jun 17 2015 Fedora Release Engineering - 2.3-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Tue Jun 16 2015 Petr Lautrbach 2.4-0.5 +- add /var/lib/selinux/tmp directory + +* Tue May 12 2015 Petr Lautrbach 2.4-0.4 +- semanage_migrate_store: add -r option for migrating inside chroots + +* Mon Apr 13 2015 Petr Lautrbach 2.4-0.3 +- Update to upstream release 2.4 + +* Sun Aug 17 2014 Fedora Release Engineering - 2.3-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Wed Jul 30 2014 Miroslav Grepl - 2.3-5 +- Skip policy module re-link when only setting booleans. + * patch from Stephen Smalley + +* Fri Jul 18 2014 Tom Callaway - 2.3-4 +- fix license handling + +* Sat Jun 07 2014 Fedora Release Engineering - 2.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Wed May 28 2014 Kalev Lember - 2.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 + +* Tue May 6 2014 Dan Walsh - 2.3-1 +- Update to upstream + * Fix memory leak in semanage_genhomedircon from Thomas Hurd. + +* Sun Mar 30 2014 Dan Walsh - 2.2-3 +- libsemanage: fix memory leak in semanage_genhomedircon +- Patch from THomas Hurd + +* Tue Feb 11 2014 Dan Walsh - 2.2-2 +- Move semanage.conf man page from devel package to main package + +* Thu Oct 31 2013 Dan Walsh - 2.2-1 +- Update to upstream + * Avoid duplicate list entries from Dan Walsh. + * Add audit support to libsemanage from Dan Walsh. + * Remove policy.kern and replace with symlink from Dan Walsh. + * Apply a MAX_UID check for genhomedircon from Laurent Bigonville. + * Fix man pages from Laurent Bigonville. + +* Wed Oct 16 2013 Dan Walsh - 2.1.10-14 +- Cleanup handling of missing mls_range to fix problems with useradd -Z +- Fix auditing of login record changes, roles were not working correctly. +Resolves: #952237 + +* Fri Oct 4 2013 Dan Walsh - 2.1.10-13 +- Fix errors found by coverity +Resolves: #952237 + +* Wed Sep 25 2013 Dan Walsh - 2.1.10-12 +- Do not fail on missing SELinux User Record when adding login record + +* Mon Sep 23 2013 Dan Walsh - 2.1.10-11 +- Add msg to audit records + +* Thu Sep 19 2013 Dan Walsh - 2.1.10-10 +- Do not write error message to screen when looking for previous record for auditing. +- Add mls_range from user record if the MLS range is not specified by the seuser add record. +- Error out if seuser or mls range is not specified when adding user records + +* Mon Sep 9 2013 Dan Walsh - 2.1.10-9 +- Create symlink from policy.kern to active kernel. + +* Fri Sep 6 2013 Dan Walsh - 2.1.10-8 +- Unlink policy.kern when done to save space. + +* Fri Jul 26 2013 Dan Walsh - 2.1.10-7 +- Move handling of role audit records into the library +- Patch stops semanage from removing user record while in use + +* Tue Jul 9 2013 Dan Walsh - 2.1.10-6 +- Remove dependance on selinux-policy, /etc/selinux should be owned by libsemanage, and selinux-policy can require it. + +* Fri Jun 28 2013 Dan Walsh - 2.1.10-5 +- Allways build python3 version + +* Mon Apr 22 2013 Dan Walsh - 2.1.10-4 +- + +* Thu Apr 11 2013 Dan Walsh - 2.1.10-3 +- Fix test suite to build + +* Thu Feb 14 2013 Dan Walsh - 2.1.10-2 +- Revert some changes which are causing the wrong policy version file to be created + +* Thu Feb 7 2013 Dan Walsh - 2.1.10-1 +- Update to upstream + * Add sefcontext_compile to compile regex everytime policy is rebuilt + * Cleanup/fix enable/disable/remove module. + * redo genhomedircon minuid + * fixes from coverity + * semanage_store: do not leak memory in semanage_exec_prog + * genhomedircon: remove useless conditional in get_home_dirs + * genhomedircon: double free in get_home_dirs + * fcontext_record: do not leak on error in semanage_fcontext_key_create + * genhomedircon: do not leak on failure in write_gen_home_dir_context + * semanage_store: do not leak fd + * genhomedircon: do not leak shells list + * semanage_store: do not leak on strdup failure + * semanage_store: rewrite for readability + +* Wed Jan 16 2013 Dan Walsh 2.1.9-4 +- Add selinux-policy as a requires to get /etc/selinux owned + +* Sat Jan 5 2013 Dan Walsh 2.1.9-3 +- Update to latest patches from eparis/Upstream +- libsemanage: fixes from coverity +- libsemange: redo genhomedircon minuid + +* Wed Nov 21 2012 Dan Walsh - 2.1.9-2 +- Fix handling of missing semanage permissive -d foo, not failing correctly +- Previous to this fix the first module beginning with foo would get deleted. + +* Thu Sep 13 2012 Dan Walsh - 2.1.9-1 +- Update to upstream + * libsemanage: do not set soname needlessly + * libsemanage: remove PYTHONLIBDIR and ruby equivalent + * do boolean name substitution + * Fix segfault for building standard policies. + +* Fri Aug 03 2012 David Malcolm - 2.1.8-6 +- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 + +* Wed Aug 1 2012 David Malcolm - 2.1.8-5 +- remove rhel logic from with_python3 conditional + +* Thu Jul 19 2012 Fedora Release Engineering - 2.1.8-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri Jul 13 2012 Dan Walsh - 2.1.8-3 +- Attempt to allocate memory for selinux_binary_policy_path and free memory +- allocated by asprintf. + +* Thu Jul 12 2012 Dan Walsh - 2.1.8-2 +- Fix asprintf within an asprintf call + +* Wed Jul 4 2012 Dan Walsh - 2.1.8-1 +- Update to upstream + * remove build warning when build swig c files + * additional makefile support for rubywrap + * ignore 80 column limit for readability + * semanage_store: fix snprintf length argument by using asprintf + * Use default semanage.conf as a fallback + * use after free in python bindings + +* Tue May 29 2012 Dan Walsh - 2.1.7-2 +- Apply patch from Sven Vermeulen to fix problem with python3 bindings. + +* Thu Mar 29 2012 Dan Walsh - 2.1.7-1 +- Update to upstream + * Alternate path for semanage.conf + * do not link against libpython, this is considered bad in Debian + * Allow to build for several ruby version + * fallback-user-level + +* Wed Feb 15 2012 Dan Walsh - 2.1.6-3 +- Check in correct patch. + +* Fri Jan 13 2012 Fedora Release Engineering - 2.1.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri Jan 6 2012 Dan Walsh - 2.1.6-2 +- Add patch form Xin Ouyang to make library use private semanage.conf + +* Wed Dec 21 2011 Dan Walsh - 2.1.6-1 +-Update to upstream + * add ignoredirs config for genhomedircon + * Fallback_user_level can be NULL if you are not using MLS + +* Thu Dec 15 2011 Dan Walsh - 2.1.5-4 +- Rebuild with latest libsepol + +* Thu Dec 15 2011 Dan Walsh - 2.1.5-3 +- Rebuild with latest libsepol + +* Thu Dec 15 2011 Dan Walsh - 2.1.5-2 +- Add support for ignoredirs param in /etc/selinux/semanage.conf + +* Fri Nov 4 2011 Dan Walsh - 2.1.5-1 +- Upgrade to upstream + * regenerate .pc on VERSION change + * maintain mode even if umask is tighter + * semanage.conf man page + * create man5dir if not exist + +* Wed Oct 19 2011 Dan Walsh - 2.1.4-2 +- Fix handling of umask, so files get created with the correct label. + +* Mon Sep 19 2011 Dan Walsh - 2.1.4-2 +- Add Guido Trentalancia semanage.conf man page + +* Mon Sep 19 2011 Dan Walsh - 2.1.4-1 +-Update to upstream + * Create a new preserve_tunables flag + * tree: default make target to all not + * fix semanage_store_access_check calling arguments + +* Wed Sep 14 2011 Dan Walsh - 2.1.3-2 +- Add support for preserving tunables + +* Tue Aug 30 2011 Dan Walsh - 2.1.3-1 +-Update to upstream + * python wrapper makefile changes + +* Thu Aug 18 2011 Dan Walsh - 2.1.2-1 +-Update to upstream +2.1.2 2011-08-17 + * print error debug info for buggy fc + * introduce semanage_set_root and friends + * throw exceptions in python rather than return + * python3 support. + * patch for MCS/MLS in user files + +2.1.1 2011-08-01 + * Remove generated files, expand .gitignore + * Use -Werror and change a few prototypes to support it + +* Thu Jul 28 2011 Dan Walsh - 2.1.0-1 +- Update to upstream + * Release, minor version bump + +* Wed Jun 8 2011 Dan Walsh - 2.0.46-6 +- More fixes for disabled modules + +* Tue Jun 7 2011 Dan Walsh - 2.0.46-5 +- Change libsemanage mechanism for handling disabled modules. Now it will only create a flag for a module +indicating the module is disabled. MODULE.pp.disabled, it will no longer rename the module. This way we can +ship active modules in rpm. + +* Wed Jun 1 2011 Dan Walsh - 2.0.46-4 +- Add semanage_set_selinux_path, to allow semodule to work on alternate selinux pools + +* Tue Feb 08 2011 Fedora Release Engineering - 2.0.46-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Dec 30 2010 David Malcolm - 2.0.46-2 +- big reworking of the support-multiple-python-builds patch to deal with +PEP 3149: the latest Python 3.2 onwards uses include paths and library names +that don't fit prior naming patterns, and so we must query python3-config for +this information. To complicate things further, python 2's python-config +doesn't understand all of the options needed ("--extension-suffix"). I've +thus added new Makefile variables as needed, to be supplied by the specfile by +invoking the appropriate config tool (or by hardcoding the old value for +"--extension-suffix" i.e. ".so") +- rework python3 manifest for PEP 3149, and rebuild for newer python3 + +* Tue Dec 21 2010 Dan Walsh - 2.0.46-1 +- Update to upstream + * Fix compliation under GCC 4.6 by Justin Mattock + +* Wed Aug 25 2010 Thomas Spura - 2.0.45-6 +- rebuild with python3.2 + http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html + +* Wed Jul 21 2010 David Malcolm - 2.0.45-5 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Tue Apr 27 2010 David Malcolm - 2.0.45-4 +- add python3 subpackage + +* Wed Apr 7 2010 Dan Walsh - 2.0.45-3 +- Fix -devel package to point at the correct shared library + +* Fri Mar 26 2010 Dan Walsh - 2.0.45-2 +- Move shared library to /usr/lib + +* Mon Mar 8 2010 Dan Walsh - 2.0.45-1 +- Update to upstream + * Add enable/disable patch support from Dan Walsh. + * Add usepasswd flag to semanage.conf to disable genhomedircon using + passwd from Dan Walsh. + * regenerate swig wrappers + +* Thu Feb 25 2010 Dan Walsh - 2.0.44-2 +- Allow disable of usepasswd + +* Wed Feb 17 2010 Dan Walsh - 2.0.44-1 +- Update to upstream + * Replace usage of fmemopen() with sepol_policy_file_set_mem() since + glibc < 2.9 does not support binary mode ('b') for fmemopen'd + streams. + +* Thu Jan 28 2010 Dan Walsh - 2.0.43-4 +- Cleanup spec file + +* Mon Jan 18 2010 Dan Walsh - 2.0.43-3 +- Splect libsemanage.a into a static subpackage to keep fedora packaging guidelines happy + +* Wed Dec 16 2009 Dan Walsh - 2.0.43-2 +- Rebuild all c programs with -fPIC + +* Tue Dec 1 2009 Dan Walsh - 2.0.43-1 +- Update to upstream + * Move libsemanage.so to /usr/lib + * Add NAME lines to man pages from Manoj Srivastava + +* Wed Nov 18 2009 Dan Walsh - 2.0.42-1 +- Update to upstream + * Move load_policy from /usr/sbin to /sbin from Dan Walsh. + +* Mon Nov 2 2009 Dan Walsh - 2.0.41-1 +- Update to upstream + * Add pkgconfig file from Eamon Walsh. + * Add semanage_set_check_contexts() function to disable calling + setfiles + +* Mon Sep 28 2009 Dan Walsh - 2.0.39-1 +- Update to upstream + * make swigify + +* Sun Sep 20 2009 Dan Walsh - 2.0.38-2 +- Dont relabel /root with genhomedircon + +* Thu Sep 17 2009 Dan Walsh - 2.0.38-1 +- Update to upstream + * Change semodule upgrade behavior to install even if the module + is not present from Dan Walsh. + * Make genhomedircon trim excess '/' from homedirs from Dan Walsh. + +* Wed Sep 9 2009 Dan Walsh - 2.0.37-1 +- Update to upstream + * Fix persistent dontaudit support to rebuild policy if the + dontaudit state is changed from Chad Sellers. +- Move load_policy to /sbin + +* Fri Aug 28 2009 Dan Walsh - 2.0.36-2 +- Add enable/disable modules + +* Wed Aug 26 2009 Dan Walsh - 2.0.36-1 +- Update to upstream + * Changed bzip-blocksize=0 handling to support existing compressed + modules in the store. + +* Wed Aug 26 2009 Dan Walsh - 2.0.35-2 +- Make sure /root is not used in genhomedircon + +* Wed Aug 5 2009 Dan Walsh - 2.0.35-1 +- Revert hard linking of files between tmp/active/previous. +- Enable configuration of bzip behavior from Stephen Smalley. +- bzip-blocksize=0 to disable compression and decompression support. +- bzip-blocksize=1..9 to set the blocksize for compression. +- bzip-small=true to reduce memory usage for decompression. + +* Sat Jul 25 2009 Fedora Release Engineering - 2.0.33-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Jul 10 2009 Dan Walsh - 2.0.33-2 +- Put check for /root back into genhomedircon + +* Tue Jul 7 2009 Dan Walsh - 2.0.33-1 +- Update to upstream + +* Mon Jun 8 2009 Dan Walsh - 2.0.32-1 +- Update to upstream + * Ruby bindings from David Quigley. + +* Thu Apr 9 2009 Dan Walsh - 2.0.31-5 +- Return error on invalid file + +* Wed Mar 11 2009 Dan Walsh - 2.0.31-4 +- Fix typo + +* Wed Feb 25 2009 Fedora Release Engineering - 2.0.31-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Jan 15 2009 Dan Walsh - 2.0.31-2 +- Fix link to only link on sandbox + +* Mon Jan 12 2009 Dan Walsh - 2.0.31-1 +- Update to upstream + * Policy module compression (bzip) support from Dan Walsh. + * Hard link files between tmp/active/previous from Dan Walsh. + +* Mon Jan 12 2009 Dan Walsh - 2.0.30-3 +- Fix up patch to get it upstreamed + +* Thu Dec 04 2008 Ignacio Vazquez-Abrams - 2.0.30-2 +- Rebuild for Python 2.6 + +* Thu Dec 4 2008 Dan Walsh - 2.0.30-1 +- Add semanage_mls_enabled() interface from Stephen Smalley. + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 2.0.29-2 +- Rebuild for Python 2.6 + +* Mon Sep 15 2008 Dan Walsh - 2.0.28-1 +- Update to upstream + * Add USER to lines to homedir_template context file from Chris PeBenito. + +* Mon Sep 15 2008 Dan Walsh - 2.0.28-2 +- Add compression support + +* Mon Sep 15 2008 Dan Walsh - 2.0.28-1 +- Update to upstream + * allow fcontext and seuser changes without rebuilding the policy from Dan Walsh + +* Wed Sep 10 2008 Dan Walsh - 2.0.27-3 +- Additional fixes for Don't rebuild on fcontext or seuser modifications + +* Tue Sep 2 2008 Dan Walsh - 2.0.27-2 +- Don't rebuild on fcontext or seuser modifications + +* Tue Aug 5 2008 Dan Walsh - 2.0.27-1 +- Update to upstream + * Modify genhomedircon to skip groupname entries. + Ultimately we need to expand them to the list of users to support per-role homedir labeling when using the groupname syntax. + +* Tue Jul 29 2008 Dan Walsh - 2.0.26-1 +- Update to upstream + * Fix bug in genhomedircon fcontext matches logic from Dan Walsh. + Strip any trailing slash before appending /*$. + +* Tue Jun 17 2008 Dan Walsh - 2.0.25-3 +- Another fix for genhomedircon + +* Wed May 28 2008 Tom "spot" Callaway - 2.0.25-2 +- fix license tag + +* Tue Feb 5 2008 Dan Walsh - 2.0.25-1 +- Update to upstream + * Do not call genhomedircon if the policy was not rebuilt from Stephen Smalley. + Fixes semanage boolean -D seg fault (bug 441379). + +* Tue Feb 5 2008 Dan Walsh - 2.0.24-1 +- Update to upstream + * make swigify + +* Tue Feb 5 2008 Dan Walsh - 2.0.23-1 +- Update to upstream + * Use vfork rather than fork for libsemanage helpers to reduce memory overhead as suggested by Todd Miller. + +* Mon Feb 4 2008 Dan Walsh - 2.0.22-1 +- Update to upstream + * Free policydb before fork from Joshua Brindle. + * Drop the base module immediately after expanding to permit memory re-use from Stephen Smalley. + +* Sat Feb 2 2008 Dan Walsh - 2.0.20-1 +- Update to upstream + * Use sepol_set_expand_consume_base to reduce peak memory usage when + using semodule + +* Fri Feb 1 2008 Dan Walsh - 2.0.19-1 +- Update to upstream + * Fix genhomedircon to not override a file context with a homedir context from Todd Miller. + +* Tue Jan 29 2008 Dan Walsh - 2.0.18-1 +- Update to upstream + * Fix spurious out of memory error reports. + * Merged second version of fix for genhomedircon handling from Caleb Case. + +* Tue Jan 22 2008 Dan Walsh - 2.0.16-1 +- Update to upstream + * Merged fix for genhomedircon handling of missing HOME_DIR or HOME_ROOT templates from Caleb Case. + +* Tue Jan 22 2008 Dan Walsh - 2.0.15-2 +- Stop differentiating on user for homedir labeling + +* Thu Dec 6 2007 Dan Walsh - 2.0.15-1 +- Update to upstream + * Fix genhomedircon handling of shells and missing user context template from Dan Walsh. + * Copy the store path in semanage_select_store from Dan Walsh. +- Add expand-check=0 to semanage.conf + +* Mon Dec 3 2007 Dan Walsh - 2.0.14-5 +- Fix handling of /etc/shells so genhomedircon will work + +* Thu Nov 29 2007 Dan Walsh - 2.0.14-3 +- Allow semanage_genhomedircon to work with out a USER int homedir.template + +* Sat Nov 10 2007 Dan Walsh - 2.0.14-2 +- Fix semanage_select_store to allocate memory, fixes crash on invalid store + +* Tue Nov 6 2007 Dan Walsh - 2.0.14-1 +- Upgrade to latest from NSA + * Call rmdir() rather than remove() on directory removal so that errno isn't polluted from Stephen Smalley. + * Allow handle_unknown in base to be overridden by semanage.conf from Stephen Smalley. + +* Fri Oct 5 2007 Dan Walsh - 2.0.12-1 +- Upgrade to latest from NSA + * ustr cleanups from James Antill. + * Ensure that /root gets labeled even if using the default context from Dan Walsh. + +* Fri Sep 28 2007 Dan Walsh - 2.0.11-1 +- Upgrade to latest from NSA + * Fix ordering of file_contexts.homedirs from Todd Miller and Dan Walsh. + +* Fri Sep 28 2007 Dan Walsh - 2.0.10-2 +- Fix sort order on generated homedir context + +* Fri Sep 28 2007 Dan Walsh - 2.0.10-1 +- Upgrade to latest from NSA + * Fix error checking on getpw*_r functions from Todd Miller. + * Make genhomedircon skip invalid homedir contexts from Todd Miller. + * Set default user and prefix from seusers from Dan Walsh. + * Add swigify Makefile target from Dan Walsh. + +* Wed Sep 26 2007 Dan Walsh - 2.0.9-1 +- Upgrade to latest from NSA + * Pass CFLAGS to CC even on link command, per Dennis Gilmore. + * Clear errno on non-fatal errors to avoid reporting them upon a + later error that does not set errno. + * Improve reporting of system errors, e.g. full filesystem or read-only filesystem from Stephen Smalley. + +- Fix segfault in genhomedircon when using bad user names + +* Wed Sep 26 2007 Dan Walsh - 2.0.6-2 +- Fix genhomedircon code to only generate valid context +- Fixes autorelabel problem + +* Thu Sep 13 2007 Dan Walsh - 2.0.6-1 +- Upgrade to latest from NSA + * Change to use getpw* function calls to the _r versions from Todd Miller. + +* Thu Aug 23 2007 Dan Walsh - 2.0.5-1 +- Upgrade to latest from NSA + +* Mon Aug 20 2007 Dan Walsh - 2.0.4-1 +- Upgrade to latest from NSA + * Allow dontaudits to be turned off via semanage interface when + updating policy + +* Sat Aug 11 2007 Dan Walsh - 2.0.3-5 +- Add ability to load a policy without dontaudit rules +- + +* Tue Jun 26 2007 Dan Walsh - 2.0.3-4 +- Rebuild to fix segfault on x86 platforms, swigify on each build + +* Fri Jun 1 2007 Dan Walsh - 2.0.3-3 +- Rebuild for rawhide + +* Thu May 3 2007 Dan Walsh - 2.0.3-2 +- Apply patch to fix dependencies in spec file from Robert Scheck + +* Wed Apr 25 2007 Dan Walsh - 2.0.3-1 +- Upgrade to latest from NSA + * Fix to libsemanage man patches so whatis will work better from Dan Walsh + +* Wed Apr 25 2007 Dan Walsh - 2.0.2-1 +- Upgrade to latest from NSA +- Merged optimizations from Stephen Smalley. +- do not set all booleans upon commit, only those whose values have changed +- only install the sandbox upon commit if something was rebuilt + +* Sat Mar 17 2007 Dan Walsh - 2.0.1-2 +- Add SELinux to Man page Names so man -k will work + +* Mon Mar 12 2007 Dan Walsh - 2.0.1-1 +- Merged dbase_file_flush patch from Dan Walsh. +- This removes any mention of specific tools (e.g. semanage) +- from the comment header of the auto-generated files, +- since there are multiple front-end tools. + +* Tue Feb 20 2007 Dan Walsh - 2.0.0-1 +- Upgrade to latest from NSA + * Merged Makefile test target patch from Caleb Case. + * Merged get_commit_number function rename patch from Caleb Case. + * Merged strnlen -> strlen patch from Todd Miller. + +* Wed Feb 7 2007 Dan Walsh - 1.10.1-1 +- Upgrade to latest from NSA + * Merged python binding fix from Dan Walsh. + * Updated version for stable branch. + +* Fri Dec 22 2006 Dan Walsh - 1.9.2-1 +- Upgrade to latest from NSA + * Merged patch to optionally reduce disk usage by removing + the backup module store and linked policy from Karl MacMillan + * Merged patch to correctly propagate return values in libsemanage + +* Fri Dec 22 2006 Dan Walsh - 1.9.1-3 +- Apply Karl MacMillan patch to get proper error codes. + +* Thu Dec 7 2006 Jeremy Katz - 1.9.1-2 +- rebuild against python 2.5 + +* Tue Nov 28 2006 Dan Walsh - 1.9.1-1 +- Upgrade to latest from NSA + * Merged patch to compile wit -fPIC instead of -fpic from + Manoj Srivastava to prevent hitting the global offest table + limit. Patch changed to include libselinux and libsemanage in + addition to libsepol. + +* Tue Oct 17 2006 Dan Walsh - 1.8-1 +- Upgrade to latest from NSA + * Updated version for release. + +* Thu Aug 31 2006 Dan Walsh - 1.6.17-1 +- Upgrade to latest from NSA + * Merged patch to skip reload if no active store exists and + the store path doesn't match the active store path from Dan Walsh. + * Merged patch to not destroy sepol handle on error path of + connect from James Athey. + * Merged patch to add genhomedircon path to semanage.conf from + James Athey. + +* Thu Aug 31 2006 Dan Walsh - 1.6.16-3 +- Fix semanage to not load if is not the correct policy type and it is installing + +* Thu Aug 31 2006 Dan Walsh - 1.6.16-2 +- Fix requires lines + +* Wed Aug 23 2006 Dan Walsh - 1.6.16-1 +- Upgrade to latest from NSA + * Make most copy errors fatal, but allow exceptions for + file_contexts.local, seusers, and netfilter_contexts if + the source file does not exist in the store. + +* Sat Aug 12 2006 Dan Walsh - 1.6.15-1 +- Upgrade to latest from NSA + * Merged separate local file contexts patch from Chris PeBenito. + * Merged patch to make most copy errors non-fatal from Dan Walsh. + +* Thu Aug 10 2006 Dan Walsh - 1.6.13-3 +- Change other updates to be non-fatal + +* Wed Aug 9 2006 Dan Walsh - 1.6.13-2 +- Change netfilter stuff to be non-fatal so update can proceed. + +* Thu Aug 3 2006 Dan Walsh - 1.6.13-1 +- Upgrade to latest from NSA + * Merged netfilter contexts support from Chris PeBenito. + +* Mon Jul 17 2006 Dan Walsh - 1.6.12-2 +- Rebuild for new gcc + +* Tue Jul 11 2006 Dan Walsh - 1.6.12-1 +- Upgrade to latest from NSA + * Merged support for read operations on read-only fs from + Caleb Case (Tresys Technology). + +* Tue Jul 4 2006 Dan Walsh - 1.6.11-1 +- Upgrade to latest from NSA + * Lindent. + * Merged setfiles location check patch from Dan Walsh. + +* Fri Jun 16 2006 Dan Walsh - 1.6.9-1 +- Upgrade to latest from NSA + * Merged several fixes from Serge Hallyn: + dbase_file_cache: deref of uninit data on error path. + dbase_policydb_cache: clear fp to avoid double fclose + semanage_fc_sort: destroy temp on error paths + +* Fri Jun 16 2006 Dan Walsh - 1.6.8-2 +- Handle setfiles being in /sbin or /usr/sbin + +* Mon May 15 2006 Dan Walsh - 1.6.8-1 +- Upgrade to latest from NSA + * Updated default location for setfiles to /sbin to + match policycoreutils. This can also be adjusted via + semanage.conf using the syntax: + [setfiles] + path = /path/to/setfiles + args = -q -c $@ $< + [end] + +* Mon May 15 2006 Dan Walsh - 1.6.7-3 +- Spec file cleanup from n0dalus+redhat@gmail.com + +* Mon May 15 2006 Dan Walsh - 1.6.7-2 +- Add /usr/include/semanage to spec file + +* Mon May 8 2006 Dan Walsh - 1.6.7-1 +- Upgrade to latest from NSA + * Merged fix warnings patch from Karl MacMillan. + +* Fri Apr 14 2006 Dan Walsh - 1.6.6-1 +- Upgrade to latest from NSA + * Merged updated file context sorting patch from Christopher + Ashworth, with bug fix for escaped character flag. + * Merged file context sorting code from Christopher Ashworth + (Tresys Technology), based on fc_sort.c code in refpolicy. + * Merged python binding t_output_helper removal patch from Dan Walsh. + * Regenerated swig files. + +* Wed Mar 29 2006 Dan Walsh - 1.6.3-1 +- Fix to work with new version of swig +- Upgrade to latest from NSA + * Merged corrected fix for descriptor leak from Dan Walsh. + +* Wed Mar 29 2006 Dan Walsh - 1.6.2-2 +- Fix leaky descriptor + +* Tue Mar 21 2006 Dan Walsh - 1.6.2-1 +- Upgrade to latest from NSA + * Merged Makefile PYLIBVER definition patch from Dan Walsh. + * Merged man page reorganization from Ivan Gyurdiev. + +* Fri Mar 17 2006 Dan Walsh - 1.6-1 +- Make work on RHEL4 +- Upgrade to latest from NSA + * Merged abort early on merge errors patch from Ivan Gyurdiev. + * Cleaned up error handling in semanage_split_fc based on a patch + by Serge Hallyn (IBM) and suggestions by Ivan Gyurdiev. + * Merged MLS handling fixes from Ivan Gyurdiev. + +* Fri Feb 17 2006 Dan Walsh - 1.5.28-1 +- Upgrade to latest from NSA + * Merged bug fix for fcontext validate handler from Ivan Gyurdiev. + * Merged base_merge_components changes from Ivan Gyurdiev. + +* Thu Feb 16 2006 Dan Walsh - 1.5.26-1 +- Upgrade to latest from NSA + * Merged paths array patch from Ivan Gyurdiev. + * Merged bug fix patch from Ivan Gyurdiev. + * Merged improve bindings patch from Ivan Gyurdiev. + * Merged use PyList patch from Ivan Gyurdiev. + * Merged memory leak fix patch from Ivan Gyurdiev. + * Merged nodecon support patch from Ivan Gyurdiev. + * Merged cleanups patch from Ivan Gyurdiev. + * Merged split swig patch from Ivan Gyurdiev. + +* Mon Feb 13 2006 Dan Walsh - 1.5.23-1 +- Upgrade to latest from NSA + * Merged optionals in base patch from Joshua Brindle. + * Merged treat seusers/users_extra as optional sections patch from + Ivan Gyurdiev. + * Merged parse_optional fixes from Ivan Gyurdiev. + +* Fri Feb 10 2006 Jesse Keating - 1.5.21-2.1 +- bump again for double-long bug on ppc(64) + +* Fri Feb 10 2006 Dan Walsh - 1.5.21-2 +- Fix handling of seusers and users_map file + +* Tue Feb 07 2006 Dan Walsh - 1.5.21-1 +- Upgrade to latest from NSA + * Merged seuser/user_extra support patch from Joshua Brindle. + * Merged remote system dbase patch from Ivan Gyurdiev. + +* Tue Feb 07 2006 Jesse Keating - 1.5.20-1.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Thu Feb 2 2006 Dan Walsh 1.5.20-1 +- Upgrade to latest from NSA + * Merged clone record on set_con patch from Ivan Gyurdiev. + +* Mon Jan 30 2006 Dan Walsh 1.5.19-1 +- Upgrade to latest from NSA + * Merged fname parameter patch from Ivan Gyurdiev. + * Merged more size_t -> unsigned int fixes from Ivan Gyurdiev. + * Merged seusers.system patch from Ivan Gyurdiev. + * Merged improve port/fcontext API patch from Ivan Gyurdiev. + +* Fri Jan 27 2006 Dan Walsh 1.5.18-1 +- Upgrade to latest from NSA + * Merged seuser -> seuser_local rename patch from Ivan Gyurdiev. + * Merged set_create_store, access_check, and is_connected interfaces + from Joshua Brindle. + +* Fri Jan 13 2006 Dan Walsh 1.5.16-1 +- Upgrade to latest from NSA + * Regenerate python wrappers. + +* Fri Jan 13 2006 Dan Walsh 1.5.15-1 +- Upgrade to latest from NSA + * Merged pywrap Makefile diff from Dan Walsh. + * Merged cache management patch from Ivan Gyurdiev. + * Merged bugfix for dbase_llist_clear from Ivan Gyurdiev. + * Merged remove apply_local function patch from Ivan Gyurdiev. + * Merged only do read locking in direct case patch from Ivan Gyurdiev. + * Merged cache error path memory leak fix from Ivan Gyurdiev. + * Merged auto-generated file header patch from Ivan Gyurdiev. + * Merged pywrap test update from Ivan Gyurdiev. + * Merged hidden defs update from Ivan Gyurdiev. + +* Fri Jan 13 2006 Dan Walsh 1.5.14-2 +- Break out python out of regular Makefile + +* Fri Jan 13 2006 Dan Walsh 1.5.14-1 +- Upgrade to latest from NSA + * Merged disallow port overlap patch from Ivan Gyurdiev. + * Merged join prereq and implementation patches from Ivan Gyurdiev. + * Merged join user extra data part 2 patch from Ivan Gyurdiev. + * Merged bugfix patch from Ivan Gyurdiev. + * Merged remove add_local/set_local patch from Ivan Gyurdiev. + * Merged user extra data part 1 patch from Ivan Gyurdiev. + * Merged size_t -> unsigned int patch from Ivan Gyurdiev. + * Merged calloc check in semanage_store patch from Ivan Gyurdiev, + bug noticed by Steve Grubb. + * Merged cleanups after add/set removal patch from Ivan Gyurdiev. + +* Sat Jan 7 2006 Dan Walsh 1.5.9-1 +- Upgrade to latest from NSA + * Merged const in APIs patch from Ivan Gyurdiev. + * Merged validation of local file contexts patch from Ivan Gyurdiev. + * Merged compare2 function patch from Ivan Gyurdiev. + * Merged hidden def/proto update patch from Ivan Gyurdiev. + +* Fri Jan 6 2006 Dan Walsh 1.5.8-1 +- Upgrade to latest from NSA + * Re-applied string and file optimization patch from Russell Coker, + with bug fix. + * Reverted string and file optimization patch from Russell Coker. + * Clarified error messages from parse_module_headers and + parse_base_headers for base/module mismatches. + +* Fri Jan 6 2006 Dan Walsh 1.5.6-1 +- Upgrade to latest from NSA + * Clarified error messages from parse_module_headers and + parse_base_headers for base/module mismatches. + * Merged string and file optimization patch from Russell Coker. + * Merged swig header reordering patch from Ivan Gyurdiev. + * Merged toggle modify on add patch from Ivan Gyurdiev. + * Merged ports parser bugfix patch from Ivan Gyurdiev. + * Merged fcontext swig patch from Ivan Gyurdiev. + * Merged remove add/modify/delete for active booleans patch from Ivan Gyurdiev. + * Merged man pages for dbase functions patch from Ivan Gyurdiev. + * Merged pywrap tests patch from Ivan Gyurdiev. + +* Thu Jan 5 2006 Dan Walsh 1.5.4-2 +- Patch to fix add + +* Thu Jan 5 2006 Dan Walsh 1.5.4-1 +- Upgrade to latest from NSA + * Merged patch series from Ivan Gyurdiev. + This includes patches to: + - separate file rw code from linked list + - annotate objects + - fold together internal headers + - support ordering of records in compare function + - add active dbase backend, active booleans + - return commit numbers for ro database calls + - use modified flags to skip rebuild whenever possible + - enable port interfaces + - update swig interfaces and typemaps + - add an API for file_contexts.local and file_contexts + - flip the traversal order in iterate/list + - reorganize sandbox_expand + - add seusers MLS validation + - improve dbase spec/documentation + - clone record on set/add/modify + +* Tue Dec 27 2005 Dan Walsh 1.5.3-3 +- Add Ivans patch to turn on ports + +* Wed Dec 14 2005 Dan Walsh 1.5.3-2 +- Remove patch since upstream does the right thing + +* Wed Dec 14 2005 Dan Walsh 1.5.3-1 +- Upgrade to latest from NSA + * Merged further header cleanups from Ivan Gyurdiev. + * Merged toggle modified flag in policydb_modify, fix memory leak + in clear_obsolete, polymorphism vs headers fix, and include guards + for internal headers patches from Ivan Gyurdiev. + +* Tue Dec 13 2005 Dan Walsh 1.5.1-2 +- Upgrade to latest from NSA + * Merged toggle modified flag in policydb_modify, fix memory leak + in clear_obsolete, polymorphism vs headers fix, and include guards + for internal headers patches from Ivan Gyurdiev. + +* Mon Dec 12 2005 Dan Walsh 1.5.1-1 +- Upgrade to latest from NSA + * Added file-mode= setting to semanage.conf, default to 0644. + Changed semanage_copy_file and callers to use this mode when + installing policy files to runtime locations. + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Wed Dec 7 2005 Dan Walsh 1.4-1 +- Fix mode of output seusers file + +* Tue Dec 6 2005 Dan Walsh 1.3.64-1 +- Upgrade to latest from NSA + * Changed semanage_handle_create() to set do_reload based on + is_selinux_enabled(). This prevents improper attempts to + load policy on a non-SELinux system. + +* Mon Dec 5 2005 Dan Walsh 1.3.63-1 +- Upgrade to latest from NSA + * Dropped handle from user_del_role interface. + * Removed defrole interfaces. + +* Tue Nov 29 2005 Dan Walsh 1.3.61-1 +- Upgrade to latest from NSA + * Merged Makefile python definitions patch from Dan Walsh. + * Removed is_selinux_mls_enabled() conditionals in seusers and users + file parsers. + +* Wed Nov 23 2005 Dan Walsh 1.3.59-1 +- Add additional swig objects + * Merged wrap char*** for user_get_roles patch from Joshua Brindle. + * Merged remove defrole from sepol patch from Ivan Gyurdiev. + * Merged swig wrappers for modifying users and seusers from Joshua Brindle. + +* Wed Nov 23 2005 Dan Walsh 1.3.56-2 +- Add additional swig objects + +* Wed Nov 16 2005 Dan Walsh 1.3.56-1 +- Upgrade to latest from NSA + * Fixed free->key_free bug. + * Merged clear obsolete patch from Ivan Gyurdiev. + * Merged modified swigify patch from Dan Walsh + (original patch from Joshua Brindle). + * Merged move genhomedircon call patch from Chad Sellers. + +* Mon Nov 14 2005 Dan Walsh 1.3.53-3 +- Add genhomedircon patch from Joshua Brindle + +* Fri Nov 11 2005 Dan Walsh 1.3.53-2 +- Add swigify patch from Joshua Brindle + +* Fri Nov 11 2005 Dan Walsh 1.3.53-1 +- Upgrade to latest from NSA + * Merged move seuser validation patch from Ivan Gyurdiev. + * Merged hidden declaration fixes from Ivan Gyurdiev, + with minor corrections. + +* Wed Nov 9 2005 Dan Walsh 1.3.52-1 +- Upgrade to latest from NSA + * Merged cleanup patch from Ivan Gyurdiev. + This renames semanage_module_conn to semanage_direct_handle, + and moves sepol handle create/destroy into semanage handle + create/destroy to allow use even when disconnected (for the + record interfaces). + +* Tue Nov 8 2005 Dan Walsh 1.3.51-1 +- Upgrade to latest from NSA + * Clear modules modified flag upon disconnect and commit. + * Added tracking of module modifications and use it to + determine whether expand-time checks should be applied + on commit. + * Reverted semanage_set_reload_bools() interface. + +* Tue Nov 8 2005 Dan Walsh 1.3.48-1 +- Upgrade to latest from NSA + * Disabled calls to port dbase for merge and commit and stubbed + out calls to sepol_port interfaces since they are not exported. + * Merged rename instead of copy patch from Joshua Brindle (Tresys). + * Added hidden_def/hidden_proto for exported symbols used within + libsemanage to eliminate relocations. Wrapped type definitions + in exported headers as needed to avoid conflicts. Added + src/context_internal.h and src/iface_internal.h. + * Added semanage_is_managed() interface to allow detection of whether + the policy is managed via libsemanage. This enables proper handling + in setsebool for non-managed systems. + * Merged semanage_set_reload_bools() interface from Ivan Gyurdiev, + to enable runtime control over preserving active boolean values + versus reloading their saved settings upon commit. + +* Mon Nov 7 2005 Dan Walsh 1.3.43-1 +- Upgrade to latest from NSA + * Merged seuser parser resync, dbase tracking and cleanup, strtol + bug, copyright, and assert space patches from Ivan Gyurdiev. + * Added src/*_internal.h in preparation for other changes. + * Added hidden/hidden_proto/hidden_def to src/debug.[hc] and + src/seusers.[hc]. + + +* Thu Nov 3 2005 Dan Walsh 1.3.41-1 +- Upgrade to latest from NSA + * Merged interface parse/print, context_to_string interface change, + move assert_noeof, and order preserving patches from Ivan Gyurdiev. + * Added src/dso.h in preparation for other changes. + * Merged install seusers, handle/error messages, MLS parsing, + and seusers validation patches from Ivan Gyurdiev. + +* Mon Oct 31 2005 Dan Walsh 1.3.39-1 +- Upgrade to latest from NSA + * Merged record interface, dbase flush, common database code, + and record bugfix patches from Ivan Gyurdiev. + +* Fri Oct 28 2005 Dan Walsh 1.3.38-1 +- Upgrade to latest from NSA + * Merged dbase policydb list and count change from Ivan Gyurdiev. + * Merged enable dbase and set relay patches from Ivan Gyurdiev. + +* Thu Oct 27 2005 Dan Walsh 1.3.36-1 +- Update from NSA + * Merged query APIs and dbase_file_set patches from Ivan Gyurdiev. + +* Wed Oct 26 2005 Dan Walsh 1.3.35-1 +- Update from NSA + * Merged sepol handle passing, seusers support, and policydb cache + patches from Ivan Gyurdiev. + +* Tue Oct 25 2005 Dan Walsh 1.3.34-1 +- Update from NSA + * Merged resync to sepol changes and booleans fixes/improvements + patches from Ivan Gyurdiev. + * Merged support for genhomedircon/homedir template, store selection, + explicit policy reload, and semanage.conf relocation from Joshua + Brindle. + +* Mon Oct 24 2005 Dan Walsh 1.3.32-1 +- Update from NSA + * Merged resync to sepol changes and transaction fix patches from + Ivan Gyurdiev. + * Merged reorganize users patch from Ivan Gyurdiev. + * Merged remove unused relay functions patch from Ivan Gyurdiev. + +* Fri Oct 21 2005 Dan Walsh 1.3.30-1 +- Update from NSA + * Fixed policy file leaks in semanage_load_module and + semanage_write_module. + * Merged further database work from Ivan Gyurdiev. + * Fixed bug in semanage_direct_disconnect. + +* Thu Oct 20 2005 Dan Walsh 1.3.28-1 +- Update from NSA + * Merged interface renaming patch from Ivan Gyurdiev. + * Merged policy component patch from Ivan Gyurdiev. + * Renamed 'check=' configuration value to 'expand-check=' for + clarity. + * Changed semanage_commit_sandbox to check for and report errors + on rename(2) calls performed during rollback. + * Added optional check= configuration value to semanage.conf + and updated call to sepol_expand_module to pass its value + to control assertion and hierarchy checking on module expansion. + * Merged fixes for make DESTDIR= builds from Joshua Brindle. + +* Tue Oct 18 2005 Dan Walsh 1.3.24-1 +- Update from NSA + * Merged default database from Ivan Gyurdiev. + * Merged removal of connect requirement in policydb backend from + Ivan Gyurdiev. + * Merged commit locking fix and lock rename from Joshua Brindle. + * Merged transaction rollback in lock patch from Joshua Brindle. + * Changed default args for load_policy to be null, as it no longer + takes a pathname argument and we want to preserve booleans. + * Merged move local dbase initialization patch from Ivan Gyurdiev. + * Merged acquire/release read lock in databases patch from Ivan Gyurdiev. + * Merged rename direct -> policydb as appropriate patch from Ivan Gyurdiev. + * Added calls to sepol_policy_file_set_handle interface prior + to invoking sepol operations on policy files. + * Updated call to sepol_policydb_from_image to pass the handle. + + +* Tue Oct 18 2005 Dan Walsh 1.3.20-1 +- Update from NSA + * Changed default args for load_policy to be null, as it no longer + takes a pathname argument and we want to preserve booleans. + * Merged move local dbase initialization patch from Ivan Gyurdiev. + * Merged acquire/release read lock in databases patch from Ivan Gyurdiev. + * Merged rename direct -> policydb as appropriate patch from Ivan Gyurdiev. + * Added calls to sepol_policy_file_set_handle interface prior + to invoking sepol operations on policy files. + * Updated call to sepol_policydb_from_image to pass the handle. + +* Tue Oct 18 2005 Dan Walsh 1.3.20-1 +- Update from NSA + * Merged user and port APIs - policy database patch from Ivan + Gyurdiev. + * Converted calls to sepol link_packages and expand_module interfaces + from using buffers to using sepol handles for error reporting, and + changed direct_connect/disconnect to create/destroy sepol handles. + +* Sat Oct 15 2005 Dan Walsh 1.3.18-1 +- Update from NSA + * Merged bugfix patch from Ivan Gyurdiev. + * Merged seuser database patch from Ivan Gyurdiev. + Merged direct user/port databases to the handle from Ivan Gyurdiev. + * Removed obsolete include/semanage/commit_api.h (leftover). + Merged seuser record patch from Ivan Gyurdiev. + * Merged boolean and interface databases from Ivan Gyurdiev. + +* Fri Oct 14 2005 Dan Walsh 1.3.14-1 +- Update from NSA + * Updated to use get interfaces for hidden sepol_module_package type. + * Changed semanage_expand_sandbox and semanage_install_active + to generate/install the latest policy version supported by libsepol + by default (unless overridden by semanage.conf), since libselinux + will now downgrade automatically for load_policy. + * Merged new callback-based error reporting system and ongoing + database work from Ivan Gyurdiev. + +* Wed Oct 12 2005 Dan Walsh 1.3.11-1 +- Update from NSA + * Fixed semanage_install_active() to use the same logic for + selecting a policy version as semanage_expand_sandbox(). Dropped + dead code from semanage_install_sandbox(). + +* Mon Oct 10 2005 Dan Walsh 1.3.10-1 +- Update from NSA + * Updated for changes to libsepol, and to only use types and interfaces + provided by the shared libsepol. + +* Fri Oct 7 2005 Dan Walsh 1.3.9-1 +- Update from NSA + * Merged further database work from Ivan Gyurdiev. + +* Tue Oct 4 2005 Dan Walsh 1.3.8-1 +- Update from NSA + * Merged iterate, redistribute, and dbase split patches from + Ivan Gyurdiev. + +* Mon Oct 3 2005 Dan Walsh 1.3.7-1 +- Update from NSA + * Merged patch series from Ivan Gyurdiev. + (pointer typedef elimination, file renames, dbase work, backend + separation) + * Split interfaces from semanage.[hc] into handle.[hc], modules.[hc]. + * Separated handle create from connect interface. + * Added a constructor for initialization. + * Moved up src/include/*.h to src. + * Created a symbol map file; dropped dso.h and hidden markings. + +* Wed Sep 28 2005 Dan Walsh 1.3.5-1 +- Update from NSA + * Split interfaces from semanage.[hc] into handle.[hc], modules.[hc]. + * Separated handle create from connect interface. + * Added a constructor for initialization. + * Moved up src/include/*.h to src. + * Created a symbol map file; dropped dso.h and hidden markings. + +* Fri Sep 23 2005 Dan Walsh 1.3.4-1 +- Update from NSA + * Merged dbase redesign patch from Ivan Gyurdiev. + +* Wed Sep 21 2005 Dan Walsh 1.3.3-1 +- Update from NSA + * Merged boolean record, stub record handler, and status codes + patches from Ivan Gyurdiev. + +* Tue Sep 20 2005 Dan Walsh 1.3.2-1 +- Update from NSA + * Merged stub iterator functionality from Ivan Gyurdiev. + * Merged interface record patch from Ivan Gyurdiev. + +* Wed Sep 14 2005 Dan Walsh 1.3.1-1 +- Update from NSA + * Merged stub functionality for managing user and port records, + and record table code from Ivan Gyurdiev. + * Updated version for release. + +* Thu Sep 1 2005 Dan Walsh 1.1.6-1 +- Update from NSA + * Merged semod.conf template patch from Dan Walsh (Red Hat), + but restored location to /usr/share/semod/semod.conf. + * Fixed several bugs found by valgrind. + * Fixed bug in prior patch for the semod_build_module_list leak. + * Merged errno fix from Joshua Brindle (Tresys). + * Merged fix for semod_build_modules_list leak on error path + from Serge Hallyn (IBM). Bug found by Coverity. + +* Thu Aug 25 2005 Dan Walsh 1.1.3-1 +- Update from NSA + * Merged errno fix from Joshua Brindle (Tresys). + * Merged fix for semod_build_modules_list leak on error path + from Serge Hallyn (IBM). Bug found by Coverity. + * Merged several fixes from Serge Hallyn (IBM). Bugs found by + Coverity. + * Fixed several other bugs and warnings. + * Merged patch to move module read/write code from libsemanage + to libsepol from Jason Tang (Tresys). + * Merged relay records patch from Ivan Gyurdiev. + * Merged key extract patch from Ivan Gyurdiev. + +- Initial version +- Created by Stephen Smalley diff --git a/semanage.conf b/semanage.conf new file mode 100644 index 0000000..ca21c5b --- /dev/null +++ b/semanage.conf @@ -0,0 +1,58 @@ +# Authors: Jason Tang +# +# Copyright (C) 2004-2005 Tresys Technology, LLC +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Specify how libsemanage will interact with a SELinux policy manager. +# The four options are: +# +# "source" - libsemanage manipulates a source SELinux policy +# "direct" - libsemanage will write directly to a module store. +# /foo/bar - Write by way of a policy management server, whose +# named socket is at /foo/bar. The path must begin +# with a '/'. +# foo.com:4242 - Establish a TCP connection to a remote policy +# management server at foo.com. If there is a colon +# then the remainder is interpreted as a port number; +# otherwise default to port 4242. +module-store = direct + +# When generating the final linked and expanded policy, by default +# semanage will set the policy version to POLICYDB_VERSION_MAX, as +# given in . Change this setting if a different +# version is necessary. +#policy-version = 19 + +# expand-check check neverallow rules when executing all semanage +# commands. There might be a penalty in execution time if this +# option is enabled. +expand-check=0 + +# usepasswd check tells semanage to scan all pass word records for home directories +# and setup the labeling correctly. If this is turned off, SELinux will label /home +# correctly only. You will need to use semanage fcontext command. +# For example, if you had home dirs in /althome directory you would have to execute +# semanage fcontext -a -e /home /althome +usepasswd=False +bzip-small=true +bzip-blocksize=5 +ignoredirs=/root +optimize-policy=true + +[sefcontext_compile] +path = /usr/sbin/sefcontext_compile +args = -r $@ +[end] diff --git a/sources b/sources new file mode 100644 index 0000000..b213d73 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (libsemanage-3.1.tar.gz) = 8609ca7d13b5c603677740f2b14558fea3922624af182d20d618237ba11fcf2559fab82fc68d1efa6ff118f064d426f005138521652c761de92cd66150102197 diff --git a/tests/semanage-handle-functions/Makefile b/tests/semanage-handle-functions/Makefile new file mode 100644 index 0000000..c49dbe0 --- /dev/null +++ b/tests/semanage-handle-functions/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/libsemanage/Sanity/semanage-handle-functions +# Description: Test functions from handle.h +# Author: Jan Zarsky +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/libsemanage/Sanity/semanage-handle-functions +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE functions.c test_*.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Jan Zarsky " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test functions from handle.h" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: libsemanage" >> $(METADATA) + @echo "Requires: libsemanage libsemanage-devel glibc gcc" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/semanage-handle-functions/PURPOSE b/tests/semanage-handle-functions/PURPOSE new file mode 100644 index 0000000..09a8e19 --- /dev/null +++ b/tests/semanage-handle-functions/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/libsemanage/Sanity/semanage-handle-functions +Description: Test functions from handle.h +Author: Jan Zarsky diff --git a/tests/semanage-handle-functions/functions.c b/tests/semanage-handle-functions/functions.c new file mode 100644 index 0000000..7722c09 --- /dev/null +++ b/tests/semanage-handle-functions/functions.c @@ -0,0 +1,132 @@ +#include +#include +#include +#include +#include + +void check_result_int(const char *expected, int real) { + int exp = strtol(expected, NULL, 10); + + if (exp != real) { + fprintf(stderr, "Expected %d but got %d\n", exp, real); + exit(1); + } +} + +semanage_handle_t *test_handle_create() { + semanage_handle_t *sh = NULL; + + sh = semanage_handle_create(); + printf("semanage_handle_create(): %p\n", (void *) sh); + + if (sh == NULL) { + perror("semanage_handle_create"); + exit(1); + } + + return sh; +} + +int test_connect(semanage_handle_t *sh) { + int result = semanage_connect(sh); + printf("semanage_connect(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_connect"); + exit(1); + } + + return result; +} + +int test_disconnect(semanage_handle_t *sh) { + int result = semanage_disconnect(sh); + printf("semanage_disconnect(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_disconnect"); + exit(1); + } + + return result; +} + +int test_begin_transaction(semanage_handle_t *sh) { + int result = semanage_begin_transaction(sh); + printf("semanage_begin_transaction(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_begin_transaction"); + exit(1); + } + + return result; +} + +int test_commit(semanage_handle_t *sh) { + int result = semanage_commit(sh); + printf("semanage_commit(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_commit"); + exit(1); + } + + return result; +} + +#define STATE_INIT 1 +#define STATE_HANDLE 2 +#define STATE_CONN 3 +#define STATE_TRANS 4 + +int get_state(const char *state_str) { + if (strcmp(state_str, "init") == 0) + return STATE_INIT; + if (strcmp(state_str, "handle") == 0) + return STATE_HANDLE; + if (strcmp(state_str, "conn") == 0) + return STATE_CONN; + if (strcmp(state_str, "trans") == 0) + return STATE_TRANS; + + return 0; +} + +semanage_handle_t * get_handle(const char *state_str) { + int state; + semanage_handle_t *sh = NULL; + + state = get_state(state_str); + + if (state >= STATE_INIT) + sh = NULL; + + if (state >= STATE_HANDLE) + sh = test_handle_create(); + + if (state >= STATE_CONN) + test_connect(sh); + + if (state >= STATE_TRANS) + test_begin_transaction(sh); + + return sh; +} + +void destroy_handle(semanage_handle_t *sh, const char *state_str) { + int state; + + state = get_state(state_str); + + if (state >= STATE_TRANS) + test_commit(sh); + + if (state >= STATE_CONN) + test_disconnect(sh); + + if (state >= STATE_HANDLE) { + semanage_handle_destroy(sh); + printf("semanage_handle_destroy(%p)\n", (void *) sh); + } +} diff --git a/tests/semanage-handle-functions/plan.txt b/tests/semanage-handle-functions/plan.txt new file mode 100644 index 0000000..521a914 --- /dev/null +++ b/tests/semanage-handle-functions/plan.txt @@ -0,0 +1,29 @@ + init handle conn trans +semanage_set_root x ok ok ok - +semanage_root x ok ok ok - +semanage_handle_create x ok - - - +semanage_set_rebuild fail ok ok - +semanage_set_reload fail ok ok - +semanage_get_hll_compiler_path fail ? ? - +semanage_set_create_store fail ok ok - should be called after connect +semanage_get_disable_dontaudit fail ? ? - +semanage_set_disable_dontaudit fail ? ? - +semanage_get_preserve_tunables fail ? ? - +semanage_set_preserve_tunables fail ? ? - +semanage_get_ignore_module_cache fail ? ? - +semanage_set_ignore_module_cache fail ? ? - +semanage_set_check_contexts fail ok ok - +semanage_get_default_priority fail ok ok - +semanage_set_default_priority fail ok ok - +semanage_is_connected x fail ok ok - +semanage_select_store fail ok ok - should be called before connect +semanage_set_store_root fail ok ok - +semanage_is_managed x fail ok fail - +semanage_mls_enabled x fail ? ok - +semanage_connect x fail ok ? - +semanage_access_check x fail ok ? - +semanage_disconnect x fail fail ok - ok when disconnected twice +semanage_handle_destroy x fail ok ok - +semanage_begin_transaction x fail fail ok ok ok when begin twice +semanage_commit x fail fail fail ok +semanage_reload_policy fail ? ? ? diff --git a/tests/semanage-handle-functions/runtest.sh b/tests/semanage-handle-functions/runtest.sh new file mode 100755 index 0000000..801aae7 --- /dev/null +++ b/tests/semanage-handle-functions/runtest.sh @@ -0,0 +1,122 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/libsemanage/Sanity/semanage-handle-functions +# Description: Test functions from handle.h +# Author: Jan Zarsky +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="libsemanage" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm ${PACKAGE} + rlAssertRpm ${PACKAGE}-devel + rlAssertRpm "glibc" + rlAssertRpm "gcc" + + if rlIsRHEL ">=7" || rlIsFedora; then + rlRun -l "gcc test_root.c -o test_root -lsemanage -Wall -Wextra -std=c99" + fi + + rlRun -l "gcc test_handle_create.c -o test_handle_create -lsemanage -Wall -Wextra -Wno-unused-parameter -std=c99" + rlRun -l "gcc test_access_check.c -o test_access_check -lsemanage -Wall -Wextra -std=c99" + rlRun -l "gcc test_is_managed.c -o test_is_managed -lsemanage -Wall -Wextra -std=c99" + rlRun -l "gcc test_connect.c -o test_connect -lsemanage -Wall -Wextra -std=c99" + rlRun -l "gcc test_is_connected.c -o test_is_connected -lsemanage -Wall -Wextra -std=c99" + rlRun -l "gcc test_mls_enabled.c -o test_mls_enabled -lsemanage -Wall -Wextra -std=c99" + rlRun -l "gcc test_transaction.c -o test_transaction -lsemanage -Wall -Wextra -std=c99" + + ERR_FAIL=1 + ERR_ABORT=134 + rlPhaseEnd + + if rlIsRHEL ">=7" || rlIsFedora; then + rlPhaseStartTest "semanage_root, semanage_test_root" + rlRun "./test_root init" + rlRun "./test_root handle" + rlRun "./test_root conn" + rlRun "./test_root init /somepath" + rlRun "./test_root handle /somepath" + rlRun "./test_root conn /somepath" + rlPhaseEnd + fi + + rlPhaseStartTest "semanage_handle_create, semanage_handle_destroy" + rlRun "./test_handle_create init" + rlPhaseEnd + + rlPhaseStartTest "semanage_access_check" + rlRun "./test_access_check init" $ERR_ABORT + rlRun "./test_access_check handle 2" + rlRun "./test_access_check conn 2" + rlPhaseEnd + + rlPhaseStartTest "semanage_is_managed" + rlRun "./test_is_managed init" $ERR_ABORT + rlRun "./test_is_managed handle 1" + rlRun "./test_is_managed conn" $ERR_FAIL + rlPhaseEnd + + rlPhaseStartTest "semanage_connect, semanage_disconnect" + rlRun "./test_connect init" $ERR_ABORT + rlRun "./test_connect init reversed" $ERR_ABORT + rlRun "./test_connect handle" + rlRun "./test_connect handle twice" + rlRun "./test_connect handle reversed" $ERR_ABORT + # why does it work?? + rlRun "./test_connect conn" + rlPhaseEnd + + rlPhaseStartTest "semanage_is_connected" + rlRun "./test_is_connected init" $ERR_ABORT + rlRun "./test_is_connected handle 0" + rlRun "./test_is_connected conn 1" + rlPhaseEnd + + rlPhaseStartTest "semanage_mls_enabled" + rlRun "./test_mls_enabled init" $ERR_ABORT + rlRun "./test_mls_enabled handle" $ERR_ABORT + rlRun "./test_mls_enabled conn 1" + rlPhaseEnd + + rlPhaseStartTest "semanage_begin_transaction, semanage_commit" + rlRun "./test_transaction init" $ERR_ABORT + rlRun "./test_transaction init reversed" $ERR_ABORT + rlRun "./test_transaction handle" $ERR_ABORT + rlRun "./test_transaction handle reversed" $ERR_ABORT + rlRun "./test_transaction conn" + rlRun "./test_transaction conn twice" + rlRun "./test_transaction conn reversed" $ERR_FAIL + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rm -f output test_root test_handle_create test_access_check \ + test_is_managed test_connect test_is_connected \ + test_mls_enabled test_transaction" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/semanage-handle-functions/test_access_check.c b/tests/semanage-handle-functions/test_access_check.c new file mode 100644 index 0000000..8eb2530 --- /dev/null +++ b/tests/semanage-handle-functions/test_access_check.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + + if (argc < 2) + exit(1); + + sh = get_handle(argv[1]); + + int result = semanage_access_check(sh); + printf("semanage_access_check(%p): %d\n", (void *) sh, result); + + if (result < 0 || (result != 0 && result != SEMANAGE_CAN_READ + && result != SEMANAGE_CAN_WRITE)) { + perror("semanage_access_check"); + exit(1); + } + + if (argc >= 3) + check_result_int(argv[2], result); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-handle-functions/test_connect.c b/tests/semanage-handle-functions/test_connect.c new file mode 100644 index 0000000..df403e0 --- /dev/null +++ b/tests/semanage-handle-functions/test_connect.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + + if (argc < 2) + exit(1); + + sh = get_handle(argv[1]); + + if (argc >= 3 && strcmp(argv[2], "reversed") == 0) { + test_disconnect(sh); + test_connect(sh); + } + else { + test_connect(sh); + test_disconnect(sh); + } + + if (argc >= 3 && strcmp(argv[2], "twice") == 0) { + test_disconnect(sh); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-handle-functions/test_handle_create.c b/tests/semanage-handle-functions/test_handle_create.c new file mode 100644 index 0000000..65d164e --- /dev/null +++ b/tests/semanage-handle-functions/test_handle_create.c @@ -0,0 +1,15 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh = test_handle_create(); + + semanage_handle_destroy(sh); + + exit(0); +} diff --git a/tests/semanage-handle-functions/test_is_connected.c b/tests/semanage-handle-functions/test_is_connected.c new file mode 100644 index 0000000..d428e48 --- /dev/null +++ b/tests/semanage-handle-functions/test_is_connected.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + int result; + + if (argc < 2) + exit(1); + + sh = get_handle(argv[1]); + + result = semanage_is_connected(sh); + printf("semanage_is_connected(%p): %d\n", (void *) sh, result); + + if (result != 0 && result != 1) { + perror("semanage_is_connected"); + exit(1); + } + + if (argc >= 3) + check_result_int(argv[2], result); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-handle-functions/test_is_managed.c b/tests/semanage-handle-functions/test_is_managed.c new file mode 100644 index 0000000..4d11cb0 --- /dev/null +++ b/tests/semanage-handle-functions/test_is_managed.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + int result; + + if (argc < 2) + exit(1); + + sh = get_handle(argv[1]); + + result = semanage_is_managed(sh); + printf("semanage_is_managed(%p): %d\n", (void *) sh, result); + + if (result != 0 && result != 1) { + perror("semanage_is_managed"); + exit(1); + } + + if (argc >= 3) + check_result_int(argv[2], result); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-handle-functions/test_mls_enabled.c b/tests/semanage-handle-functions/test_mls_enabled.c new file mode 100644 index 0000000..7e943f0 --- /dev/null +++ b/tests/semanage-handle-functions/test_mls_enabled.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + int result; + + if (argc < 2) + exit(1); + + sh = get_handle(argv[1]); + + result = semanage_mls_enabled(sh); + printf("semanage_mls_enabled(%p): %d\n", (void *) sh, result); + + if (result != 0 && result != 1) { + perror("semanage_mls_enabled"); + exit(1); + } + + if (argc >= 4) + check_result_int(argv[3], result); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-handle-functions/test_root.c b/tests/semanage-handle-functions/test_root.c new file mode 100644 index 0000000..5786348 --- /dev/null +++ b/tests/semanage-handle-functions/test_root.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + const char *root; + int result; + + if (argc < 2) + exit(1); + + sh = get_handle(argv[1]); + + root = semanage_root(); + printf("semanage_root(): %s\n", root); + + if (root == NULL) { + perror("semanage_root"); + exit(1); + } + + if (argc >= 3) { + result = semanage_set_root(argv[2]); + printf("semanage_set_root(\"%s\"): %d\n", argv[2], result); + + if (root == NULL) { + perror("semanage_set_root"); + exit(1); + } + + root = semanage_root(); + printf("semanage_root(): %s\n", root); + + if (result != 0) { + perror("semanage_root"); + exit(1); + } + + if (strcmp(root, argv[2]) != 0) { + fprintf(stderr, "Expected \"%s\" but got \"%s\"\n", argv[2], root); + exit(1); + } + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-handle-functions/test_transaction.c b/tests/semanage-handle-functions/test_transaction.c new file mode 100644 index 0000000..f1b0e10 --- /dev/null +++ b/tests/semanage-handle-functions/test_transaction.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + + if (argc < 2) + exit(1); + + sh = get_handle(argv[1]); + + if (argc >= 3 && strcmp(argv[2], "reversed") == 0) { + test_commit(sh); + test_begin_transaction(sh); + } + else if (argc >= 3 && strcmp(argv[2], "twice") == 0) { + test_begin_transaction(sh); + test_begin_transaction(sh); + test_commit(sh); + } + else { + test_begin_transaction(sh); + test_commit(sh); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/Makefile b/tests/semanage-seuser-functions/Makefile new file mode 100644 index 0000000..d7202f4 --- /dev/null +++ b/tests/semanage-seuser-functions/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/libsemanage/Sanity/semanage-seuser-functions +# Description: Test semanage_seuser_* functions +# Author: Jan Zarsky +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/libsemanage/Sanity/semanage-seuser-functions +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE functions.c test_*.c + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Jan Zarsky " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Test semanage_seuser_* functions" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 5m" >> $(METADATA) + @echo "RunFor: libsemanage" >> $(METADATA) + @echo "Requires: libsemanage libsemanage-devel glibc gcc" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/semanage-seuser-functions/PURPOSE b/tests/semanage-seuser-functions/PURPOSE new file mode 100644 index 0000000..6b5201a --- /dev/null +++ b/tests/semanage-seuser-functions/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/libsemanage/Sanity/semanage-seuser-functions +Description: Test semanage_seuser_* functions +Author: Jan Zarsky diff --git a/tests/semanage-seuser-functions/functions.c b/tests/semanage-seuser-functions/functions.c new file mode 100644 index 0000000..ecde15d --- /dev/null +++ b/tests/semanage-seuser-functions/functions.c @@ -0,0 +1,263 @@ +#include +#include +#include +#include +#include + +void check_result_int(const char *expected, int real) { + int exp = strtol(expected, NULL, 10); + + if (exp != real) { + fprintf(stderr, "Expected %d but got %d\n", exp, real); + exit(1); + } +} + +semanage_handle_t *test_handle_create() { + semanage_handle_t *sh = NULL; + + sh = semanage_handle_create(); + printf("semanage_handle_create(): %p\n", (void *) sh); + + if (sh == NULL) { + perror("semanage_handle_create"); + exit(2); + } + + return sh; +} + +int test_connect(semanage_handle_t *sh) { + int result = semanage_connect(sh); + printf("semanage_connect(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_connect"); + exit(2); + } + + return result; +} + +int test_disconnect(semanage_handle_t *sh) { + int result = semanage_disconnect(sh); + printf("semanage_disconnect(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_disconnect"); + exit(2); + } + + return result; +} + +int test_begin_transaction(semanage_handle_t *sh) { + int result = semanage_begin_transaction(sh); + printf("semanage_begin_transaction(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_begin_transaction"); + exit(2); + } + + return result; +} + +int test_commit(semanage_handle_t *sh) { + int result = semanage_commit(sh); + printf("semanage_commit(%p): %d\n", (void *) sh, result); + + if (result != 0) { + perror("semanage_commit"); + exit(2); + } + + return result; +} + +semanage_seuser_key_t *test_get_key(semanage_handle_t *sh, const char *name) { + semanage_seuser_key_t *key; + int result = semanage_seuser_key_create(sh, name, &key); + printf("semanage_seuser_key_create(%p, %s, %p): %d\n", + (void *) sh, name, (void *) &key, result); + + if (key == NULL || result < 0) { + perror("semanage_seuser_key_create"); + exit(2); + } + + return key; +} + +semanage_seuser_t *test_get_seuser_nth(semanage_handle_t *sh, unsigned int index) { + int result; + semanage_seuser_t **records; + unsigned int count; + + result = semanage_seuser_list(sh, &records, &count); + printf("semanage_seuser_list(%p, %p, %p): %d\n", + (void *) sh, (void *) &records, (void *) &count, result); + + if (result < 0) { + perror("semanage_seuser_list"); + exit(2); + } + + if (count < index + 1) + exit(2); + + return records[index]; +} + +semanage_seuser_t *test_get_seuser_new(semanage_handle_t *sh) { + int result; + semanage_seuser_t *seuser; + + result = semanage_seuser_create(sh, &seuser); + printf("semanage_seuser_create(%p, %p): %d\n", + (void *) sh, (void *) seuser, result); + + if (result < 0) { + perror("semanage_seuser_create"); + exit(2); + } + + return seuser; +} + +semanage_seuser_t *test_get_seuser(semanage_handle_t *sh, const char *param) { + if (strcmp(param, "new") == 0) + return test_get_seuser_new(sh); + + if (strcmp(param, "first") == 0) + return test_get_seuser_nth(sh, 0); + + if (strcmp(param, "second") == 0) + return test_get_seuser_nth(sh, 1); + + fprintf(stderr, "Unknown seuser \"%s\" specified\n", param); + exit(2); +} + +void test_add_local_seuser(semanage_handle_t *sh, semanage_seuser_t *seuser) { + int result; + semanage_seuser_key_t *key; + + result = semanage_seuser_key_extract(sh, seuser, &key); + printf("semanage_seuser_key_extract(%p, %p, %p): %d\n", + (void *) sh, (void *) seuser, (void *) &key, result); + + if (result < 0) { + perror("semanage_seuser_key_extract"); + exit(2); + } + + result = semanage_seuser_modify_local(sh, key, seuser); + printf("semanage_seuser_modify_local(%p, %p, %p): %d\n", + (void *) seuser, (void *) key, (void *) seuser, result); + + if (result < 0) { + perror("semanage_seuser_modify_local"); + exit(2); + } +} + +void test_del_local_seuser(semanage_handle_t *sh, semanage_seuser_t *seuser) { + int result; + semanage_seuser_key_t *key; + + result = semanage_seuser_key_extract(sh, seuser, &key); + printf("semanage_seuser_key_extract(%p, %p, %p): %d\n", + (void *) sh, (void *) seuser, (void *) &key, result); + + if (result < 0) { + perror("semanage_seuser_key_extract"); + exit(2); + } + + result = semanage_seuser_del_local(sh, key); + printf("semanage_seuser_del_local(%p, %p): %d\n", + (void *) seuser, (void *) key, result); + + if (result < 0) { + perror("semanage_seuser_del_local"); + exit(2); + } +} + +#define STATE_INIT 1 +#define STATE_HANDLE 2 +#define STATE_CONN 3 +#define STATE_TRANS 4 + +int get_state(const char *state_str) { + if (strcmp(state_str, "init") == 0) + return STATE_INIT; + if (strcmp(state_str, "handle") == 0) + return STATE_HANDLE; + if (strcmp(state_str, "conn") == 0) + return STATE_CONN; + if (strcmp(state_str, "trans") == 0) + return STATE_TRANS; + + return 0; +} + +semanage_handle_t * get_handle(const char *state_str) { + int state; + semanage_handle_t *sh = NULL; + + state = get_state(state_str); + + if (state >= STATE_INIT) + sh = NULL; + + if (state >= STATE_HANDLE) + sh = test_handle_create(); + + if (state >= STATE_CONN) + test_connect(sh); + + if (state >= STATE_TRANS) + test_begin_transaction(sh); + + return sh; +} + +void destroy_handle(semanage_handle_t *sh, const char *state_str) { + int state; + + state = get_state(state_str); + + if (state >= STATE_TRANS) + test_commit(sh); + + if (state >= STATE_CONN) + test_disconnect(sh); + + if (state >= STATE_HANDLE) { + semanage_handle_destroy(sh); + printf("semanage_handle_destroy(%p)\n", (void *) sh); + } +} + +int strcmp_null(const char *str1, const char *str2) { + if (str1 == NULL && str2 == NULL) + return 0; + + if (str1 == NULL) { + if (strcmp(str2, "NULL") == 0) + return 0; + else + return -1; + } + + if (str2 == NULL) { + if (strcmp(str1, "NULL") == 0) + return 0; + else + return 1; + } + + return strcmp(str1, str2); +} diff --git a/tests/semanage-seuser-functions/runtest.sh b/tests/semanage-seuser-functions/runtest.sh new file mode 100755 index 0000000..a1bcbb7 --- /dev/null +++ b/tests/semanage-seuser-functions/runtest.sh @@ -0,0 +1,255 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/libsemanage/Sanity/semanage-seuser-functions +# Description: Test semanage_seuser_* functions +# Author: Jan Zarsky +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="libsemanage" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm ${PACKAGE} + rlAssertRpm ${PACKAGE}-devel + rlAssertRpm "glibc" + rlAssertRpm "gcc" + + for f in test_*.c ; do + out=$(echo -n $f | cut -d'.' -f1) + rlRun "gcc $f -o $out -lsemanage -Wall -Wextra -Werror -std=c99" + done + + POLICY_TYPE="$(grep -E '^SELINUXTYPE=' /etc/selinux/config | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' | tr -d ' ')" + + if rlIsFedora; then + SEUSERS_PATH="/var/lib/selinux/$POLICY_TYPE/active/seusers" + elif rlIsRHEL '>=7'; then + SEUSERS_PATH="/etc/selinux/$POLICY_TYPE/active/seusers" + else + SEUSERS_PATH="/etc/selinux/$POLICY_TYPE/seusers" + fi + + rlRun "cat $SEUSERS_PATH" + + SEUSERS_COUNT="$(cat $SEUSERS_PATH | grep -vE '^#|^$' | wc -l)" + rlRun "[[ \"$SEUSERS_COUNT\" -gt 0 ]]" + + SEUSERS="$(cat $SEUSERS_PATH | grep -vE '^#|^$' | cut -d':' -f1 | tr '\n' ' ')" + rlRun "[[ -n \"$SEUSERS\" ]]" + + first_line="$(cat $SEUSERS_PATH | grep -vE '^#|^$' | head -n 1)" + SEUSER="$(echo -n $first_line | cut -d':' -f1)" + rlRun "[[ -n \"$SEUSER\" ]]" + SEUSER_SENAME="$(echo -n $first_line | cut -d':' -f2)" + rlRun "[[ -n \"$SEUSER_SENAME\" ]]" + SEUSER_MLSRANGE="$(echo -n $first_line | cut -d':' -f3-4)" + rlRun "[[ -n \"$SEUSER_MLSRANGE\" ]]" + + SEUSER_NONEXISTENT="nonuser" + SEUSER_DEFAULT="__default__" + + ERR_FAIL=1 + ERR_ABORT=134 + ERR_SEGFAULT=139 + + # note: each test_*.c program takes first argument which specifies setup + # before executing specified function + # init semanage handle == NULL + # handle semanage handle obtained via semanage_handle_create + # conn connected via semanage_connect + # trans inside transaction, via semanage_begin_transaction + # program returns 1 on error in function, 2 on error in setup + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_key_create, semanage_seuser_key_free" + # FIXME + # rlRun "./test_key_create init $SEUSER" $ERR_ABORT,$ERR_SEGFAULT + # rlRun "./test_key_create handle $SEUSER" $ERR_FAIL + rlRun "./test_key_create conn $SEUSER" + rlRun "./test_key_create trans $SEUSER" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_key_extract" + # FIXME + #rlRun "./test_key_extract conn new" + rlRun "./test_key_extract conn first" + # FIXME + #rlRun "./test_key_extract trans new" + rlRun "./test_key_extract trans first" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_compare" + rlRun "./test_compare conn $SEUSER same" + rlRun "./test_compare conn $SEUSER_NONEXISTENT different" + rlRun "./test_compare trans $SEUSER same" + rlRun "./test_compare trans $SEUSER_NONEXISTENT different" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_compare2" + rlRun "./test_compare2 conn NULL 0" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_compare2 conn 0 NULL" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_compare2 conn NULL NULL" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_compare2 conn 0 0" + rlRun "./test_compare2 conn 0 1" + rlRun "./test_compare2 trans NULL 0" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_compare2 trans 0 NULL" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_compare2 trans NULL NULL" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_compare2 trans 0 0" + rlRun "./test_compare2 trans 0 1" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_count" + rlRun "./test_count init" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_count handle" $ERR_FAIL + rlRun "./test_count conn $SEUSERS_COUNT" + rlRun "./test_count trans $SEUSERS_COUNT" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_list" + rlRun "./test_list init" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_list handle" $ERR_FAIL + rlRun "./test_list conn $SEUSERS_COUNT $SEUSERS" + rlRun "./test_list trans $SEUSERS_COUNT $SEUSERS" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_iterate" + rlRun "./test_iterate init" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_iterate handle" $ERR_FAIL + rlRun "./test_iterate conn $SEUSERS" + rlRun "./test_iterate trans $SEUSERS" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_exists" + rlRun "./test_exists conn $SEUSER_NONEXISTENT 0" + rlRun "./test_exists conn $SEUSER_DEFAULT 1" + rlRun "./test_exists conn $USER 1" + rlRun "./test_exists trans $SEUSER_NONEXISTENT 0" + rlRun "./test_exists trans $SEUSER_DEFAULT 1" + rlRun "./test_exists trans $SEUSER 1" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_query" + rlRun "./test_query conn $SEUSER_NONEXISTENT" $ERR_FAIL + rlRun "./test_query conn $SEUSER_DEFAULT" + rlRun "./test_query conn $SEUSER" + rlRun "./test_query trans $SEUSER_NONEXISTENT" $ERR_FAIL + rlRun "./test_query trans $SEUSER_DEFAULT" + rlRun "./test_query trans $SEUSER" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_get_name" + rlRun "./test_get_name conn new NULL" + rlRun "./test_get_name conn first $SEUSER" + rlRun "./test_get_name trans new NULL" + rlRun "./test_get_name trans first $SEUSER" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_set_name" + name="someuser" + rlRun "./test_set_name conn $name" + rlRun "./test_set_name trans $name" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_get_sename" + rlRun "./test_get_sename conn new NULL" + rlRun "./test_get_sename conn first $SEUSER_SENAME" + rlRun "./test_get_sename trans new NULL" + rlRun "./test_get_sename trans first $SEUSER_SENAME" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_set_sename" + sename="someuser_u" + rlRun "./test_set_sename conn $sename" + rlRun "./test_set_sename trans $sename" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_get_mlsrange" + rlRun "./test_get_mlsrange conn new NULL" + rlRun "./test_get_mlsrange conn first $SEUSER_MLSRANGE" + rlRun "./test_get_mlsrange trans new NULL" + rlRun "./test_get_mlsrange trans first $SEUSER_MLSRANGE" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_set_mlsrange" + mlsrange="c0-s1:c0.c42" + rlRun "./test_set_mlsrange conn $mlsrange" + rlRun "./test_set_mlsrange trans $mlsrange" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_clone" + # FIXME + #rlRun "./test_clone conn new" + rlRun "./test_clone conn first" + # FIXME + #rlRun "./test_clone trans new" + rlRun "./test_clone trans first" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_create" + # FIXME + #rlRun "./test_create init" $ERR_ABORT,$ERR_SEGFAULT + #rlRun "./test_create handle" $ERR_ABORT,$ERR_SEGFAULT + rlRun "./test_create conn" + rlRun "./test_create trans" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_modify_local" + # function requires transaction + #rlRun "./test_modify_local conn new" $ERR_FAIL + #rlRun "./test_modify_local conn first" $ERR_FAIL + #rlRun "./test_modify_local trans new" $ERR_FAIL + rlRun "./test_modify_local trans first" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_del_local" + # adding local seuser requires transaction + # FIXME + #rlRun "./test_del_local trans first new" + #rlRun "./test_del_local trans first second" + rlRun "./test_del_local trans first first" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_exists_local" + # adding local seuser requires transaction + rlRun "./test_exists_local trans first first 1" + rlRun "./test_exists_local trans first second 0" + rlPhaseEnd + + rlPhaseStartTest "semanage_seuser_count_local" + # adding local seuser requires transaction + # FIXME + #rlRun "./test_count_local trans 0" + rlRun "./test_count_local trans 1" + rlRun "./test_count_local trans 2" + rlPhaseEnd + + rlPhaseStartCleanup + testfiles="$(ls -1 test_* | grep -v '\.c' | tr '\n' ' ')" + rlRun "rm -f $testfiles" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/semanage-seuser-functions/test_clone.c b/tests/semanage-seuser-functions/test_clone.c new file mode 100644 index 0000000..8c2554f --- /dev/null +++ b/tests/semanage-seuser-functions/test_clone.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + semanage_seuser_t *seuser_clone; + int result; + const char *str; + const char *str_clone; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + + result = semanage_seuser_clone(sh, seuser, &seuser_clone); + printf("semanage_seuser_clone(%p, %p): %d\n", + (void *) seuser, (void *) seuser_clone, result); + + if (result < 0) { + perror("semanage_seuser_clone"); + exit(1); + } + + str = semanage_seuser_get_name(seuser); + str_clone = semanage_seuser_get_name(seuser_clone); + + if (strcmp(str, str_clone) != 0) { + fprintf(stderr, "Different in get_name\n"); + exit(1); + } + + str = semanage_seuser_get_sename(seuser); + str_clone = semanage_seuser_get_sename(seuser_clone); + + if (strcmp(str, str_clone) != 0) { + fprintf(stderr, "Different in get_sename\n"); + exit(1); + } + + str = semanage_seuser_get_mlsrange(seuser); + str_clone = semanage_seuser_get_mlsrange(seuser_clone); + + if (strcmp(str, str_clone) != 0) { + fprintf(stderr, "Different in get_mlsrange\n"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_compare.c b/tests/semanage-seuser-functions/test_compare.c new file mode 100644 index 0000000..5615463 --- /dev/null +++ b/tests/semanage-seuser-functions/test_compare.c @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + semanage_seuser_key_t *key; + int result; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, "first"); + + key = test_get_key(sh, argv[2]); + + result = semanage_seuser_compare(seuser, key); + printf("semanage_seuser_compare(%p, %p): %d\n", + (void *) seuser, (void *) key, result); + + if (argc >= 4) { + if (strcmp(argv[3], "same") == 0 && result != 0) { + fprintf(stderr, "Expected same but got different\n"); + exit(1); + } + else if (strcmp(argv[3], "different") == 0 && result == 0) { + fprintf(stderr, "Expected different but got same\n"); + exit(1); + } + } + + semanage_seuser_key_free(key); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_compare2.c b/tests/semanage-seuser-functions/test_compare2.c new file mode 100644 index 0000000..afeec07 --- /dev/null +++ b/tests/semanage-seuser-functions/test_compare2.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + semanage_seuser_t *seuser2; + int result; + int first = -1; + int second = -1; + + if (argc < 4) + exit(2); + + sh = get_handle(argv[1]); + + if (strcmp(argv[2], "NULL") == 0) { + seuser = NULL; + } + else { + first = strtol(argv[2], NULL, 10); + seuser = test_get_seuser_nth(sh, first); + } + + if (strcmp(argv[3], "NULL") == 0) { + seuser2 = NULL; + } + else { + second = strtol(argv[3], NULL, 10); + seuser2 = test_get_seuser_nth(sh, second); + } + + result = semanage_seuser_compare2(seuser, seuser2); + printf("semanage_seuser_compare(%p, %p): %d\n", + (void *) seuser, (void *) seuser2, result); + + if (first == second && result != 0) { + fprintf(stderr, "Expected same but got different\n"); + exit(1); + } + else if (first != second && result == 0) { + fprintf(stderr, "Expected different but got same\n"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_count.c b/tests/semanage-seuser-functions/test_count.c new file mode 100644 index 0000000..7fabe4b --- /dev/null +++ b/tests/semanage-seuser-functions/test_count.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + unsigned int response; + int result; + + if (argc < 2) + exit(2); + + sh = get_handle(argv[1]); + + result = semanage_seuser_count(sh, &response); + printf("semanage_seuser_count(%p, %p): %d, response: %u\n", + (void *) sh, (void *) &response, result, response); + + if (result < 0) { + perror("semanage_seuser_count"); + exit(1); + } + + if (argc >= 3) + check_result_int(argv[2], response); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_count_local.c b/tests/semanage-seuser-functions/test_count_local.c new file mode 100644 index 0000000..f25ab6d --- /dev/null +++ b/tests/semanage-seuser-functions/test_count_local.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + int result; + unsigned int response; + int num; + + if (argc < 2) + exit(2); + + sh = get_handle(argv[1]); + + num = strtol(argv[2], NULL, 10); + + for (int i = 0; i < num; i++) { + seuser = test_get_seuser_nth(sh, i); + + test_add_local_seuser(sh, seuser); + } + + result = semanage_seuser_count_local(sh, &response); + printf("semanage_seuser_count_local(%p, %p): %d, response: %d\n", + (void *) sh, (void *) &response, result, response); + + if (result < 0) { + perror("semanage_seuser_count_local"); + exit(1); + } + + if (argc >= 3) + check_result_int(argv[2], response); + + test_del_local_seuser(sh, seuser); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_create.c b/tests/semanage-seuser-functions/test_create.c new file mode 100644 index 0000000..a5191a0 --- /dev/null +++ b/tests/semanage-seuser-functions/test_create.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + int result; + const char *str; + + if (argc < 2) + exit(2); + + sh = get_handle(argv[1]); + + result = semanage_seuser_create(sh, &seuser); + printf("semanage_seuser_create(%p, %p): %d\n", + (void *) sh, (void *) seuser, result); + + if (result < 0) { + perror("semanage_seuser_create"); + exit(1); + } + + str = semanage_seuser_get_name(seuser); + + if (str != NULL) { + fprintf(stderr, "Expected name == NULL, got %s\n", str); + exit(1); + } + + str = semanage_seuser_get_sename(seuser); + + if (str != NULL) { + fprintf(stderr, "Expected sename == NULL, got %s\n", str); + exit(1); + } + + str = semanage_seuser_get_mlsrange(seuser); + + if (str != NULL) { + fprintf(stderr, "Expected mlsrange == NULL, got %s\n", str); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_del_local.c b/tests/semanage-seuser-functions/test_del_local.c new file mode 100644 index 0000000..eced74a --- /dev/null +++ b/tests/semanage-seuser-functions/test_del_local.c @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + semanage_seuser_t *seuser_del; + semanage_seuser_key_t *key; + semanage_seuser_t **records; + int result; + unsigned int count; + + if (argc < 4) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + + test_add_local_seuser(sh, seuser); + + seuser_del = test_get_seuser(sh, argv[3]); + + result = semanage_seuser_key_extract(sh, seuser_del, &key); + printf("semanage_seuser_key_extract(%p, %p, %p): %d\n", + (void *) sh, (void *) seuser_del, (void *) &key, result); + + if (result < 0) { + perror("semanage_seuser_key_extract"); + exit(2); + } + + result = semanage_seuser_del_local(sh, key); + printf("semanage_seuser_del_local(%p, %p): %d\n", + (void *) seuser, (void *) key, result); + + if (result < 0) { + perror("semanage_seuser_del_local"); + exit(1); + } + + result = semanage_seuser_list_local(sh, &records, &count); + printf("semanage_seuser_list_local(%p, %p, %p): %d\n", + (void *) sh, (void *) &records, (void *) &count, result); + + if (result < 0) { + perror("semanage_seuser_list_local"); + exit(2); + } + + if (count != 0) { + fprintf(stderr, "Number of local seusers is not 0!\n"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_exists.c b/tests/semanage-seuser-functions/test_exists.c new file mode 100644 index 0000000..c0af3b2 --- /dev/null +++ b/tests/semanage-seuser-functions/test_exists.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_key_t *key; + int result; + int response; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + key = test_get_key(sh, argv[2]); + + result = semanage_seuser_exists(sh, key, &response); + printf("semanage_seuser_exists(%p, %p, %p): %d, response: %d\n", + (void *) sh, (void *) key, (void *) &response, result, response); + + if (result < 0) { + perror("semanage_seuser_exists"); + exit(1); + } + + if (argc >= 4) + check_result_int(argv[3], response); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_exists_local.c b/tests/semanage-seuser-functions/test_exists_local.c new file mode 100644 index 0000000..165d5b3 --- /dev/null +++ b/tests/semanage-seuser-functions/test_exists_local.c @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + semanage_seuser_t *seuser_exists; + semanage_seuser_key_t *key; + int result; + int response; + int exp; + + if (argc < 4) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + seuser_exists = test_get_seuser(sh, argv[3]); + + test_add_local_seuser(sh, seuser); + + result = semanage_seuser_key_extract(sh, seuser_exists, &key); + printf("semanage_seuser_key_extract(%p, %p, %p): %d\n", + (void *) sh, (void *) seuser_exists, (void *) &key, result); + if (result < 0) { + perror("semanage_seuser_key_extract"); + exit(2); + } + + result = semanage_seuser_exists_local(sh, key, &response); + printf("semanage_seuser_exists_local(%p, %p, %p): %d\n", + (void *) sh, (void *) key, (void *) &response, result); + + if (result < 0) { + perror("semanage_seuser_exists_local"); + exit(1); + } + + if (argc >= 5) { + exp = strtol(argv[4], NULL, 10); + + if (response != exp) { + fprintf(stderr, "Expected %d but got %d\n", exp, response); + exit(1); + } + } + + test_del_local_seuser(sh, seuser); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_get_mlsrange.c b/tests/semanage-seuser-functions/test_get_mlsrange.c new file mode 100644 index 0000000..97172dc --- /dev/null +++ b/tests/semanage-seuser-functions/test_get_mlsrange.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + + if (argc < 4) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + + const char *name = semanage_seuser_get_mlsrange(seuser); + printf("semanage_seuser_get_mlsrange(%p): %s\n", + (void *) seuser, name); + + if (strcmp_null(argv[3], name) != 0) { + fprintf(stderr, "Expected %s but got %s\n", argv[2], name); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_get_name.c b/tests/semanage-seuser-functions/test_get_name.c new file mode 100644 index 0000000..95d9025 --- /dev/null +++ b/tests/semanage-seuser-functions/test_get_name.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + + if (argc < 4) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + + const char *name = semanage_seuser_get_name(seuser); + printf("semanage_seuser_get_name(%p): %s\n", + (void *) seuser, name); + + if (strcmp_null(argv[3], name) != 0) { + fprintf(stderr, "Expected %s but got %s\n", argv[2], name); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_get_sename.c b/tests/semanage-seuser-functions/test_get_sename.c new file mode 100644 index 0000000..1ed7248 --- /dev/null +++ b/tests/semanage-seuser-functions/test_get_sename.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + + if (argc < 4) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + + const char *name = semanage_seuser_get_sename(seuser); + printf("semanage_seuser_get_sename(%p): %s\n", + (void *) seuser, name); + + if (strcmp_null(argv[3], name) != 0) { + fprintf(stderr, "Expected %s but got %s\n", argv[2], name); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_iterate.c b/tests/semanage-seuser-functions/test_iterate.c new file mode 100644 index 0000000..533087a --- /dev/null +++ b/tests/semanage-seuser-functions/test_iterate.c @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int counter = 0; + +int handler(const semanage_seuser_t *record, void *varg) { + char **args = (char **) varg; + + const char *name = semanage_seuser_get_name(record); + + if (strcmp(name, args[2 + counter++]) != 0) + return -1; + + return 0; +} + +int main (int argc, char **argv) { + semanage_handle_t *sh; + int result; + + if (argc < 2) + exit(2); + + sh = get_handle(argv[1]); + + char **param = NULL; + + if (argc >= 3) { + param = argv; + } + + result = semanage_seuser_iterate(sh, &handler, (void *) param); + printf("semanage_seuser_iterate(%p, %p, %p): %d\n", + (void *) sh, (void *) &handler, (void *) param, result); + + if (result < 0) { + perror("semanage_seuser_iterate"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_key_create.c b/tests/semanage-seuser-functions/test_key_create.c new file mode 100644 index 0000000..8f3aaf5 --- /dev/null +++ b/tests/semanage-seuser-functions/test_key_create.c @@ -0,0 +1,39 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_key_t *key; + const char *name; + int result; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + if (strcmp(argv[2], "NULL") == 0) + name = NULL; + else + name = argv[2]; + + result = semanage_seuser_key_create(sh, name, &key); + printf("semanage_seuser_key_create(%p, %s, %p): %d\n", + (void *) sh, name, (void *) &key, result); + + if (result < 0 || key == NULL) { + perror("semanage_seuser_key_create"); + exit(1); + } + + semanage_seuser_key_free(key); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_key_extract.c b/tests/semanage-seuser-functions/test_key_extract.c new file mode 100644 index 0000000..50658dc --- /dev/null +++ b/tests/semanage-seuser-functions/test_key_extract.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + semanage_seuser_key_t *key; + int result; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + + result = semanage_seuser_key_extract(sh, seuser, &key); + printf("semanage_seuser_key_extract(%p, %p, %p): %d\n", + (void *) sh, (void *) seuser, (void *) &key, result); + + if (result < 0) { + perror("semanage_seuser_key_extract"); + exit(1); + } + + result = semanage_seuser_compare(seuser, key); + printf("semanage_seuser_compare(%p, %p): %d\n", + (void *) seuser, (void *) key, result); + + if (result != 0) { + perror("semanage_seuser_compare"); + exit(1); + } + + semanage_seuser_key_free(key); + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_list.c b/tests/semanage-seuser-functions/test_list.c new file mode 100644 index 0000000..ae06187 --- /dev/null +++ b/tests/semanage-seuser-functions/test_list.c @@ -0,0 +1,63 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t **records; + unsigned int count; + int result; + + if (argc < 2) + exit(2); + + sh = get_handle(argv[1]); + + result = semanage_seuser_list(sh, &records, &count); + printf("semanage_seuser_list(%p, %p, %p): %d", + (void *) sh, (void *) &records, (void *) &count, result); + + if (result < 0) { + perror("semanage_seuser_list"); + exit(1); + } + + printf(", count: %u, records: ", count); + + const char *name; + + for (unsigned int i = 0; i < count; i++) { + name = semanage_seuser_get_name(records[i]); + printf("%p (%s), ", (void *) records[i], name); + } + + printf("\n"); + + if (argc >= 3) { + unsigned int exp_count = strtoul(argv[2], NULL, 10); + + if (count != exp_count) { + printf("Expected %u but got %u\n", exp_count, count); + exit(1); + } + + const char *name; + + for (unsigned int i = 0; i < count; i++) { + name = semanage_seuser_get_name(records[i]); + + if (strcmp(name, argv[3 + i]) != 0) { + printf("Expected %s but got %s\n", name, argv[3 + i]); + exit(1); + } + } + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_modify_local.c b/tests/semanage-seuser-functions/test_modify_local.c new file mode 100644 index 0000000..53a11f5 --- /dev/null +++ b/tests/semanage-seuser-functions/test_modify_local.c @@ -0,0 +1,64 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *seuser; + semanage_seuser_key_t *key; + semanage_seuser_t **records; + int result; + unsigned int count; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + seuser = test_get_seuser(sh, argv[2]); + + result = semanage_seuser_key_extract(sh, seuser, &key); + printf("semanage_seuser_key_extract(%p, %p, %p): %d\n", + (void *) sh, (void *) seuser, (void *) &key, result); + + if (result < 0) { + perror("semanage_seuser_key_extract"); + exit(2); + } + + result = semanage_seuser_modify_local(sh, key, seuser); + printf("semanage_seuser_modify_local(%p, %p, %p): %d\n", + (void *) seuser, (void *) key, (void *) seuser, result); + + if (result < 0) { + perror("semanage_seuser_modify_local"); + exit(1); + } + + result = semanage_seuser_list_local(sh, &records, &count); + printf("semanage_seuser_list_local(%p, %p, %p): %d\n", + (void *) sh, (void *) &records, (void *) &count, result); + + if (result < 0) { + perror("semanage_seuser_list_local"); + exit(2); + } + + if (count != 1) { + fprintf(stderr, "Number of local seusers is %u, expected 1!\n", count); + exit(1); + } + + if (semanage_seuser_compare(records[0], key) != 0) { + fprintf(stderr, "Local seuser is different!\n"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_query.c b/tests/semanage-seuser-functions/test_query.c new file mode 100644 index 0000000..10b4e27 --- /dev/null +++ b/tests/semanage-seuser-functions/test_query.c @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_key_t *key; + semanage_seuser_t *response; + int result; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + result = semanage_seuser_key_create(sh, argv[2], &key); + printf("semanage_seuser_key_create(%p, %s, %p): %d\n", + (void *) sh, argv[2], (void *) &key, result); + + if (result < 0 || key == NULL) { + perror("semanage_seuser_key_create"); + exit(2); + } + + result = semanage_seuser_query(sh, key, &response); + printf("semanage_seuser_query(%p, %p, %p): %d, response: %p\n", + (void *) sh, (void *) key, (void *) &response, result, (void *) response); + + if (result < 0) { + perror("semanage_seuser_query"); + exit(1); + } + + const char *name = semanage_seuser_get_name(response); + printf("semanage_seuser_get_name(%p): %s\n", + (void *) response, name); + + if (strcmp(argv[2], name) != 0) { + perror("semanage_seuser_get_name"); + exit(2); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_set_mlsrange.c b/tests/semanage-seuser-functions/test_set_mlsrange.c new file mode 100644 index 0000000..48440ac --- /dev/null +++ b/tests/semanage-seuser-functions/test_set_mlsrange.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *user; + int result; + const char *mlsrange; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + user = test_get_seuser(sh, "first"); + + if (strcmp(argv[2], "NULL") == 0) + mlsrange = NULL; + else + mlsrange = argv[2]; + + const char *old_mlsrange = semanage_seuser_get_mlsrange(user); + printf("semanage_seuser_get_mlsrange(%p): %s\n", + (void *) user, old_mlsrange); + + if (old_mlsrange == NULL) { + perror("semanage_seuser_get_mlsrange"); + exit(2); + } + + if (strcmp(old_mlsrange, mlsrange) == 0) { + printf("New mlsrange is the same\n"); + exit(2); + } + + result = semanage_seuser_set_mlsrange(sh, user, mlsrange); + printf("semanage_seuser_set_mlsrange(%p, %p, %s): %d\n", + (void *) sh, (void *) user, mlsrange, result); + + if (result < 0) { + perror("semanage_seuser_set_mlsrange"); + exit(1); + } + + const char *new_mlsrange = semanage_seuser_get_mlsrange(user); + printf("semanage_seuser_get_mlsrange(%p): %s\n", + (void *) user, new_mlsrange); + + if (strcmp(new_mlsrange, mlsrange) != 0) { + perror("semanage_seuser_get_mlsrange"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_set_name.c b/tests/semanage-seuser-functions/test_set_name.c new file mode 100644 index 0000000..3e448e8 --- /dev/null +++ b/tests/semanage-seuser-functions/test_set_name.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *user; + int result; + const char *name; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + user = test_get_seuser(sh, "first"); + + if (strcmp(argv[2], "NULL") == 0) + name = NULL; + else + name = argv[2]; + + const char *old_name = semanage_seuser_get_name(user); + printf("semanage_seuser_get_name(%p): %s\n", + (void *) user, old_name); + + if (old_name == NULL) { + perror("semanage_seuser_get_name"); + exit(2); + } + + if (strcmp(old_name, name) == 0) { + printf("New name is the same\n"); + exit(2); + } + + result = semanage_seuser_set_name(sh, user, name); + printf("semanage_seuser_set_name(%p, %p, %s): %d\n", + (void *) sh, (void *) user, name, result); + + if (result < 0) { + perror("semanage_seuser_set_name"); + exit(1); + } + + const char *new_name = semanage_seuser_get_name(user); + printf("semanage_seuser_get_name(%p): %s\n", + (void *) user, new_name); + + if (strcmp(new_name, name) != 0) { + perror("semanage_seuser_get_name"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/semanage-seuser-functions/test_set_sename.c b/tests/semanage-seuser-functions/test_set_sename.c new file mode 100644 index 0000000..402c5b7 --- /dev/null +++ b/tests/semanage-seuser-functions/test_set_sename.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include + +#include "functions.c" + +int main (int argc, char **argv) { + semanage_handle_t *sh; + semanage_seuser_t *user; + int result; + const char *name; + + if (argc < 3) + exit(2); + + sh = get_handle(argv[1]); + + user = test_get_seuser(sh, "first"); + + if (strcmp(argv[2], "NULL") == 0) + name = NULL; + else + name = argv[2]; + + const char *old_name = semanage_seuser_get_sename(user); + printf("semanage_seuser_get_sename(%p): %s\n", + (void *) user, old_name); + + if (old_name == NULL) { + perror("semanage_seuser_get_sename"); + exit(2); + } + + if (strcmp(old_name, name) == 0) { + printf("New name is the same\n"); + exit(2); + } + + result = semanage_seuser_set_sename(sh, user, name); + printf("semanage_seuser_set_sename(%p, %p, %s): %d\n", + (void *) sh, (void *) user, name, result); + + if (result < 0) { + perror("semanage_seuser_set_sename"); + exit(1); + } + + const char *new_name = semanage_seuser_get_sename(user); + printf("semanage_seuser_get_sename(%p): %s\n", + (void *) user, new_name); + + if (strcmp(new_name, name) != 0) { + perror("semanage_seuser_get_sename"); + exit(1); + } + + destroy_handle(sh, argv[1]); + + exit(0); +} diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..721c3ff --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,25 @@ +--- +# Tests that run in all contexts +- hosts: localhost + roles: + - role: standard-test-beakerlib + tags: + - classic + repositories: + - repo: "https://src.fedoraproject.org/tests/selinux.git" + dest: "selinux" + fmf_filter: "tier: 1 | component: libsemanage & tags: generic" + required_packages: + - libsemanage # Required for sanity-tests + - libsemanage-devel # Required for sanity-tests + - glibc # Required for sanity-tests + - gcc # Required for sanity-tests + - CUnit-devel # Required for sanity-tests + - libselinux # Required for verify-options-in-semanage-conf + - libselinux-utils # Required for verify-options-in-semanage-conf + - policycoreutils # Required for verify-options-in-semanage-conf + - policycoreutils-python-utils # Required for verify-options-in-semanage-conf + - selinux-policy # Required for verify-options-in-semanage-conf + - selinux-policy-devel # Required for verify-options-in-semanage-conf + - lksctp-tools # sctp_test + - psmisc # sctp_test diff --git a/tests/verify-options-in-semanage-conf/Makefile b/tests/verify-options-in-semanage-conf/Makefile new file mode 100644 index 0000000..3f94665 --- /dev/null +++ b/tests/verify-options-in-semanage-conf/Makefile @@ -0,0 +1,64 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/libsemanage/Sanity/verify-options-in-semanage-conf +# Description: Are the verify options in semanage.conf honored? +# Author: Milos Malik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/CoreOS/libsemanage/Sanity/verify-options-in-semanage-conf +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE empty.te + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Milos Malik " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Are the verify options in semanage.conf honored?" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 10m" >> $(METADATA) + @echo "RunFor: libsemanage" >> $(METADATA) + @echo "Requires: libselinux libselinux-utils libsemanage policycoreutils policycoreutils-python selinux-policy selinux-policy-devel" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA) + + rhts-lint $(METADATA) + diff --git a/tests/verify-options-in-semanage-conf/PURPOSE b/tests/verify-options-in-semanage-conf/PURPOSE new file mode 100644 index 0000000..356daec --- /dev/null +++ b/tests/verify-options-in-semanage-conf/PURPOSE @@ -0,0 +1,9 @@ +PURPOSE of /CoreOS/libsemanage/Sanity/verify-options-in-semanage-conf +Author: Milos Malik + +Are the verify options in semanage.conf honored? +Tested options: verify kernel, verify module, verify linked +Tested tools: semodule, semanage +Positive and negative cases are tested. +Original information found at http://selinuxproject.org/page/PolicyValidate + diff --git a/tests/verify-options-in-semanage-conf/empty.te b/tests/verify-options-in-semanage-conf/empty.te new file mode 100644 index 0000000..5a08472 --- /dev/null +++ b/tests/verify-options-in-semanage-conf/empty.te @@ -0,0 +1,2 @@ +policy_module(empty,1.0) + diff --git a/tests/verify-options-in-semanage-conf/runtest.sh b/tests/verify-options-in-semanage-conf/runtest.sh new file mode 100755 index 0000000..c7891f3 --- /dev/null +++ b/tests/verify-options-in-semanage-conf/runtest.sh @@ -0,0 +1,142 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/libsemanage/Sanity/verify-options-in-semanage-conf +# Description: Are the verify options in semanage.conf honored? +# Author: Milos Malik +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="libsemanage" +MODULE_NAME="empty" +SEMANAGE_CONF="/etc/selinux/semanage.conf" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm ${PACKAGE} + rlAssertRpm policycoreutils + rlAssertRpm selinux-policy + rlFileBackup ${SEMANAGE_CONF} + rlRun "rpm -qf /usr/sbin/semanage" + rlRun "grep -v -e '^#' -e '^$' ${SEMANAGE_CONF}" + OUTPUT_FILE=`mktemp` + + rlRun "setenforce 1" + rlRun "sestatus" + rlRun "ls -l ${MODULE_NAME}.te" + rlRun "make -f /usr/share/selinux/devel/Makefile" + rlRun "ls -l ${MODULE_NAME}.pp" + rlPhaseEnd + + rlLog "positive cases follow" + # TODO: /bin/true could be replaced a script, which prints the supplied arguments into a file for further inspection + + rlPhaseStartTest "verify kernel" + rlRun "semodule -r ${MODULE_NAME}" 0,1 + rlFileRestore + rlRun "echo -en '[verify kernel]\npath = /bin/true\nargs = \$@\n[end]\n' >> ${SEMANAGE_CONF}" + rlRun "semodule -i ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertNotGrep "semodule.*failed" ${OUTPUT_FILE} -i + rlRun "semodule -l | grep ${MODULE_NAME}" + rlRun "semanage module -a ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertNotGrep "could not commit semanage transaction|no such file or directory" ${OUTPUT_FILE} -Ei + rlRun "semanage module -l | grep ${MODULE_NAME}" + rlPhaseEnd + + rlPhaseStartTest "verify module" + rlRun "semodule -r ${MODULE_NAME}" 0,1 + rlFileRestore + rlRun "echo -en '[verify module]\npath = /bin/true\nargs = \$@\n[end]\n' >> ${SEMANAGE_CONF}" + rlRun "semodule -i ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertNotGrep "semodule.*failed" ${OUTPUT_FILE} -i + rlRun "semodule -l | grep ${MODULE_NAME}" + rlRun "semanage module -a ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertNotGrep "could not commit semanage transaction|no such file or directory" ${OUTPUT_FILE} -Ei + rlRun "semanage module -l | grep ${MODULE_NAME}" + rlPhaseEnd + + if rlIsRHEL '<7.3' ; then # because "[verify linked]" was dropped + rlPhaseStartTest "verify linked" + rlRun "semodule -r ${MODULE_NAME}" 0,1 + rlFileRestore + rlRun "echo -en '[verify linked]\npath = /bin/true\nargs = \$@\n[end]\n' >> ${SEMANAGE_CONF}" + rlRun "semodule -i ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertNotGrep "semodule.*failed" ${OUTPUT_FILE} -i + rlRun "semodule -l | grep ${MODULE_NAME}" + rlRun "semanage module -a ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertNotGrep "could not commit semanage transaction|no such file or directory" ${OUTPUT_FILE} -Ei + rlRun "semanage module -l | grep ${MODULE_NAME}" + rlPhaseEnd + fi + + rlLog "negative cases follow" + # TODO: /bin/false could be replaced a script, which prints the supplied arguments into a file for further inspection + + rlPhaseStartTest "verify kernel" + rlRun "semodule -r ${MODULE_NAME}" 0,1 + rlFileRestore + rlRun "echo -en '[verify kernel]\npath = /bin/false\nargs = \$@\n[end]\n' >> ${SEMANAGE_CONF}" + rlRun "semodule -i ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertGrep "semodule.*failed" ${OUTPUT_FILE} -i + rlRun "semodule -l | grep ${MODULE_NAME}" 1 + rlRun "semanage module -a ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertGrep "could not commit semanage transaction|no such file or directory" ${OUTPUT_FILE} -Ei + rlRun "semanage module -l | grep ${MODULE_NAME}" 1 + rlPhaseEnd + + rlPhaseStartTest "verify module" + rlRun "semodule -r ${MODULE_NAME}" 0,1 + rlFileRestore + rlRun "echo -en '[verify module]\npath = /bin/false\nargs = \$@\n[end]\n' >> ${SEMANAGE_CONF}" + rlRun "semodule -i ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertGrep "semodule.*failed" ${OUTPUT_FILE} -i + rlRun "semodule -l | grep ${MODULE_NAME}" 1 + rlRun "semanage module -a ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertGrep "could not commit semanage transaction|no such file or directory" ${OUTPUT_FILE} -Ei + rlRun "semanage module -l | grep ${MODULE_NAME}" 1 + rlPhaseEnd + + if rlIsRHEL '<7.3' ; then # because "[verify linked]" was dropped + rlPhaseStartTest "verify linked" + rlRun "semodule -r ${MODULE_NAME}" 0,1 + rlFileRestore + rlRun "echo -en '[verify linked]\npath = /bin/false\nargs = \$@\n[end]\n' >> ${SEMANAGE_CONF}" + rlRun "semodule -i ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertGrep "semodule.*failed" ${OUTPUT_FILE} -i + rlRun "semodule -l | grep ${MODULE_NAME}" 1 + rlRun "semanage module -a ${MODULE_NAME}.pp 2>&1 | tee ${OUTPUT_FILE}" + rlAssertGrep "could not commit semanage transaction|no such file or directory" ${OUTPUT_FILE} -Ei + rlRun "semanage module -l | grep ${MODULE_NAME}" 1 + rlPhaseEnd + fi + + rlPhaseStartCleanup + rlRun "rm -f ${MODULE_NAME}.pp ${OUTPUT_FILE}" + rlFileRestore + rlPhaseEnd +rlJournalPrintText +rlJournalEnd +