Skip to contentSkip to conversation

Remove connection requirement from POLICYDB backend

SEMANAGE Ivan Gyurdiev 2 participants 2 messages Oct 18, 2005 – Oct 19, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

This patch removes the is_connected check from the POLICYDB backend, because it doesn't accomplish anything. What we really want to check is whether the function was initialized or not (which can't be done at this point anyway, because we're _already_ executing this function - this is handled by the default database which I added).

Regarding is_connected.... we don't want to check that, because the POLICYDB backend will only be used in the policy server itself, which is exactly where we do not want a connection (server doesn't connect to itself). In the clients using a policy server, we're not using the POLICYDB backend - we're using the SERVER backend, where this parameter will be checked.

Besides, as is... those databases aren't even initialized if you don't call connect, so it's impossible to be executing that function while disconnected (although in the future we could initialize a database somewhere other than on connect).

libsemanage/src/database_policydb.c +0 -10
diff -Naurp --exclude CVS --exclude ChangeLog --exclude VERSION --exclude 'semanage_store*' --exclude 'module_record*' --exclude 'database_directory*' old/libsemanage/src/database_policydb.c new/libsemanage/src/database_policydb.c
@@ -155,11 +155,6 @@ static int enter_ro(
 	semanage_handle_t* handle,
 	dbase_policydb_t* dbase) {
 
-	if (!handle->is_connected) {
-		/* FIXME: handle error */
-		return STATUS_ERR;
-	}
-	
 	if (semanage_get_read_lock(handle) < 0) {
 		/* FIXME: handle error */
 		return STATUS_ERR;
@@ -185,11 +180,6 @@ static int enter_rw(
 	semanage_handle_t* handle,
 	dbase_policydb_t* dbase) {
 
-	if (!handle->is_connected) {
-		/* FIXME: handle error */
-		return STATUS_ERR;
-	}
-	
 	if (!handle->is_in_transaction) {
 		/* FIXME: handle error */
 		return STATUS_ERR;
#1 lore raw
Quoted 5 lines · Ivan Gyurdiev

This patch removes the is_connected check from the POLICYDB backend, because it doesn't accomplish anything. What we really want to check is whether the function was initialized or not (which can't be done at this point anyway, because we're _already_ executing this function - this is handled by the default database which I added).

Both patches (default dbase, remove connect) merged as of libsemanage 1.3.24.

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.