libsemanage-2.5-0.1.rc1

Update to upstream rc1 release 2016-01-07
This commit is contained in:
Petr Lautrbach 2016-02-21 12:36:19 +01:00
parent 95eef66f4c
commit 288daf8999
5 changed files with 201 additions and 158 deletions

1
.gitignore vendored
View File

@ -132,3 +132,4 @@ libsemanage-2.0.45.tgz
/libsemanage-2.2.tgz
/libsemanage-2.3.tgz
/libsemanage-2.4.tar.gz
/libsemanage-2.5-rc1.tar.gz

183
libsemanage-fedora.patch Normal file
View File

@ -0,0 +1,183 @@
diff --git libsemanage-2.5-rc1/ChangeLog libsemanage-2.5-rc1/ChangeLog
index c1b09f1..29720de 100644
--- libsemanage-2.5-rc1/ChangeLog
+++ libsemanage-2.5-rc1/ChangeLog
@@ -1,4 +1,6 @@
2.5-rc1 2016-01-07
+ * Do not overwrite CFLAGS in test Makefile, from Nicolas Iooss.
+ * Fix uninitialized variable in direct_commit and direct_api, from Nicolas Iooss.
* semanage_migrate_store: Load libsepol.so.1 instead of libsepol.so, from Laurent Bigonville.
* Store homedir_template and users_extra in policy store, from Steve Lawrence
* Fix null pointer dereference in semanage_module_key_destroy, from Yuli Khodorkovskiy.
diff --git libsemanage-2.5-rc1/src/database_llist.c libsemanage-2.5-rc1/src/database_llist.c
index 53583d4..8ce2e2c 100644
--- libsemanage-2.5-rc1/src/database_llist.c
+++ libsemanage-2.5-rc1/src/database_llist.c
@@ -154,7 +154,6 @@ int dbase_llist_add(semanage_handle_t * handle,
if (dbase_llist_cache_prepend(handle, dbase, data) < 0)
goto err;
- key = NULL;
dbase->modified = 1;
return STATUS_SUCCESS;
@@ -224,7 +223,6 @@ hidden int dbase_llist_count(semanage_handle_t * handle __attribute__ ((unused))
{
*response = dbase->cache_sz;
- handle = NULL;
return STATUS_SUCCESS;
}
@@ -303,7 +301,6 @@ int dbase_llist_del(semanage_handle_t * handle __attribute__ ((unused)),
prev = ptr;
}
- handle = NULL;
return STATUS_SUCCESS;
}
diff --git libsemanage-2.5-rc1/src/database_policydb.c libsemanage-2.5-rc1/src/database_policydb.c
index e786afe..748a6ed 100644
--- libsemanage-2.5-rc1/src/database_policydb.c
+++ libsemanage-2.5-rc1/src/database_policydb.c
@@ -165,7 +165,6 @@ static int dbase_policydb_flush(semanage_handle_t * handle
dbase->modified = 0;
/* Stub */
- handle = NULL;
return STATUS_ERR;
}
@@ -298,9 +297,6 @@ static int dbase_policydb_del(semanage_handle_t * handle
{
/* Stub */
- key = NULL;
- handle = NULL;
- dbase = NULL;
return STATUS_ERR;
}
@@ -311,8 +307,6 @@ static int dbase_policydb_clear(semanage_handle_t * handle
{
/* Stub */
- handle = NULL;
- dbase = NULL;
return STATUS_ERR;
}
diff --git libsemanage-2.5-rc1/src/debug.c libsemanage-2.5-rc1/src/debug.c
index ea51ffb..08a9e02 100644
--- libsemanage-2.5-rc1/src/debug.c
+++ libsemanage-2.5-rc1/src/debug.c
@@ -86,8 +86,6 @@ void hidden semanage_msg_default_handler(void *varg __attribute__ ((unused)),
fprintf(stream, " (%s).", strerror(errsv));
fprintf(stream, "\n");
-
- varg = NULL;
}
#ifdef __GNUC__
diff --git libsemanage-2.5-rc1/src/direct_api.c libsemanage-2.5-rc1/src/direct_api.c
index 68dd0d1..2187b65 100644
--- libsemanage-2.5-rc1/src/direct_api.c
+++ libsemanage-2.5-rc1/src/direct_api.c
@@ -291,7 +291,6 @@ static void semanage_direct_destroy(semanage_handle_t * sh
__attribute__ ((unused)))
{
/* do nothing */
- sh = NULL;
}
static int semanage_direct_disconnect(semanage_handle_t * sh)
@@ -1076,7 +1075,7 @@ static int semanage_direct_commit(semanage_handle_t * sh)
/* Declare some variables */
int modified = 0, fcontexts_modified, ports_modified,
seusers_modified, users_extra_modified, dontaudit_modified,
- preserve_tunables_modified, bools_modified,
+ preserve_tunables_modified, bools_modified = 0,
disable_dontaudit, preserve_tunables;
dbase_config_t *users = semanage_user_dbase_local(sh);
dbase_config_t *users_base = semanage_user_base_dbase_local(sh);
@@ -2136,6 +2135,7 @@ static int semanage_direct_set_module_info(semanage_handle_t *sh,
char fn[PATH_MAX];
const char *path = NULL;
int enabled = 0;
+ semanage_module_info_t *modinfo_tmp = NULL;
semanage_module_key_t modkey;
ret = semanage_module_key_init(sh, &modkey);
@@ -2144,8 +2144,6 @@ static int semanage_direct_set_module_info(semanage_handle_t *sh,
goto cleanup;
}
- semanage_module_info_t *modinfo_tmp = NULL;
-
/* check transaction */
if (!sh->is_in_transaction) {
if (semanage_begin_transaction(sh) < 0) {
@@ -2316,6 +2314,8 @@ static int semanage_direct_list_all(semanage_handle_t *sh,
uint16_t priority = 0;
+ semanage_module_info_t *modinfo_tmp = NULL;
+
semanage_module_info_t modinfo;
ret = semanage_module_info_init(sh, &modinfo);
if (ret != 0) {
@@ -2323,8 +2323,6 @@ static int semanage_direct_list_all(semanage_handle_t *sh,
goto cleanup;
}
- semanage_module_info_t *modinfo_tmp = NULL;
-
if (sh->is_in_transaction) {
toplevel = semanage_path(SEMANAGE_TMP, SEMANAGE_MODULES);
} else {
diff --git libsemanage-2.5-rc1/tests/Makefile libsemanage-2.5-rc1/tests/Makefile
index 59067ac..fec96ff 100644
--- libsemanage-2.5-rc1/tests/Makefile
+++ libsemanage-2.5-rc1/tests/Makefile
@@ -11,9 +11,9 @@ LIBS = ../src/libsemanage.a ../../libselinux/src/libselinux.a ../../libsepol/src
EXECUTABLE = libsemanage-tests
CC = gcc
-CFLAGS = -c -g -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
+CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
INCLUDE = -I$(TESTSRC) -I$(TESTSRC)/../include
-LDFLAGS = -lcunit -lustr -lbz2 -laudit
+LDFLAGS += -lcunit -lustr -lbz2 -laudit
OBJECTS = $(SOURCES:.c=.o)
all: $(EXECUTABLE)
@@ -22,7 +22,7 @@ $(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) $(LIBS) $(LDFLAGS) -o $@
%.o: %.c
- $(CC) $(CFLAGS) $(INCLUDE) $*.c -o $*.o
+ $(CC) $(CFLAGS) $(INCLUDE) -c $*.c -o $*.o
clean distclean:
rm -rf $(OBJECTS) $(EXECUTABLE)
diff --git libsemanage-2.5-rc1/utils/semanage_migrate_store libsemanage-2.5-rc1/utils/semanage_migrate_store
index 0ebd285..2bdcc05 100755
--- libsemanage-2.5-rc1/utils/semanage_migrate_store
+++ libsemanage-2.5-rc1/utils/semanage_migrate_store
@@ -1,4 +1,4 @@
-#!/usr/bin/python -E
+#!/usr/bin/python3 -E
from __future__ import print_function
@@ -16,7 +16,7 @@ try:
import selinux
import semanage
except:
- print("You must install libselinux-python and libsemanage-python before running this tool", file=sys.stderr)
+ print("You must install libselinux-python3 and libsemanage-python3 before running this tool", file=sys.stderr)
exit(1)

View File

@ -1,147 +0,0 @@
diff --git libsemanage-2.4/src/direct_api.c libsemanage-2.4/src/direct_api.c
index b0ed338..875c513 100644
--- libsemanage-2.4/src/direct_api.c
+++ libsemanage-2.4/src/direct_api.c
@@ -1137,6 +1137,9 @@ static int semanage_direct_commit(semanage_handle_t * sh)
if (retval < 0)
goto cleanup;
+ /* remove FC_TMPL now that it is now longer needed */
+ unlink(semanage_path(SEMANAGE_TMP, SEMANAGE_FC_TMPL));
+
pfcontexts->dtable->drop_cache(pfcontexts->dbase);
/* SEUsers */
@@ -1241,11 +1244,6 @@ static int semanage_direct_commit(semanage_handle_t * sh)
sepol_policydb_free(out);
out = NULL;
- /* remove files that are automatically generated and no longer needed */
- unlink(semanage_path(SEMANAGE_TMP, SEMANAGE_FC_TMPL));
- unlink(semanage_path(SEMANAGE_TMP, SEMANAGE_HOMEDIR_TMPL));
- unlink(semanage_path(SEMANAGE_TMP, SEMANAGE_USERS_EXTRA));
-
if (sh->do_rebuild || modified || bools_modified || fcontexts_modified) {
retval = semanage_install_sandbox(sh);
}
@@ -1355,7 +1353,7 @@ static int semanage_direct_install_file(semanage_handle_t * sh,
int in_fd = -1;
char *path = NULL;
char *filename;
- char *lang_ext;
+ char *lang_ext = NULL;
char *separator;
if ((in_fd = open(install_filename, O_RDONLY)) == -1) {
@@ -1387,17 +1385,20 @@ static int semanage_direct_install_file(semanage_handle_t * sh,
goto cleanup;
}
*separator = '\0';
+ lang_ext = separator + 1;
}
separator = strrchr(filename, '.');
if (separator == NULL) {
- ERR(sh, "Module does not have a valid extension.");
- retval = -1;
- goto cleanup;
+ if (lang_ext == NULL) {
+ ERR(sh, "Module does not have a valid extension.");
+ retval = -1;
+ goto cleanup;
+ }
+ } else {
+ *separator = '\0';
+ lang_ext = separator + 1;
}
- *separator = '\0';
-
- lang_ext = separator + 1;
retval = semanage_direct_install(sh, data, data_len, filename, lang_ext);
diff --git libsemanage-2.4/tests/test_utilities.c libsemanage-2.4/tests/test_utilities.c
index 4d25b07..32cc33c 100644
--- libsemanage-2.4/tests/test_utilities.c
+++ libsemanage-2.4/tests/test_utilities.c
@@ -45,7 +45,7 @@ void test_slurp_file_filter(void);
char fname[] = {
'T', 'E', 'S', 'T', '_', 'T', 'E', 'M', 'P', '_', 'X', 'X', 'X', 'X',
- 'X', 'X'
+ 'X', 'X', '\0'
};
int fd;
FILE *fptr;
diff --git libsemanage-2.4/utils/semanage_migrate_store libsemanage-2.4/utils/semanage_migrate_store
index 03b492e..22842fc 100755
--- libsemanage-2.4/utils/semanage_migrate_store
+++ libsemanage-2.4/utils/semanage_migrate_store
@@ -1,4 +1,4 @@
-#!/usr/bin/python -E
+#!/usr/bin/python3 -E
from __future__ import print_function
@@ -17,7 +17,7 @@ try:
import selinux
import semanage
except:
- print("You must install libselinux-python and libsemanage-python before running this tool", file=sys.stderr)
+ print("You must install libselinux-python3 and libsemanage-python3 before running this tool", file=sys.stderr)
exit(1)
@@ -221,7 +221,7 @@ def rebuild_policy():
def oldroot_path():
- return "/etc/selinux"
+ return "%s/etc/selinux" % ROOT
def oldstore_path(store):
return "%s/%s/modules/active" % (oldroot_path(), store)
@@ -233,7 +233,7 @@ def disabledmodules_path(store):
return "%s/disabled" % newmodules_path(store)
def newroot_path():
- return PATH
+ return "%s%s" % (ROOT, PATH)
def newstore_path(store):
return "%s/%s/active" % (newroot_path(), store)
@@ -260,6 +260,8 @@ if __name__ == "__main__":
help="Disable rebuilding policy after migration (default: no)")
parser.add_option("-P", "--path", dest="path",
help="Set path for the policy store (default: /var/lib/selinux)")
+ parser.add_option("-r", "--root", dest="root",
+ help="Set an alternative root for the migration (default: /)")
(options, args) = parser.parse_args()
@@ -272,6 +274,10 @@ if __name__ == "__main__":
if PATH is None:
PATH = "/var/lib/selinux"
+ ROOT = options.root
+ if ROOT is None:
+ ROOT = ""
+
# List of paths that go in the active 'root'
TOPPATHS = [
"commit_num",
@@ -282,9 +288,13 @@ if __name__ == "__main__":
"file_contexts.local",
"seusers",
"users.local",
+ "users_extra",
"users_extra.local",
"disable_dontaudit",
- "preserve_tunables" ]
+ "preserve_tunables",
+ "policy.kern",
+ "file_contexts",
+ "homedir_template"]
create_dir_from(oldroot_path(), newroot_path(), 0o755)

View File

@ -1,19 +1,21 @@
%global with_python3 1
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")}
%define libsepolver 2.4-1
%define libselinuxver 2.4-1
%define libsepolver 2.5-0
%define libselinuxver 2.5-0
Summary: SELinux binary policy manipulation library
Name: libsemanage
Version: 2.4
Release: 6%{?dist}
Version: 2.5
Release: 0.1.rc1%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20150202/libsemanage-%{version}.tar.gz
# use make-rhat-patches.sh to create following patch from https://github.com/bachradsusi/selinux.git
# HEAD https://github.com/fedora-selinux/selinux/commit/ab9d1d2458908164ae5dc74aaa084af19ded8a51
Patch: libsemanage-rhat.patch
Source: https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20160107/libsemanage-2.5-rc1.tar.gz
# download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh
# run:
# $ VERSION=2.5-rc1 ./make-fedora-selinux-patch.sh libsemanage
# HEAD https://github.com/fedora-selinux/selinux/commit/fcbe30acc1ab728944f06ee9df9dc007053b5781
Patch1: libsemanage-fedora.patch
URL: https://github.com/SELinuxProject/selinux/wiki
Source1: semanage.conf
@ -84,8 +86,9 @@ SELinux management applications.
%endif # if with_python3
%prep
%setup -q
%patch -p1 -b .rhat
%setup -q -n libsemanage-2.5-rc1
%patch1 -p1 -b .fedora
%build
export LDFLAGS="%{?__global_ldflags}"
@ -191,6 +194,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif # if with_python3
%changelog
* Sun Feb 21 2016 Petr Lautrbach <plautrba@redhat.com> 2.5-0.1.rc1
- Update to upstream rc1 release 2016-01-07
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

View File

@ -1 +1 @@
cd551eb1cc5d20652660bda037972f0d libsemanage-2.4.tar.gz
f8caf1b05981888147ab4c9fbaef7af4 libsemanage-2.5-rc1.tar.gz