* [SEMANAGE] Use the paths array
@ 2006-02-14 21:11 Ivan Gyurdiev
2006-02-15 14:42 ` Stephen Smalley
0 siblings, 1 reply; 2+ messages in thread
From: Ivan Gyurdiev @ 2006-02-14 21:11 UTC (permalink / raw)
To: SELinux List; +Cc: Stephen Smalley, Joshua Brindle
[-- Attachment #1: Type: text/plain, Size: 85 bytes --]
Joshua's complained about my non-use of the store path array.
Correct this issue.
[-- Attachment #2: libsemanage.use_store_paths.diff --]
[-- Type: text/x-patch, Size: 6084 bytes --]
diff -Naurp --exclude-from excludes old/libsemanage/src/direct_api.c new/libsemanage/src/direct_api.c
--- old/libsemanage/src/direct_api.c 2006-02-14 13:48:16.000000000 -0500
+++ new/libsemanage/src/direct_api.c 2006-02-14 15:06:35.000000000 -0500
@@ -117,11 +117,13 @@ int semanage_direct_connect(semanage_han
sh->funcs = &direct_funcs;
/* Object databases: local modifications */
- if (user_base_file_dbase_init(sh, "users.local",
+ if (user_base_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_USERS_BASE_LOCAL),
semanage_user_base_dbase_local(sh)) < 0)
goto err;
- if (user_extra_file_dbase_init(sh, "users_extra.local",
+ if (user_extra_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_USERS_EXTRA_LOCAL),
semanage_user_extra_dbase_local(sh)) < 0)
goto err;
@@ -131,27 +133,33 @@ int semanage_direct_connect(semanage_han
semanage_user_dbase_local(sh)) < 0)
goto err;
- if (port_file_dbase_init(sh, "ports.local",
+ if (port_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_PORTS_LOCAL),
semanage_port_dbase_local(sh)) < 0)
goto err;
- if (iface_file_dbase_init(sh, "interfaces.local",
+ if (iface_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_INTERFACES_LOCAL),
semanage_iface_dbase_local(sh)) < 0)
goto err;
- if (bool_file_dbase_init(sh, "booleans.local",
+ if (bool_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_BOOLEANS_LOCAL),
semanage_bool_dbase_local(sh)) < 0)
goto err;
- if (fcontext_file_dbase_init(sh, "file_contexts.local",
+ if (fcontext_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_FC_LOCAL),
semanage_fcontext_dbase_local(sh)) < 0)
goto err;
- if (seuser_file_dbase_init(sh, "seusers",
+ if (seuser_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_SEUSERS_LOCAL),
semanage_seuser_dbase_local(sh)) < 0)
goto err;
- if (node_file_dbase_init(sh, "nodes.local",
+ if (node_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_NODES_LOCAL),
semanage_node_dbase_local(sh)) < 0)
goto err;
@@ -160,7 +168,8 @@ int semanage_direct_connect(semanage_han
semanage_user_base_dbase_policy(sh)) < 0)
goto err;
- if (user_extra_file_dbase_init(sh, "users_extra",
+ if (user_extra_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_USERS_EXTRA),
semanage_user_extra_dbase_policy(sh)) < 0)
goto err;
@@ -179,11 +188,13 @@ int semanage_direct_connect(semanage_han
if (bool_policydb_dbase_init(sh, semanage_bool_dbase_policy(sh)) < 0)
goto err;
- if (fcontext_file_dbase_init(sh, "file_contexts",
+ if (fcontext_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_FC),
semanage_fcontext_dbase_policy(sh)) < 0)
goto err;
- if (seuser_file_dbase_init(sh, "seusers.final",
+ if (seuser_file_dbase_init(sh,
+ semanage_fname(SEMANAGE_SEUSERS),
semanage_seuser_dbase_policy(sh)) < 0)
goto err;
@@ -503,7 +514,7 @@ static int semanage_direct_commit(semana
/* Users_extra */
if (sepol_module_package_get_user_extra_len(base)) {
- if ((ofilename = semanage_path(SEMANAGE_TMP, SEMANAGE_USER_EXTRA)) == NULL ||
+ if ((ofilename = semanage_path(SEMANAGE_TMP, SEMANAGE_USERS_EXTRA)) == NULL ||
write_file(sh, ofilename, sepol_module_package_get_user_extra(base),
sepol_module_package_get_user_extra_len(base)) == -1) {
goto cleanup;
diff -Naurp --exclude-from excludes old/libsemanage/src/pywrap-test.py new/libsemanage/src/pywrap-test.py
--- old/libsemanage/src/pywrap-test.py 2006-02-14 16:09:26.000000000 -0500
+++ new/libsemanage/src/pywrap-test.py 2006-02-14 16:05:07.000000000 -0500
@@ -1026,8 +1026,6 @@ class Tests:
raise Error("Could not commit test transaction")
print "Commit status (transaction number): ", status
- self.test_nodes(sh)
-
status = semanage.semanage_begin_transaction(sh)
if status < 0:
raise Error("Could not start semanage transaction")
diff -Naurp --exclude-from excludes old/libsemanage/src/semanage_store.c new/libsemanage/src/semanage_store.c
--- old/libsemanage/src/semanage_store.c 2006-02-13 10:13:22.000000000 -0500
+++ new/libsemanage/src/semanage_store.c 2006-02-14 15:51:01.000000000 -0500
@@ -96,6 +96,14 @@ static const char *semanage_sandbox_path
"/homedir_template",
"/file_contexts.template",
"/commit_num",
+ "/ports.local",
+ "/interfaces.local",
+ "/nodes.local",
+ "/booleans.local",
+ "/file_contexts.local",
+ "/seusers",
+ "/users_extra.local",
+ "/users.local",
"/seusers.final",
"/users_extra",
};
@@ -188,6 +196,11 @@ int semanage_check_init(const char *root
return 0;
}
+/* Given a definition number, return a file name from the paths array */
+const char* semanage_fname(enum semanage_sandbox_defs file_enum) {
+ return semanage_sandbox_paths[file_enum];
+}
+
/* Given a store location (active/previous/tmp) and a definition
* number, return a fully-qualified path to that file or directory.
* The caller must not alter the string returned (and hence why this
diff -Naurp --exclude-from excludes old/libsemanage/src/semanage_store.h new/libsemanage/src/semanage_store.h
--- old/libsemanage/src/semanage_store.h 2006-02-07 09:20:42.000000000 -0500
+++ new/libsemanage/src/semanage_store.h 2006-02-14 15:06:19.000000000 -0500
@@ -45,8 +45,16 @@ enum semanage_sandbox_defs {
SEMANAGE_HOMEDIR_TMPL,
SEMANAGE_FC_TMPL,
SEMANAGE_COMMIT_NUM_FILE,
+ SEMANAGE_PORTS_LOCAL,
+ SEMANAGE_INTERFACES_LOCAL,
+ SEMANAGE_NODES_LOCAL,
+ SEMANAGE_BOOLEANS_LOCAL,
+ SEMANAGE_FC_LOCAL,
+ SEMANAGE_SEUSERS_LOCAL,
+ SEMANAGE_USERS_BASE_LOCAL,
+ SEMANAGE_USERS_EXTRA_LOCAL,
SEMANAGE_SEUSERS,
- SEMANAGE_USER_EXTRA,
+ SEMANAGE_USERS_EXTRA,
SEMANAGE_STORE_NUM_PATHS
};
@@ -55,7 +63,13 @@ enum semanage_sandbox_defs {
*/
const char *semanage_conf_path(void);
int semanage_check_init(const char *root);
-const char *semanage_path(enum semanage_store_defs store, enum semanage_sandbox_defs file);
+
+extern const char* semanage_fname(
+ enum semanage_sandbox_defs file_enum);
+
+extern const char *semanage_path(
+ enum semanage_store_defs store,
+ enum semanage_sandbox_defs file);
int semanage_create_store(semanage_handle_t *sh, int create);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [SEMANAGE] Use the paths array
2006-02-14 21:11 [SEMANAGE] Use the paths array Ivan Gyurdiev
@ 2006-02-15 14:42 ` Stephen Smalley
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2006-02-15 14:42 UTC (permalink / raw)
To: Ivan Gyurdiev; +Cc: SELinux List, Joshua Brindle
On Tue, 2006-02-14 at 16:11 -0500, Ivan Gyurdiev wrote:
> Joshua's complained about my non-use of the store path array.
> Correct this issue.
It appears that users.local and users_extra.local are in the wrong order
in the path array, or in the enumerated type - take your pick.
diff -Naurp --exclude-from excludes old/libsemanage/src/semanage_store.c new/libsemanage/src/semanage_store.c
--- old/libsemanage/src/semanage_store.c 2006-02-13 10:13:22.000000000 -0500
+++ new/libsemanage/src/semanage_store.c 2006-02-14 15:51:01.000000000 -0500
@@ -96,6 +96,14 @@ static const char *semanage_sandbox_path
"/homedir_template",
"/file_contexts.template",
"/commit_num",
+ "/ports.local",
+ "/interfaces.local",
+ "/nodes.local",
+ "/booleans.local",
+ "/file_contexts.local",
+ "/seusers",
+ "/users_extra.local",
+ "/users.local",
"/seusers.final",
"/users_extra",
};
diff -Naurp --exclude-from excludes old/libsemanage/src/semanage_store.h new/libsemanage/src/semanage_store.h
--- old/libsemanage/src/semanage_store.h 2006-02-07 09:20:42.000000000 -0500
+++ new/libsemanage/src/semanage_store.h 2006-02-14 15:06:19.000000000 -0500
@@ -45,8 +45,16 @@ enum semanage_sandbox_defs {
SEMANAGE_HOMEDIR_TMPL,
SEMANAGE_FC_TMPL,
SEMANAGE_COMMIT_NUM_FILE,
+ SEMANAGE_PORTS_LOCAL,
+ SEMANAGE_INTERFACES_LOCAL,
+ SEMANAGE_NODES_LOCAL,
+ SEMANAGE_BOOLEANS_LOCAL,
+ SEMANAGE_FC_LOCAL,
+ SEMANAGE_SEUSERS_LOCAL,
+ SEMANAGE_USERS_BASE_LOCAL,
+ SEMANAGE_USERS_EXTRA_LOCAL,
SEMANAGE_SEUSERS,
- SEMANAGE_USER_EXTRA,
+ SEMANAGE_USERS_EXTRA,
SEMANAGE_STORE_NUM_PATHS
};
--
Stephen Smalley
National Security Agency
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-15 14:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-14 21:11 [SEMANAGE] Use the paths array Ivan Gyurdiev
2006-02-15 14:42 ` Stephen Smalley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.