Call fini_selinuxmnt if selinux is disabled, to cause is_selinux_disabled() to report correct data

This commit is contained in:
Dan Walsh 2011-04-05 11:37:30 -04:00
parent 0cd375f839
commit 9ac8a9964b

View File

@ -1,3 +1,17 @@
diff --git a/libselinux/include/selinux/selinux.h b/libselinux/include/selinux/selinux.h
index 0725b57..b2a38fb 100644
--- a/libselinux/include/selinux/selinux.h
+++ b/libselinux/include/selinux/selinux.h
@@ -514,6 +514,9 @@ extern int selinux_check_securetty_context(const security_context_t tty_context)
which performs the initial mount of selinuxfs. */
void set_selinuxmnt(char *mnt);
+/* clear selinuxmnt variable and free allocated memory */
+void fini_selinuxmnt(void);
+
/* Execute a helper for rpm in an appropriate security context. */
extern int rpm_execcon(unsigned int verified,
const char *filename,
diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index bf665ab..ccd08ae 100644
--- a/libselinux/src/Makefile
@ -174,6 +188,26 @@ index b245364..7c47222 100644
va_start(ap, fmt);
rc = vfprintf(stderr, fmt, ap);
va_end(ap);
diff --git a/libselinux/src/init.c b/libselinux/src/init.c
index 1dd9838..a948920 100644
--- a/libselinux/src/init.c
+++ b/libselinux/src/init.c
@@ -96,12 +96,14 @@ static void init_selinuxmnt(void)
return;
}
-static void fini_selinuxmnt(void)
+void fini_selinuxmnt(void)
{
free(selinux_mnt);
selinux_mnt = NULL;
}
+hidden_def(fini_selinuxmnt)
+
void set_selinuxmnt(char *mnt)
{
selinux_mnt = strdup(mnt);
diff --git a/libselinux/src/load_policy.c b/libselinux/src/load_policy.c
index 36ce029..83d2143 100644
--- a/libselinux/src/load_policy.c
@ -286,6 +320,18 @@ index fd63a4f..705012c 100644
def selinux_contexts_path():
return _selinux.selinux_contexts_path()
selinux_contexts_path = _selinux.selinux_contexts_path
diff --git a/libselinux/src/selinux_internal.h b/libselinux/src/selinux_internal.h
index fdddfaf..14cc412 100644
--- a/libselinux/src/selinux_internal.h
+++ b/libselinux/src/selinux_internal.h
@@ -3,6 +3,7 @@
#include "dso.h"
hidden_proto(selinux_mkload_policy)
+ hidden_proto(fini_selinuxmnt)
hidden_proto(set_selinuxmnt)
hidden_proto(security_disable)
hidden_proto(security_policyvers)
diff --git a/libselinux/src/selinuxswig_python.i b/libselinux/src/selinuxswig_python.i
index dea0e80..bb227e9 100644
--- a/libselinux/src/selinuxswig_python.i