Skip to contentSkip to conversation

Subject: remove expand_rule function

PATCH In review Joshua Brindle 2 participants 3 messages Aug 12, 2008 – Aug 14, 2008 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Subject: remove expand_rule function

Send again with the right date and time ;)

This removes the (apparently) unused expand_rule function

---

 libsepol/src/expand.c |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)
libsepol/src/expand.c +0 -29
index 3194f8a..14dc4fc 100644
@@ -1917,35 +1917,6 @@ int expand_convert_type_set(policydb_t * p, uint32_t * typemap,
 	return 0;
 }
 
-/* Expand a rule into a given avtab - checking for conflicting type
- * rules.  Return 1 on success, 0 if the rule conflicts with something
- * (and hence was not added), or -1 on error. */
-int expand_rule(sepol_handle_t * handle,
-		policydb_t * source_pol,
-		avrule_t * source_rule, avtab_t * dest_avtab,
-		cond_av_list_t ** cond, cond_av_list_t ** other, int enabled)
-{
-	int retval;
-	ebitmap_t stypes, ttypes;
-
-	if (source_rule->specified & AVRULE_NEVERALLOW)
-		return 1;
-
-	ebitmap_init(&stypes);
-	ebitmap_init(&ttypes);
-
-	if (type_set_expand(&source_rule->stypes, &stypes, source_pol, 1))
-		return -1;
-	if (type_set_expand(&source_rule->ttypes, &ttypes, source_pol, 1))
-		return -1;
-	retval = expand_rule_helper(handle, source_pol, NULL,
-				    source_rule, dest_avtab,
-				    cond, other, enabled, &stypes, &ttypes);
-	ebitmap_destroy(&stypes);
-	ebitmap_destroy(&ttypes);
-	return retval;
-}
-
 int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p, uint32_t * rolemap)
 {
 	unsigned int i;

--
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.

#1 lore raw
Quoted 5 lines · Joshua Brindle

Send again with the right date and time ;)

This removes the (apparently) unused expand_rule function

Have you checked the history to see when/why this function stopped being used? And whether any external users like setools are using it?

Quoted 51 lines

---

 libsepol/src/expand.c |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)
libsepol/src/expand.c +0 -30
index 3194f8a..14dc4fc 100644
@@ -1917,35 +1917,6 @@ int expand_convert_type_set(policydb_t * p, uint32_t * typemap,
 	return 0;
 }
 
-/* Expand a rule into a given avtab - checking for conflicting type
- * rules.  Return 1 on success, 0 if the rule conflicts with something
- * (and hence was not added), or -1 on error. */
-int expand_rule(sepol_handle_t * handle,
-		policydb_t * source_pol,
-		avrule_t * source_rule, avtab_t * dest_avtab,
-		cond_av_list_t ** cond, cond_av_list_t ** other, int enabled)
-{
-	int retval;
-	ebitmap_t stypes, ttypes;
-
-	if (source_rule->specified & AVRULE_NEVERALLOW)
-		return 1;
-
-	ebitmap_init(&stypes);
-	ebitmap_init(&ttypes);
-
-	if (type_set_expand(&source_rule->stypes, &stypes, source_pol, 1))
-		return -1;
-	if (type_set_expand(&source_rule->ttypes, &ttypes, source_pol, 1))
-		return -1;
-	retval = expand_rule_helper(handle, source_pol, NULL,
-				    source_rule, dest_avtab,
-				    cond, other, enabled, &stypes, &ttypes);
-	ebitmap_destroy(&stypes);
-	ebitmap_destroy(&ttypes);
-	return retval;
-}
-
 int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p, uint32_t * rolemap)
 {
 	unsigned int i;
 
 
--

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.

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.
#2 lore raw
Quoted 10 lines · Stephen Smalley
Quoted 5 lines · Joshua Brindle

Send again with the right date and time ;)

This removes the (apparently) unused expand_rule function

Have you checked the history to see when/why this function stopped being used? And whether any external users like setools are using it?

it looks like it came in with the original expand patch and wasn't even in use then. SETools also does not use it.

Quoted 47 lines
Quoted 47 lines

---

 libsepol/src/expand.c |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)
libsepol/src/expand.c +0 -29
index 3194f8a..14dc4fc 100644
@@ -1917,35 +1917,6 @@ int expand_convert_type_set(policydb_t * p, uint32_t * typemap,
 	return 0;
 }
 
-/* Expand a rule into a given avtab - checking for conflicting type
- * rules.  Return 1 on success, 0 if the rule conflicts with something
- * (and hence was not added), or -1 on error. */
-int expand_rule(sepol_handle_t * handle,
-		policydb_t * source_pol,
-		avrule_t * source_rule, avtab_t * dest_avtab,
-		cond_av_list_t ** cond, cond_av_list_t ** other, int enabled)
-{
-	int retval;
-	ebitmap_t stypes, ttypes;
-
-	if (source_rule->specified & AVRULE_NEVERALLOW)
-		return 1;
-
-	ebitmap_init(&stypes);
-	ebitmap_init(&ttypes);
-
-	if (type_set_expand(&source_rule->stypes, &stypes, source_pol, 1))
-		return -1;
-	if (type_set_expand(&source_rule->ttypes, &ttypes, source_pol, 1))
-		return -1;
-	retval = expand_rule_helper(handle, source_pol, NULL,
-				    source_rule, dest_avtab,
-				    cond, other, enabled, &stypes, &ttypes);
-	ebitmap_destroy(&stypes);
-	ebitmap_destroy(&ttypes);
-	return retval;
-}
-
 int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * p, uint32_t * rolemap)
 {
 	unsigned int i;
Quoted 4 lines
Quoted 4 lines

--
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.

--
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.