Compare commits

...

28 Commits
f29 ... master

Author SHA1 Message Date
Petr Lautrbach 9fe6a11821 libsemanage-3.1-5
- Drop and obsolete libsemanage-compat
- genhomedircon: check usepasswd
2020-11-20 14:54:18 +01:00
Petr Lautrbach 6630c4be5a Drop and obsolete libsemanage-compat 2020-11-20 10:39:27 +01:00
Petr Lautrbach bbfd0b53a4 Add make to BuildRequires 2020-11-04 20:27:29 +01:00
Petr Lautrbach e91e91b5b3 libsemanage-3.1-4
- Drop deprecated functions and duplicated symbols
- Change library version to libsemanage.so.2
- Temporary ship -compat with libsemanage.so.1
- Based on upstream db0f2f382e31
- Re-enable lto flags
2020-10-30 13:29:30 +01:00
Petr Lautrbach a03d891cfa Rebase on db0f2f382e31 at SELinuxProject
- drop deprecated functions and duplicated symbols
- change library version to libsemanage.so.2
- temporary ship -compat with libsemanage.so.1
- based on upstream db0f2f382e31
- re-enable lto flags
2020-10-30 13:27:17 +01:00
Petr Lautrbach 83ed0d4737 Disable lto cflags 2020-07-27 14:10:20 +02:00
Petr Lautrbach 5891e260ee Use -fno-semantic-interposition another make macros and cleanup 2020-07-21 20:30:06 +02:00
Tom Stellard f2db192553 Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
2020-07-13 22:31:52 +00:00
Petr Lautrbach 50910d2329 libsemanage-3.1-1
- SELinux userspace 3.1 release
2020-07-10 20:10:01 +02:00
Miro Hrončok 80f70b1dd5 Rebuilt for Python 3.9 2020-05-26 02:51:23 +02:00
Fedora Release Engineering d5f4816edb - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-29 10:20:52 +00:00
Petr Lautrbach 0ddb109412 Enable gating on tests
https://docs.fedoraproject.org/en-US/ci/gating/
2020-01-23 14:18:04 +01:00
Ondrej Mosnacek 5c57870019 Enable policy optimization
The new v3.0 SELInux userspace added support for optimizing the binary
policy by pruning redundant rules from it. Enable it on Fedora by
default, since it brings noticeable space savings and only negligibly
increases policy build time.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
2020-01-22 15:21:38 +01:00
Petr Lautrbach 0549d7c12a SELinux userspace 3.0 release 2019-12-06 09:05:29 +01:00
Petr Lautrbach 6e2f3c16bb SELinux userpace 3.0-rc1 release candidate 2019-11-11 11:32:17 +01:00
Petr Lautrbach 15ab9bf126 Use FMF filter instead of listing tests manually
There is a feature in the Standard Test Roles which allows to use an FMF filter
instead of listing all tests manually. All tier one selinux tests are selected
as well.
2019-11-11 10:17:28 +01:00
Miro Hrončok 194ca16bb8 Rebuilt for Python 3.8.0rc1 (#1748018) 2019-10-03 13:56:07 +02:00
Zbigniew Jędrzejewski-Szmek f44cd3fc4f Rebuilt for Python 3.8 2019-08-18 11:22:25 +02:00
Petr Lautrbach f5a63af326 libsemanage-2.9-3
- Drop python2-libsemanage (#1738466)
2019-08-13 21:39:57 +02:00
Petr Lautrbach 077b89e12c Drop python2-libsemanage
https://bugzilla.redhat.com/show_bug.cgi?id=1738466
2019-08-13 21:39:57 +02:00
Petr Lautrbach 261ead2b51 Use %set_build_flags 2019-08-13 21:39:57 +02:00
Petr Lautrbach 04b65113f0 Use separate patches instead of one big libsemanage-fedora.patch 2019-08-13 21:39:57 +02:00
Fedora Release Engineering 079ba207f7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-25 14:21:28 +00:00
Petr Lautrbach 9519c0d906 SELinux userspace 2.9 release 2019-03-18 17:08:38 +01:00
Petr Lautrbach 09c83ba581 SELinux userspace 2.9-rc2 release 2019-03-11 16:37:29 +01:00
Fedora Release Engineering 3232cd5592 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-02-01 08:12:10 +00:00
Petr Lautrbach 64eaf02621 SELinux userspace 2.9-rc1 release candidate 2019-01-30 09:57:30 +01:00
Petr Lautrbach eac1dd7964 libsemanage-2.8-8
- Always set errno to 0 before calling getpwent()
- Set selinux policy root around calls to selinux_boolean_sub
2019-01-21 17:34:55 +01:00
12 changed files with 595 additions and 318 deletions

6
.gitignore vendored
View File

@ -140,3 +140,9 @@ libsemanage-2.0.45.tgz
/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

View File

@ -0,0 +1,233 @@
From b46406de8a93abe10e685c422597516517c0bff3 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Fri, 9 Oct 2020 15:00:50 +0200
Subject: [PATCH] libsemanage: Remove legacy and duplicate symbols
Versioned duplicate symbols cause problems for LTO. These symbols were
introduced during the CIL integration several releases ago and were only
consumed by other SELinux userspace components.
Related: https://github.com/SELinuxProject/selinux/issues/245
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
libsemanage/include/semanage/modules.h | 2 +-
libsemanage/src/libsemanage.map | 5 --
libsemanage/src/modules.c | 100 +------------------------
libsemanage/src/modules.h | 9 +--
libsemanage/src/semanageswig_python.i | 2 -
5 files changed, 4 insertions(+), 114 deletions(-)
diff --git a/libsemanage/include/semanage/modules.h b/libsemanage/include/semanage/modules.h
index ac4039314857..b51f61f033d5 100644
--- a/libsemanage/include/semanage/modules.h
+++ b/libsemanage/include/semanage/modules.h
@@ -33,7 +33,7 @@ typedef struct semanage_module_key semanage_module_key_t;
*/
extern int semanage_module_install(semanage_handle_t *,
- char *module_data, size_t data_len, char *name, char *ext_lang);
+ char *module_data, size_t data_len, const char *name, const char *ext_lang);
extern int semanage_module_install_file(semanage_handle_t *,
const char *module_name);
extern int semanage_module_remove(semanage_handle_t *, char *module_name);
diff --git a/libsemanage/src/libsemanage.map b/libsemanage/src/libsemanage.map
index 1375a8ca0ea7..4bec06aaae27 100644
--- a/libsemanage/src/libsemanage.map
+++ b/libsemanage/src/libsemanage.map
@@ -167,18 +167,13 @@ LIBSEMANAGE_1.0 {
semanage_mls_enabled;
semanage_module_disable;
semanage_module_enable;
- semanage_module_get_enabled;
semanage_module_get_name;
semanage_module_get_version;
semanage_module_info_datum_destroy;
- semanage_module_install;
- semanage_module_install_base;
- semanage_module_install_base_file;
semanage_module_install_file;
semanage_module_list;
semanage_module_list_nth;
semanage_module_remove;
- semanage_module_upgrade;
semanage_module_upgrade_file;
semanage_msg_get_channel;
semanage_msg_get_fname;
diff --git a/libsemanage/src/modules.c b/libsemanage/src/modules.c
index 6d3eb60ae462..8b36801038df 100644
--- a/libsemanage/src/modules.c
+++ b/libsemanage/src/modules.c
@@ -42,70 +42,7 @@
#include "modules.h"
#include "debug.h"
-asm(".symver semanage_module_get_enabled_1_1,semanage_module_get_enabled@@LIBSEMANAGE_1.1");
-asm(".symver semanage_module_get_enabled_1_0,semanage_module_get_enabled@LIBSEMANAGE_1.0");
-asm(".symver semanage_module_install_pp,semanage_module_install@LIBSEMANAGE_1.0");
-asm(".symver semanage_module_install_hll,semanage_module_install@@LIBSEMANAGE_1.1");
-
-/* Takes a module stored in 'module_data' and parses its headers.
- * Sets reference variables 'module_name' to module's name and
- * 'version' to module's version. The caller is responsible for
- * free()ing 'module_name' and 'version'; they will be
- * set to NULL upon entering this function. Returns 0 on success, -1
- * if out of memory, or -2 if data did not represent a module.
- */
-static int parse_module_headers(semanage_handle_t * sh, char *module_data,
- size_t data_len, char **module_name, char **version)
-{
- struct sepol_policy_file *pf;
- int file_type;
- *version = NULL;
-
- if (sepol_policy_file_create(&pf)) {
- ERR(sh, "Out of memory!");
- return -1;
- }
- sepol_policy_file_set_mem(pf, module_data, data_len);
- sepol_policy_file_set_handle(pf, sh->sepolh);
- if (module_data == NULL ||
- data_len == 0 ||
- sepol_module_package_info(pf, &file_type, module_name, version) == -1) {
- sepol_policy_file_free(pf);
- ERR(sh, "Could not parse module data.");
- return -2;
- }
- sepol_policy_file_free(pf);
- if (file_type != SEPOL_POLICY_MOD) {
- ERR(sh, "Data did not represent a pp module. Please upgrade to the latest version of libsemanage to support hll modules.");
- return -2;
- }
-
- return 0;
-}
-
-/* This function is used to preserve ABI compatibility with
- * versions of semodule using LIBSEMANAGE_1.0
- */
-int semanage_module_install_pp(semanage_handle_t * sh,
- char *module_data, size_t data_len)
-{
- char *name = NULL;
- char *version = NULL;
- int status;
-
- if ((status = parse_module_headers(sh, module_data, data_len, &name, &version)) != 0) {
- goto cleanup;
- }
-
- status = semanage_module_install_hll(sh, module_data, data_len, name, "pp");
-
-cleanup:
- free(name);
- free(version);
- return status;
-}
-
-int semanage_module_install_hll(semanage_handle_t * sh,
+int semanage_module_install(semanage_handle_t * sh,
char *module_data, size_t data_len, const char *name, const char *ext_lang)
{
if (sh->funcs->install == NULL) {
@@ -160,16 +97,6 @@ int semanage_module_extract(semanage_handle_t * sh,
return sh->funcs->extract(sh, modkey, extract_cil, mapped_data, data_len, modinfo);
}
-/* Legacy function that remains to preserve ABI
- * compatibility. Please use semanage_module_install instead.
- */
-int semanage_module_upgrade(semanage_handle_t * sh,
- char *module_data, size_t data_len)
-{
- return semanage_module_install_pp(sh, module_data, data_len);
-
-}
-
/* Legacy function that remains to preserve ABI
* compatibility. Please use semanage_module_install_file instead.
*/
@@ -179,24 +106,6 @@ int semanage_module_upgrade_file(semanage_handle_t * sh,
return semanage_module_install_file(sh, module_name);
}
-/* Legacy function that remains to preserve ABI
- * compatibility. Please use semanage_module_install instead.
- */
-int semanage_module_install_base(semanage_handle_t * sh,
- char *module_data, size_t data_len)
-{
- return semanage_module_install_pp(sh, module_data, data_len);
-}
-
-/* Legacy function that remains to preserve ABI
- * compatibility. Please use semanage_module_install_file instead.
- */
-int semanage_module_install_base_file(semanage_handle_t * sh,
- const char *module_name)
-{
- return semanage_module_install_file(sh, module_name);
-}
-
int semanage_module_remove(semanage_handle_t * sh, char *module_name)
{
if (sh->funcs->remove == NULL) {
@@ -780,7 +689,7 @@ int semanage_module_key_set_priority(semanage_handle_t *sh,
}
-int semanage_module_get_enabled_1_1(semanage_handle_t *sh,
+int semanage_module_get_enabled(semanage_handle_t *sh,
const semanage_module_key_t *modkey,
int *enabled)
{
@@ -800,11 +709,6 @@ int semanage_module_get_enabled_1_1(semanage_handle_t *sh,
return sh->funcs->get_enabled(sh, modkey, enabled);
}
-int semanage_module_get_enabled_1_0(semanage_module_info_t *modinfo)
-{
- return modinfo->enabled;
-}
-
int semanage_module_set_enabled(semanage_handle_t *sh,
const semanage_module_key_t *modkey,
int enabled)
diff --git a/libsemanage/src/modules.h b/libsemanage/src/modules.h
index 2d3576fb15df..64d4a157f5ca 100644
--- a/libsemanage/src/modules.h
+++ b/libsemanage/src/modules.h
@@ -26,16 +26,9 @@
#include "semanage/modules.h"
-int semanage_module_install_pp(semanage_handle_t * sh,
- char *module_data, size_t data_len);
-int semanage_module_install_hll(semanage_handle_t * sh,
- char *module_data, size_t data_len, const char *name, const char *ext_lang);
-int semanage_module_upgrade(semanage_handle_t * sh,
- char *module_data, size_t data_len);
+
int semanage_module_upgrade_file(semanage_handle_t * sh,
const char *module_name);
-int semanage_module_install_base(semanage_handle_t * sh,
- char *module_data, size_t data_len);
int semanage_module_install_base_file(semanage_handle_t * sh,
const char *module_name);
diff --git a/libsemanage/src/semanageswig_python.i b/libsemanage/src/semanageswig_python.i
index 8dd79fc24213..5f0113966962 100644
--- a/libsemanage/src/semanageswig_python.i
+++ b/libsemanage/src/semanageswig_python.i
@@ -30,8 +30,6 @@
%}
%include "stdint.i"
-%ignore semanage_module_install_pp;
-%ignore semanage_module_install_hll;
%wrapper %{
--
2.29.0

View File

@ -0,0 +1,100 @@
From c08b73d7183e2dbab0ba43c3df32f4214abbc9c6 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Fri, 9 Oct 2020 15:00:51 +0200
Subject: [PATCH] libsemanage: Drop deprecated functions
semanage_module_enable() and semanage_module_disable() were deprecated
by commit 9fbc6d14418f ("libsemanage: add back original module
enable/disable functions for ABI compatability") in 2014 in order to
preserve ABI compatibility. As we the libsemanage ABI is changed by the
previous commit, it makes sense to drop them completely.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
libsemanage/src/libsemanage.map | 2 --
libsemanage/src/modules.c | 56 ---------------------------------
2 files changed, 58 deletions(-)
diff --git a/libsemanage/src/libsemanage.map b/libsemanage/src/libsemanage.map
index 4bec06aaae27..3ea7b60f97bb 100644
--- a/libsemanage/src/libsemanage.map
+++ b/libsemanage/src/libsemanage.map
@@ -165,8 +165,6 @@ LIBSEMANAGE_1.0 {
semanage_is_connected;
semanage_is_managed;
semanage_mls_enabled;
- semanage_module_disable;
- semanage_module_enable;
semanage_module_get_name;
semanage_module_get_version;
semanage_module_info_datum_destroy;
diff --git a/libsemanage/src/modules.c b/libsemanage/src/modules.c
index 8b36801038df..b6dd456cac32 100644
--- a/libsemanage/src/modules.c
+++ b/libsemanage/src/modules.c
@@ -734,62 +734,6 @@ int semanage_module_set_enabled(semanage_handle_t *sh,
}
-/* This function exists only for ABI compatibility. It has been deprecated and
- * should not be used. Instead, use semanage_module_set_enabled() */
-int semanage_module_enable(semanage_handle_t *sh, char *module_name)
-{
- int rc = -1;
- semanage_module_key_t *modkey = NULL;
-
- rc = semanage_module_key_create(sh, &modkey);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_key_set_name(sh, modkey, module_name);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_set_enabled(sh, modkey, 1);
- if (rc != 0)
- goto exit;
-
- rc = 0;
-
-exit:
- semanage_module_key_destroy(sh, modkey);
- free(modkey);
-
- return rc;
-}
-
-/* This function exists only for ABI compatibility. It has been deprecated and
- * should not be used. Instead, use semanage_module_set_enabled() */
-int semanage_module_disable(semanage_handle_t *sh, char *module_name)
-{
- int rc = -1;
- semanage_module_key_t *modkey = NULL;
-
- rc = semanage_module_key_create(sh, &modkey);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_key_set_name(sh, modkey, module_name);
- if (rc != 0)
- goto exit;
-
- rc = semanage_module_set_enabled(sh, modkey, 0);
- if (rc != 0)
- goto exit;
-
- rc = 0;
-
-exit:
- semanage_module_key_destroy(sh, modkey);
- free(modkey);
-
- return rc;
-}
-
/* Converts a string to a priority
*
* returns -1 if str is not a valid priority.
--
2.29.0

View File

@ -0,0 +1,45 @@
From 6ebb35d261eaa8701b53b9f68184b05de8dfd868 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Fri, 9 Oct 2020 15:00:52 +0200
Subject: [PATCH] libsemanage: Bump libsemanage.so version
Previous commits removed some symbols and broke ABI, therefore we need to change
SONAME.
See the following quotes from distribution guidelines:
https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#run-time-shared-libraries
Every time the shared library ABI changes in a way that may break
binaries linked against older versions of the shared library, the SONAME
of the library and the corresponding name for the binary package
containing the runtime shared library should change.
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_downstream_so_name_versioning
When new versions of the library are released, you should use an ABI
comparison tool to check for ABI differences in the built shared
libraries. If it detects any incompatibilities, bump the n number by
one.
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
---
libsemanage/src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
index a0eb3747d74b..ab6cae51f5c3 100644
--- a/libsemanage/src/Makefile
+++ b/libsemanage/src/Makefile
@@ -32,7 +32,7 @@ YACC = bison
YFLAGS = -d
VERSION = $(shell cat ../VERSION)
-LIBVERSION = 1
+LIBVERSION = 2
LIBA=libsemanage.a
TARGET=libsemanage.so
--
2.29.0

View File

@ -0,0 +1,66 @@
From fc966a746653cc15a14d1e1a80f01fc2f567ee08 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
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 d2b91fb24292..f445cd4d6fb5 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.29.0

View File

@ -0,0 +1,35 @@
From 511f8bbf779e10152d5af491e8b6a408b8ad666c Mon Sep 17 00:00:00 2001
From: Vit Mojzis <vmojzis@redhat.com>
Date: Fri, 30 Oct 2020 17:42:17 +0100
Subject: [PATCH] libsemanage/genhomedircon: check usepasswd
Only add user homedir contexts when usepasswd = True
Resolves:
# grep usepasswd /etc/selinux/semanage.conf
usepasswd=False
# useradd -Z unconfined_u -d /tmp test
# matchpathcon /tmp
/tmp unconfined_u:object_r:user_home_dir_t:s0
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
---
libsemanage/src/genhomedircon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index d08c88de99a7..18d3d99a1254 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -1332,7 +1332,7 @@ static int write_context_file(genhomedircon_settings_t * s, FILE * out)
s->fallback->home = NULL;
}
}
- if (user_context_tpl || username_context_tpl) {
+ if ((s->usepasswd) && (user_context_tpl || username_context_tpl)) {
if (write_username_context(s, out, username_context_tpl,
s->fallback) != STATUS_SUCCESS) {
retval = STATUS_ERR;
--
2.29.2

16
gating.yaml Normal file
View File

@ -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}

View File

@ -1,267 +0,0 @@
diff --git libsemanage-2.8/src/direct_api.c libsemanage-2.8/src/direct_api.c
index c58961b..8e4d116 100644
--- libsemanage-2.8/src/direct_api.c
+++ libsemanage-2.8/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);
@@ -2177,7 +2177,6 @@ cleanup:
semanage_module_info_destroy(sh, modinfo);
free(modinfo);
- if (fp != NULL) fclose(fp);
return status;
}
@@ -2342,16 +2341,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,
@@ -2395,7 +2384,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;
}
diff --git libsemanage-2.8/src/genhomedircon.c libsemanage-2.8/src/genhomedircon.c
index 3e61b51..c35f878 100644
--- libsemanage-2.8/src/genhomedircon.c
+++ libsemanage-2.8/src/genhomedircon.c
@@ -1074,10 +1074,20 @@ static int get_group_users(genhomedircon_settings_t * s,
const char *grname = selogin + 1;
- if (getgrnam_r(grname, &grstorage, grbuf,
- (size_t) grbuflen, &group) != 0) {
- goto cleanup;
+ errno = 0;
+ while (
+ (retval = getgrnam_r(grname, &grstorage, grbuf, (size_t) grbuflen, &group)) != 0 &&
+ errno == ERANGE
+ ) {
+ char *new_grbuf;
+ grbuflen *= 2;
+ new_grbuf = realloc(grbuf, grbuflen);
+ if (new_grbuf == NULL)
+ goto cleanup;
+ grbuf = new_grbuf;
}
+ if (retval == -1)
+ goto cleanup;
if (group == NULL) {
ERR(s->h_semanage, "Can't find group named %s\n", grname);
diff --git libsemanage-2.8/src/semanage_store.c libsemanage-2.8/src/semanage_store.c
index f1984c5..58dded6 100644
--- libsemanage-2.8/src/semanage_store.c
+++ libsemanage-2.8/src/semanage_store.c
@@ -541,14 +541,18 @@ int semanage_create_store(semanage_handle_t * sh, int create)
struct stat sb;
const char *path = semanage_files[SEMANAGE_ROOT];
int fd;
+ mode_t mask;
if (stat(path, &sb) == -1) {
if (errno == ENOENT && create) {
+ mask = umask(0077);
if (mkdir(path, S_IRWXU) == -1) {
+ umask(mask);
ERR(sh, "Could not create module store at %s.",
path);
return -2;
}
+ umask(mask);
} else {
if (create)
ERR(sh,
@@ -567,12 +571,15 @@ int semanage_create_store(semanage_handle_t * sh, int create)
path = semanage_path(SEMANAGE_ACTIVE, SEMANAGE_TOPLEVEL);
if (stat(path, &sb) == -1) {
if (errno == ENOENT && create) {
+ mask = umask(0077);
if (mkdir(path, S_IRWXU) == -1) {
+ umask(mask);
ERR(sh,
"Could not create module store, active subdirectory at %s.",
path);
return -2;
}
+ umask(mask);
} else {
ERR(sh,
"Could not read from module store, active subdirectory at %s.",
@@ -590,12 +597,15 @@ int semanage_create_store(semanage_handle_t * sh, int create)
path = semanage_path(SEMANAGE_ACTIVE, SEMANAGE_MODULES);
if (stat(path, &sb) == -1) {
if (errno == ENOENT && create) {
+ mask = umask(0077);
if (mkdir(path, S_IRWXU) == -1) {
+ umask(mask);
ERR(sh,
"Could not create module store, active modules subdirectory at %s.",
path);
return -2;
}
+ umask(mask);
} else {
ERR(sh,
"Could not read from module store, active modules subdirectory at %s.",
@@ -613,11 +623,14 @@ int semanage_create_store(semanage_handle_t * sh, int create)
path = semanage_files[SEMANAGE_READ_LOCK];
if (stat(path, &sb) == -1) {
if (errno == ENOENT && create) {
+ mask = umask(0077);
if ((fd = creat(path, S_IRUSR | S_IWUSR)) == -1) {
+ umask(mask);
ERR(sh, "Could not create lock file at %s.",
path);
return -2;
}
+ umask(mask);
close(fd);
} else {
ERR(sh, "Could not read lock file at %s.", path);
@@ -763,6 +776,7 @@ static int semanage_copy_dir_flags(const char *src, const char *dst, int flag)
struct stat sb;
struct dirent **names = NULL;
char path[PATH_MAX], path2[PATH_MAX];
+ mode_t mask;
if ((len = scandir(src, &names, semanage_filename_select, NULL)) == -1) {
fprintf(stderr, "Could not read the contents of %s: %s\n", src, strerror(errno));
@@ -770,10 +784,13 @@ static int semanage_copy_dir_flags(const char *src, const char *dst, int flag)
}
if (stat(dst, &sb) != 0) {
+ mask = umask(0077);
if (mkdir(dst, S_IRWXU) != 0) {
+ umask(mask);
fprintf(stderr, "Could not create %s: %s\n", dst, strerror(errno));
goto cleanup;
}
+ umask(mask);
}
for (i = 0; i < len; i++) {
@@ -785,14 +802,20 @@ static int semanage_copy_dir_flags(const char *src, const char *dst, int flag)
}
snprintf(path2, sizeof(path2), "%s/%s", dst, names[i]->d_name);
if (S_ISDIR(sb.st_mode)) {
+ mask = umask(0077);
if (mkdir(path2, 0700) == -1 ||
semanage_copy_dir_flags(path, path2, flag) == -1) {
+ umask(mask);
goto cleanup;
}
+ umask(mask);
} else if (S_ISREG(sb.st_mode) && flag == 1) {
+ mask = umask(0077);
if (semanage_copy_file(path, path2, sb.st_mode) < 0) {
+ umask(mask);
goto cleanup;
}
+ umask(mask);
}
}
retval = 0;
@@ -872,16 +895,20 @@ int semanage_mkdir(semanage_handle_t *sh, const char *path)
{
int status = 0;
struct stat sb;
+ mode_t mask;
/* check if directory already exists */
if (stat(path, &sb) != 0) {
/* make the modules directory */
+ mask = umask(0077);
if (mkdir(path, S_IRWXU) != 0) {
+ umask(mask);
ERR(sh, "Cannot make directory at %s", path);
status = -1;
goto cleanup;
}
+ umask(mask);
}
else {
/* check that it really is a directory */
@@ -906,6 +933,7 @@ int semanage_make_sandbox(semanage_handle_t * sh)
const char *sandbox = semanage_path(SEMANAGE_TMP, SEMANAGE_TOPLEVEL);
struct stat buf;
int errsv;
+ mode_t mask;
if (stat(sandbox, &buf) == -1) {
if (errno != ENOENT) {
@@ -922,12 +950,15 @@ int semanage_make_sandbox(semanage_handle_t * sh)
}
}
+ mask = umask(0077);
if (mkdir(sandbox, S_IRWXU) == -1 ||
semanage_copy_dir(semanage_path(SEMANAGE_ACTIVE, SEMANAGE_TOPLEVEL),
sandbox) == -1) {
+ umask(mask);
ERR(sh, "Could not copy files to sandbox %s.", sandbox);
goto cleanup;
}
+ umask(mask);
return 0;
cleanup:
diff --git libsemanage-2.8/src/seusers_local.c libsemanage-2.8/src/seusers_local.c
index 413ebdd..a79e2d3 100644
--- libsemanage-2.8/src/seusers_local.c
+++ libsemanage-2.8/src/seusers_local.c
@@ -71,17 +71,18 @@ static int semanage_seuser_audit(semanage_handle_t * handle,
const char *sep = "-";
int rc = -1;
strcpy(msg, "login");
+ if (previous) {
+ name = semanage_seuser_get_name(previous);
+ psename = semanage_seuser_get_sename(previous);
+ pmls = semanage_seuser_get_mlsrange(previous);
+ proles = semanage_user_roles(handle, psename);
+ }
if (seuser) {
name = semanage_seuser_get_name(seuser);
sename = semanage_seuser_get_sename(seuser);
mls = semanage_seuser_get_mlsrange(seuser);
roles = semanage_user_roles(handle, sename);
}
- if (previous) {
- psename = semanage_seuser_get_sename(previous);
- pmls = semanage_seuser_get_mlsrange(previous);
- proles = semanage_user_roles(handle, psename);
- }
if (audit_type != AUDIT_ROLE_REMOVE) {
if (sename && (!psename || strcmp(psename, sename) != 0)) {
strcat(msg,sep);

View File

@ -1,31 +1,36 @@
%define libsepolver 2.8-3
%define libselinuxver 2.8-5
%define libsepolver 3.1-5
%define libselinuxver 3.1-5
Summary: SELinux binary policy manipulation library
Summary: SELinux binary policy manipulation library
Name: libsemanage
Version: 2.8
Release: 7%{?dist}
Version: 3.1
Release: 5%{?dist}
License: LGPLv2+
Source: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20180524/libsemanage-2.8.tar.gz
# download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh
# run:
# $ VERSION=2.8 ./make-fedora-selinux-patch.sh libsemanage
# HEAD https://github.com/fedora-selinux/selinux/commit/2fee0bccb66a6cafcf0d178b8c75c23ebd3f9924
Patch1: libsemanage-fedora.patch
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-Remove-legacy-and-duplicate-symbols.patch
Patch0002: 0002-libsemanage-Drop-deprecated-functions.patch
Patch0003: 0003-libsemanage-Bump-libsemanage.so-version.patch
Patch0004: 0004-libsemanage-Fix-RESOURCE_LEAK-and-USE_AFTER_FREE-cov.patch
Patch0005: 0005-libsemanage-genhomedircon-check-usepasswd.patch
# Patch list end
URL: https://github.com/SELinuxProject/selinux/wiki
Source1: semanage.conf
BuildRequires: gcc
BuildRequires: gcc make
BuildRequires: libselinux-devel >= %{libselinuxver} swig
BuildRequires: libsepol-devel >= %{libsepolver}
BuildRequires: audit-libs-devel
BuildRequires: python2 python2-devel bison flex bzip2-devel
BuildRequires: bison flex bzip2-devel
BuildRequires: python3
BuildRequires: python3-devel
Requires: bzip2-libs audit-libs
Requires: libselinux%{?_isa} >= %{libselinuxver}
Obsoletes: libsemanage-compat = 3.1-4
%description
Security-enhanced Linux is a feature of the Linux® kernel and a number
@ -59,19 +64,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
The semanage-devel package contains the libraries and header files
needed for developing applications that manipulate binary policies.
%package -n python2-libsemanage
%{?python_provide:%python_provide python2-libsemanage}
# Remove before F30
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Summary: semanage python bindings for libsemanage
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-libsemanage
The libsemanage-python package contains the python bindings for developing
SELinux management applications.
%package -n python3-libsemanage
Summary: semanage python 3 bindings for libsemanage
Requires: %{name}%{?_isa} = %{version}-%{release}
@ -87,11 +79,12 @@ The libsemanage-python3 package contains the python 3 bindings for developing
SELinux management applications.
%prep
%autosetup -n libsemanage-%{version} -p 1
%autosetup -n libsemanage-%{version} -p 2
%build
export LDFLAGS="%{?__global_ldflags}"
%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
@ -102,17 +95,14 @@ BuildPythonWrapper() {
# Perform the build from the upstream Makefile:
make \
PYTHON=$BinaryName \
CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" \
LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" \
pywrap
}
make clean
make CFLAGS="%{optflags}" swigify
make CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all
make swigify
%make_build LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all
BuildPythonWrapper \
%{__python2}
BuildPythonWrapper \
%{__python3}
@ -130,28 +120,22 @@ 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 DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" install
InstallPythonWrapper \
%{__python2} \
.so
%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
sed -i '1s%\(#! */usr/bin/python\)\([^3].*\|\)$%\13\2%' %{buildroot}%{_libexecdir}/selinux/semanage_migrate_store
%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%dir %{_sysconfdir}/selinux
%config(noreplace) %{_sysconfdir}/selinux/semanage.conf
%{_libdir}/libsemanage.so.1
%{_libdir}/libsemanage.so.2
%{_mandir}/man5/*
%{_mandir}/ru/man5/*
%dir %{_libexecdir}/selinux
%dir %{_sharedstatedir}/selinux
%dir %{_sharedstatedir}/selinux/tmp
@ -168,10 +152,6 @@ sed -i '1s%\(#! */usr/bin/python\)\([^3].*\|\)$%\13\2%' %{buildroot}%{_libexecdi
%{_includedir}/semanage/*.h
%{_mandir}/man3/*
%files -n python2-libsemanage
%{python2_sitearch}/_semanage.so
%{python2_sitearch}/semanage.py*
%files -n python3-libsemanage
%{python3_sitearch}/*.so
%{python3_sitearch}/semanage.py*
@ -179,6 +159,68 @@ sed -i '1s%\(#! */usr/bin/python\)\([^3].*\|\)$%\13\2%' %{buildroot}%{_libexecdi
%{_libexecdir}/selinux/semanage_migrate_store
%changelog
* Fri Nov 20 2020 Petr Lautrbach <plautrba@redhat.com> - 3.1-5
- Drop and obsolete libsemanage-compat
- genhomedircon: check usepasswd
* Fri Oct 30 2020 Petr Lautrbach <plautrba@redhat.com> - 3.1-4
- Drop deprecated functions and duplicated symbols
- Change library version to libsemanage.so.2
- Temporary ship -compat with libsemanage.so.1
- Based on upstream db0f2f382e31
- Re-enable lto flags
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 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 <plautrba@redhat.com> - 3.1-1
- SELinux userspace 3.1 release
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.0-4
- Rebuilt for Python 3.9
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jan 22 2020 Ondrej Mosnacek <omosnace@redhat.com> - 3.0-2
- Enable policy optimization
* Fri Dec 6 2019 Petr Lautrbach <plautrba@redhat.com> - 3.0-1
- SELinux userspace 3.0 release
* Mon Nov 11 2019 Petr Lautrbach <plautrba@redhat.com> - 3.0-0.rc1.1
- SELinux userspace 3.0-rc1 release candidate
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.9-5
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Sun Aug 18 2019 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.9-4
- Rebuilt for Python 3.8
* Tue Aug 13 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-3
- Drop python2-libsemanage (#1738466)
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Mar 18 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-1
- SELinux userspace 2.9 release
* Mon Mar 11 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-0.rc2.1
- SELinux userspace 2.9-rc2 release
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-0.rc1.1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jan 25 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-0.rc1.1
- SELinux userspace 2.9-rc1 release
* Mon Jan 21 2019 Petr Lautrbach <plautrba@redhat.com> - 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 <plautrba@redhat.com> - 2.8-7
- genhomedircon - improve handling large groups

View File

@ -50,6 +50,7 @@ usepasswd=False
bzip-small=true
bzip-blocksize=5
ignoredirs=/root
optimize-policy=true
[sefcontext_compile]
path = /usr/sbin/sefcontext_compile

View File

@ -1 +1 @@
SHA512 (libsemanage-2.8.tar.gz) = 53f09c79da168a79b853f55e0f1c20a96229df9d82929c514bcaf72697446ae836f7f0457fc0056d2418cc6d0712157faf0152881518fe84a1b1b9b9af17e7ef
SHA512 (libsemanage-3.1.tar.gz) = 8609ca7d13b5c603677740f2b14558fea3922624af182d20d618237ba11fcf2559fab82fc68d1efa6ff118f064d426f005138521652c761de92cd66150102197

View File

@ -8,9 +8,7 @@
repositories:
- repo: "https://src.fedoraproject.org/tests/selinux.git"
dest: "selinux"
tests:
- selinux/libsemanage/sanity-tests
- selinux/libsemanage/verify-options-in-semanage-conf
fmf_filter: "tier: 1 | component: libsemanage & tags: generic"
required_packages:
- libsemanage # Required for sanity-tests
- libsemanage-devel # Required for sanity-tests
@ -23,3 +21,5 @@
- 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