Skip to contentSkip to conversation

Pass fname argument to all file-backed dbases

SEMANAGE Ivan Gyurdiev 2 participants 2 messages Jan 28, 2006 – Jan 30, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

... so we can easily configure it in one place, and instantiate those multiple times on different files if necessary (which it will be shortly, in the seuser case).

Ok, so I've switched to a 64-bit system, and the first thing I see is that everything gets installed in the completely wrong place until I export LIBDIR/SHLIBDIR to point to lib64. Is this normal, or should the Makefile do something about that? The second thing I see is a bunch of warnings, which I'll be tracking down soon...

libsemanage/src/boolean_internal.h +1 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/boolean_internal.h new/libsemanage/src/boolean_internal.h
@@ -26,6 +26,7 @@ extern record_table_t SEMANAGE_BOOL_RTAB
 
 extern int bool_file_dbase_init(
 	semanage_handle_t* handle,
+	const char* fname,
 	dbase_config_t* dconfig);
 
 extern void bool_file_dbase_release(
libsemanage/src/booleans_file.c +2 -1
diff -Naurp --exclude-from excludes old/libsemanage/src/booleans_file.c new/libsemanage/src/booleans_file.c
@@ -110,11 +110,12 @@ record_file_table_t SEMANAGE_BOOL_FILE_R
 
 int bool_file_dbase_init(
 	semanage_handle_t* handle, 
+	const char* fname,
 	dbase_config_t* dconfig) {
 	
 	if (dbase_file_init(
 		handle, 
-		"booleans.local",
+		fname,
 		&SEMANAGE_BOOL_RTABLE,
 		&SEMANAGE_BOOL_FILE_RTABLE, 
 		&dconfig->dbase) < 0)
libsemanage/src/direct_api.c +9 -5
diff -Naurp --exclude-from excludes old/libsemanage/src/direct_api.c new/libsemanage/src/direct_api.c
@@ -116,7 +116,7 @@ int semanage_direct_connect(semanage_han
 	sh->funcs = &direct_funcs;
 
         /* Configure object databases */
-	if (user_base_file_dbase_init(sh, 
+	if (user_base_file_dbase_init(sh, "users.local", 
 		semanage_user_base_dbase_local(sh)) < 0)
 		goto err;
 
@@ -130,20 +130,24 @@ int semanage_direct_connect(semanage_han
 		semanage_user_dbase_local(sh)) < 0)
 		goto err;
 
-	if (port_file_dbase_init(sh, semanage_port_dbase_local(sh)) < 0)
+	if (port_file_dbase_init(sh, "ports.local", 
+		semanage_port_dbase_local(sh)) < 0)
 		goto err;
 
-	if (iface_file_dbase_init(sh, semanage_iface_dbase_local(sh)) < 0)
+	if (iface_file_dbase_init(sh, "interfaces.local",
+		semanage_iface_dbase_local(sh)) < 0)
 		goto err;
 
-	if (bool_file_dbase_init(sh, semanage_bool_dbase_local(sh)) < 0)
+	if (bool_file_dbase_init(sh, "booleans.local",
+		semanage_bool_dbase_local(sh)) < 0)
 		goto err;
 
 	if (fcontext_file_dbase_init(sh, "file_contexts.local", 
 		semanage_fcontext_dbase_local(sh)) < 0)
 		goto err;
 
-	if (seuser_file_dbase_init(sh, semanage_seuser_dbase_local(sh)) < 0)
+	if (seuser_file_dbase_init(sh, "seusers",
+		semanage_seuser_dbase_local(sh)) < 0)
 		goto err;
 
 	if (user_extra_file_dbase_init(sh, "users_extra.system",
libsemanage/src/iface_internal.h +1 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/iface_internal.h new/libsemanage/src/iface_internal.h
@@ -34,6 +34,7 @@ extern void iface_policydb_dbase_release
 
 extern int iface_file_dbase_init(
 	semanage_handle_t* handle,
+	const char* fname,
 	dbase_config_t* dconfig);
 
 extern void iface_file_dbase_release(
libsemanage/src/interfaces_file.c +4 -3
diff -Naurp --exclude-from excludes old/libsemanage/src/interfaces_file.c new/libsemanage/src/interfaces_file.c
@@ -150,12 +150,13 @@ record_file_table_t SEMANAGE_IFACE_FILE_
 };
 
 int iface_file_dbase_init(
-	semanage_handle_t* handle, 
+	semanage_handle_t* handle,
+	const char* fname, 
 	dbase_config_t* dconfig) {
 	
 	if (dbase_file_init(
-		handle, 
-		"interfaces.local",	
+		handle,
+		fname, 
 		&SEMANAGE_IFACE_RTABLE,
 		&SEMANAGE_IFACE_FILE_RTABLE, 
 		&dconfig->dbase) < 0)
libsemanage/src/port_internal.h +1 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/port_internal.h new/libsemanage/src/port_internal.h
@@ -31,6 +31,7 @@ extern record_table_t SEMANAGE_PORT_RTAB
 
 extern int port_file_dbase_init(
 	semanage_handle_t* handle,
+	const char* fname,
 	dbase_config_t* dconfig);
 
 extern void port_file_dbase_release(
libsemanage/src/ports_file.c +2 -1
diff -Naurp --exclude-from excludes old/libsemanage/src/ports_file.c new/libsemanage/src/ports_file.c
@@ -166,11 +166,12 @@ record_file_table_t SEMANAGE_PORT_FILE_R
 
 int port_file_dbase_init(
 	semanage_handle_t* handle,
+	const char* fname,
 	dbase_config_t* dconfig) {
 
 	if (dbase_file_init(
 		handle, 
-		"ports.local",
+		fname,
 		&SEMANAGE_PORT_RTABLE,
 		&SEMANAGE_PORT_FILE_RTABLE,
 		&dconfig->dbase) < 0)
libsemanage/src/seuser_internal.h +1 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/seuser_internal.h new/libsemanage/src/seuser_internal.h
@@ -29,6 +29,7 @@ extern record_table_t SEMANAGE_SEUSER_RT
 
 extern int seuser_file_dbase_init(
 	semanage_handle_t* handle,
+	const char* fname,
 	dbase_config_t* dconfig);
 
 extern void seuser_file_dbase_release(
libsemanage/src/seusers_file.c +3 -2
diff -Naurp --exclude-from excludes old/libsemanage/src/seusers_file.c new/libsemanage/src/seusers_file.c
@@ -117,12 +117,13 @@ record_file_table_t SEMANAGE_SEUSER_FILE
 };
 
 int seuser_file_dbase_init(
-	semanage_handle_t* handle, 
+	semanage_handle_t* handle,
+	const char* fname, 
 	dbase_config_t* dconfig) {
 
 	if (dbase_file_init(
 		handle, 
-		"seusers",
+		fname,
 		&SEMANAGE_SEUSER_RTABLE,
 		&SEMANAGE_SEUSER_FILE_RTABLE,
 		&dconfig->dbase) < 0)
libsemanage/src/user_internal.h +1 -0
diff -Naurp --exclude-from excludes old/libsemanage/src/user_internal.h new/libsemanage/src/user_internal.h
@@ -42,6 +42,7 @@ extern record_table_t SEMANAGE_USER_EXTR
 /* USER BASE record, FILE backend */
 extern int user_base_file_dbase_init(
 	semanage_handle_t* handle,
+	const char* fname,
 	dbase_config_t* dconfig);
 
 extern void user_base_file_dbase_release(
libsemanage/src/users_base_file.c +2 -1
diff -Naurp --exclude-from excludes old/libsemanage/src/users_base_file.c new/libsemanage/src/users_base_file.c
@@ -207,11 +207,12 @@ record_file_table_t SEMANAGE_USER_BASE_F
 
 int user_base_file_dbase_init(
 	semanage_handle_t* handle,
+	const char* fname,
 	dbase_config_t* dconfig) {
 	
 	if (dbase_file_init(
 		handle, 
-		"users.local",
+		fname,
 		&SEMANAGE_USER_BASE_RTABLE,
 		&SEMANAGE_USER_BASE_FILE_RTABLE, 
 		&dconfig->dbase) < 0)
#1 lore raw
Quoted 3 lines · Ivan Gyurdiev

... so we can easily configure it in one place, and instantiate those multiple times on different files if necessary (which it will be shortly, in the seuser case).

Merged as of libsemanage 1.5.19.

Quoted 5 lines

Ok, so I've switched to a 64-bit system, and the first thing I see is that everything gets installed in the completely wrong place until I export LIBDIR/SHLIBDIR to point to lib64. Is this normal, or should the Makefile do something about that?

.spec file has:
make DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="${RPM_BUILD_ROOT}%{_libdir}" SHLIBDIR="${RPM_BUILD_ROOT}/%{_lib}" install install-pywrap

Not sure whether the Makefile should be smarter about it or just continue deferring to the invoker of make.

Quoted 2 lines

The second thing I see is a bunch of warnings, which I'll be tracking down soon...

Signature · 8 lines
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 [email protected] with
the words "unsubscribe selinux" without quotes as the message.