|
|
3711b83 |
diff --git a/libsemanage/src/handle.c b/libsemanage/src/handle.c
|
|
|
3711b83 |
index 7adc1cc..7fcd2b4 100644
|
|
|
3711b83 |
--- a/libsemanage/src/handle.c
|
|
|
3711b83 |
+++ b/libsemanage/src/handle.c
|
|
|
3711b83 |
@@ -37,10 +37,12 @@
|
|
|
3711b83 |
#include "semanage_store.h"
|
|
|
3711b83 |
|
|
|
3711b83 |
#define SEMANAGE_COMMIT_READ_WAIT 5
|
|
|
3711b83 |
+#define SEMANAGE_CONF_PATH "/etc/selinux/semanage.conf"
|
|
|
3711b83 |
|
|
|
3711b83 |
#include <string.h>
|
|
|
3711b83 |
#include <selinux/selinux.h>
|
|
|
3711b83 |
static char *private_selinux_path = NULL;
|
|
|
3711b83 |
+static char *private_semanage_conf_path = NULL;
|
|
|
3711b83 |
static char *private_file_context_path = NULL;
|
|
|
3711b83 |
static char *private_file_context_local_path = NULL;
|
|
|
3711b83 |
static char *private_file_context_homedir_path = NULL;
|
|
|
3711b83 |
@@ -52,6 +54,7 @@ static char *private_policy_root = NULL;
|
|
|
3711b83 |
|
|
|
3711b83 |
void semanage_free_root() {
|
|
|
3711b83 |
free(private_selinux_path); private_selinux_path = NULL;
|
|
|
3711b83 |
+ free(private_semanage_conf_path); private_semanage_conf_path = NULL;
|
|
|
3711b83 |
free(private_file_context_path); private_file_context_path = NULL;
|
|
|
3711b83 |
free(private_file_context_local_path); private_file_context_local_path = NULL;
|
|
|
3711b83 |
free(private_file_context_homedir_path); private_file_context_homedir_path = NULL;
|
|
|
3711b83 |
@@ -68,6 +71,10 @@ int semanage_set_root(const char *path) {
|
|
|
3711b83 |
goto error;
|
|
|
3711b83 |
}
|
|
|
3711b83 |
|
|
|
3711b83 |
+ if ( asprintf(&private_semanage_conf_path, "%s/%s", path, SEMANAGE_CONF_PATH) < 0 ) {
|
|
|
3711b83 |
+ goto error;
|
|
|
3711b83 |
+ }
|
|
|
3711b83 |
+
|
|
|
3711b83 |
if ( asprintf(&private_file_context_path, "%s/%s", path, selinux_file_context_path()) < 0 ) {
|
|
|
3711b83 |
goto error;
|
|
|
3711b83 |
}
|
|
|
3711b83 |
@@ -171,6 +178,21 @@ const char *semanage_selinux_path(void) {
|
|
|
3711b83 |
return selinux_path();
|
|
|
3711b83 |
}
|
|
|
3711b83 |
|
|
|
3711b83 |
+/* Return a fully-qualified path + filename to the semanage
|
|
|
3711b83 |
+ * configuration file. The caller must not alter the string returned
|
|
|
3711b83 |
+ * (and hence why this function return type is const).
|
|
|
3711b83 |
+ *
|
|
|
3711b83 |
+ */
|
|
|
3711b83 |
+
|
|
|
3711b83 |
+const char *semanage_conf_path(void)
|
|
|
3711b83 |
+{
|
|
|
3711b83 |
+ if (private_semanage_conf_path &&
|
|
|
3711b83 |
+ access(private_semanage_conf_path, R_OK) == 0)
|
|
|
3711b83 |
+ return private_semanage_conf_path;
|
|
|
3711b83 |
+
|
|
|
3711b83 |
+ return SEMANAGE_CONF_PATH;
|
|
|
3711b83 |
+}
|
|
|
3711b83 |
+
|
|
|
3711b83 |
semanage_handle_t *semanage_handle_create(void)
|
|
|
3711b83 |
{
|
|
|
3711b83 |
semanage_handle_t *sh = NULL;
|
|
|
3711b83 |
diff --git a/libsemanage/src/handle.h b/libsemanage/src/handle.h
|
|
|
3711b83 |
index 723d811..bb12594 100644
|
|
|
3711b83 |
--- a/libsemanage/src/handle.h
|
|
|
3711b83 |
+++ b/libsemanage/src/handle.h
|
|
|
3711b83 |
@@ -105,6 +105,8 @@ struct semanage_handle {
|
|
|
3711b83 |
dbase_config_t dbase[DBASE_COUNT];
|
|
|
3711b83 |
};
|
|
|
3711b83 |
|
|
|
3711b83 |
+const char *semanage_conf_path(void);
|
|
|
3711b83 |
+
|
|
|
3711b83 |
/* === Local modifications === */
|
|
|
3711b83 |
static inline
|
|
|
3711b83 |
dbase_config_t * semanage_user_base_dbase_local(semanage_handle_t * handle)
|
|
|
3711b83 |
diff --git a/libsemanage/src/semanage_store.c b/libsemanage/src/semanage_store.c
|
|
|
3711b83 |
index a223aa7..0e7b71a 100644
|
|
|
3711b83 |
--- a/libsemanage/src/semanage_store.c
|
|
|
3711b83 |
+++ b/libsemanage/src/semanage_store.c
|
|
|
3711b83 |
@@ -262,18 +262,6 @@ const char *semanage_path(enum semanage_store_defs store,
|
|
|
3711b83 |
return semanage_paths[store][path_name];
|
|
|
3711b83 |
}
|
|
|
3711b83 |
|
|
|
3711b83 |
-/* Return a fully-qualified path + filename to the semanage
|
|
|
3711b83 |
- * configuration file. The caller must not alter the string returned
|
|
|
3711b83 |
- * (and hence why this function return type is const).
|
|
|
3711b83 |
- *
|
|
|
3711b83 |
- * This is going to be hard coded to /etc/selinux/semanage.conf for
|
|
|
3711b83 |
- * the time being. FIXME
|
|
|
3711b83 |
- */
|
|
|
3711b83 |
-const char *semanage_conf_path(void)
|
|
|
3711b83 |
-{
|
|
|
3711b83 |
- return "/etc/selinux/semanage.conf";
|
|
|
3711b83 |
-}
|
|
|
3711b83 |
-
|
|
|
3711b83 |
/**************** functions that create module store ***************/
|
|
|
3711b83 |
|
|
|
3711b83 |
/* Check that the semanage store exists. If 'create' is non-zero then
|
|
|
3711b83 |
diff --git a/libsemanage/src/semanage_store.h b/libsemanage/src/semanage_store.h
|
|
|
3711b83 |
index b451308..98e011d 100644
|
|
|
3711b83 |
--- a/libsemanage/src/semanage_store.h
|
|
|
3711b83 |
+++ b/libsemanage/src/semanage_store.h
|
|
|
3711b83 |
@@ -66,7 +66,6 @@ enum semanage_sandbox_defs {
|
|
|
3711b83 |
/* FIXME: this needs to be made a module store specific init and the
|
|
|
3711b83 |
* global configuration moved to another file.
|
|
|
3711b83 |
*/
|
|
|
3711b83 |
-const char *semanage_conf_path(void);
|
|
|
3711b83 |
int semanage_check_init(const char *root);
|
|
|
3711b83 |
|
|
|
3711b83 |
extern const char *semanage_fname(enum semanage_sandbox_defs file_enum);
|