diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-16 16:04:50 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 13:08:10 -0700 |
commit | 5d578b850a9dd9bb252298ce6bba90424b7cb5c2 (patch) | |
tree | 500d8e095fc2d680a536a1cdeadc524bdac43db6 /ldap/servers/plugins/acl/acllas.c | |
parent | ec7310dcbab6bf812934759c96881b0ecba33dc7 (diff) | |
download | ds-5d578b850a9dd9bb252298ce6bba90424b7cb5c2.tar.gz ds-5d578b850a9dd9bb252298ce6bba90424b7cb5c2.tar.xz ds-5d578b850a9dd9bb252298ce6bba90424b7cb5c2.zip |
Bug 614511 - fix coverity Defect Type: Null pointer dereferences issues 11846 - 11891
https://bugzilla.redhat.com/show_bug.cgi?id=614511
11856
Comment: If the aci "rule" does not include "($dn)", there is no
pointer assigined to aci_macro and matched_val is NULL. In that
case, acllas_replace_dn_macro is supposed to return just "user"
itself regardless of [$dn].
Diffstat (limited to 'ldap/servers/plugins/acl/acllas.c')
-rw-r--r-- | ldap/servers/plugins/acl/acllas.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ldap/servers/plugins/acl/acllas.c b/ldap/servers/plugins/acl/acllas.c index cc894bdc..25f544dc 100644 --- a/ldap/servers/plugins/acl/acllas.c +++ b/ldap/servers/plugins/acl/acllas.c @@ -4148,19 +4148,21 @@ acllas_replace_dn_macro( char *rule, char *matched_val, lasInfo *lasinfo) { /* Determine what the rule's got once */ if ( strstr(rule, ACL_RULE_MACRO_DN_KEY) != NULL) { + /* ($dn) exists */ has_macro_dn = 1; } if ( strstr(rule, ACL_RULE_MACRO_DN_LEVELS_KEY) != NULL) { + /* [$dn] exists */ has_macro_levels = 1; } - if ( !has_macro_dn && !has_macro_levels ) { + if ( !has_macro_dn ) { /* No $(dn) */ /* * No $dn thing, just return a list with two elements, rule and NULL. * charray_add will create the list and null terminate it. - */ + */ charray_add( &a, slapi_ch_strdup(rule)); return(a); @@ -4170,12 +4172,9 @@ acllas_replace_dn_macro( char *rule, char *matched_val, lasInfo *lasinfo) { * Have an occurrence of the macro rules * * First, replace all occurrencers of ($dn) with the matched_val - */ - - if ( has_macro_dn) { - patched_rule = + */ + patched_rule = acl_replace_str(rule, ACL_RULE_MACRO_DN_KEY, matched_val); - } /* If there are no [$dn] we're done */ @@ -4196,7 +4195,7 @@ acllas_replace_dn_macro( char *rule, char *matched_val, lasInfo *lasinfo) { * If has_macro_dn then patched_rule is the rule to strart with, * and this needs to be freed at the end, otherwise * just use rule. - */ + */ if (patched_rule) { rule_to_use = patched_rule; |