Update to latest patches from eparis/Upstream

-    libsemanage: fixes from coverity
-    libsemange: redo genhomedircon minuid
This commit is contained in:
Dan Walsh 2013-01-05 11:31:53 -05:00
parent f0b6adc46c
commit 15a3a08fb3
2 changed files with 99 additions and 4 deletions

View File

@ -67,6 +67,62 @@ index 7ef4154..41ba044 100644
"[verify module]" return VERIFY_MOD_START;
"[verify linked]" return VERIFY_LINKED_START;
"[verify kernel]" return VERIFY_KERNEL_START;
diff --git a/libsemanage/src/database_llist.c b/libsemanage/src/database_llist.c
index 5f0c147..53583d4 100644
--- a/libsemanage/src/database_llist.c
+++ b/libsemanage/src/database_llist.c
@@ -369,9 +369,11 @@ int dbase_llist_list(semanage_handle_t * handle,
ERR(handle, "out of memory");
err:
- for (; i >= 0; i--)
- dbase->rtable->free(tmp_records[i]);
- free(tmp_records);
+ if (tmp_records) {
+ for (; i >= 0; i--)
+ dbase->rtable->free(tmp_records[i]);
+ free(tmp_records);
+ }
ERR(handle, "could not allocate record array");
return STATUS_ERR;
}
diff --git a/libsemanage/src/database_policydb.c b/libsemanage/src/database_policydb.c
index 94850b7..dbb23b2 100644
--- a/libsemanage/src/database_policydb.c
+++ b/libsemanage/src/database_policydb.c
@@ -462,9 +462,11 @@ static int dbase_policydb_list(semanage_handle_t * handle,
ERR(handle, "out of memory");
err:
- for (; list_arg.pos >= 0; list_arg.pos--)
- dbase->rtable->free(tmp_records[list_arg.pos]);
- free(tmp_records);
+ if (tmp_records) {
+ for (; list_arg.pos >= 0; list_arg.pos--)
+ dbase->rtable->free(tmp_records[list_arg.pos]);
+ free(tmp_records);
+ }
ERR(handle, "could not list records");
return STATUS_ERR;
}
diff --git a/libsemanage/src/debug.c b/libsemanage/src/debug.c
index 90d4b4e..ea51ffb 100644
--- a/libsemanage/src/debug.c
+++ b/libsemanage/src/debug.c
@@ -62,11 +62,12 @@ void hidden semanage_msg_default_handler(void *varg __attribute__ ((unused)),
switch (semanage_msg_get_level(handle)) {
case SEMANAGE_MSG_ERR:
+ stream = stderr;
errsv = errno;
+ break;
case SEMANAGE_MSG_WARN:
stream = stderr;
break;
- case SEMANAGE_MSG_INFO:
default:
stream = stdout;
break;
diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
index 4f919a6..64dc7d9 100644
--- a/libsemanage/src/direct_api.c
@ -284,6 +340,31 @@ index 4f919a6..64dc7d9 100644
return retval;
}
diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index 15bca6c..26f6dd8 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -283,7 +283,7 @@ static semanage_list_t *get_home_dirs(genhomedircon_settings_t * s)
char *rbuf = NULL;
char *path = NULL;
long rbuflen;
- uid_t temp, minuid = 0;
+ uid_t temp, minuid = 500;
int minuid_set = 0;
struct passwd pwstorage, *pwbuf;
struct stat buf;
@@ -346,11 +346,6 @@ static semanage_list_t *get_home_dirs(genhomedircon_settings_t * s)
free(path);
path = NULL;
- if (!minuid_set) {
- minuid = 500;
- minuid_set = 1;
- }
-
rbuflen = sysconf(_SC_GETPW_R_SIZE_MAX);
if (rbuflen <= 0)
goto fail;
diff --git a/libsemanage/src/handle.c b/libsemanage/src/handle.c
index 7fcd2b4..6aa9057 100644
--- a/libsemanage/src/handle.c
@ -356,7 +437,7 @@ index 95f8ec3..9b7852c 100644
} semanage_conf_t;
diff --git a/libsemanage/src/semanage_store.c b/libsemanage/src/semanage_store.c
index cd7ce68..13c25e3 100644
index cd7ce68..66f37ec 100644
--- a/libsemanage/src/semanage_store.c
+++ b/libsemanage/src/semanage_store.c
@@ -448,7 +448,7 @@ int semanage_enable_module(const char *file) {
@ -368,6 +449,15 @@ index cd7ce68..13c25e3 100644
if ((unlink(path) < 0) && (errno != ENOENT))
return -1;
@@ -1061,7 +1061,7 @@ int semanage_split_fc(semanage_handle_t * sh)
}
hd = open(semanage_path(SEMANAGE_TMP, SEMANAGE_HOMEDIR_TMPL),
O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
- if (!hd) {
+ if (hd < 0) {
ERR(sh, "Could not open %s for writing.",
semanage_path(SEMANAGE_TMP, SEMANAGE_HOMEDIR_TMPL));
goto cleanup;
@@ -1100,6 +1100,17 @@ int semanage_split_fc(semanage_handle_t * sh)
}

View File

@ -4,13 +4,13 @@
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")}
%endif
%define libsepolver 2.1.8-1
%define libselinuxver 2.1.12-1
%define libsepolver 2.1.8-5
%define libselinuxver 2.1.12-10
Summary: SELinux binary policy manipulation library
Name: libsemanage
Version: 2.1.9
Release: 2%{?dist}
Release: 3%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: libsemanage-%{version}.tgz
@ -180,6 +180,11 @@ rm -rf ${RPM_BUILD_ROOT}
%endif # if with_python3
%changelog
* Sat Jan 5 2013 Dan Walsh <dwalsh@redhat.com> 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 <dwalsh@redhat.com> - 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.