From: Kurt Zeilenga Date: Sun, 9 Sep 2001 18:58:54 +0000 (+0000) Subject: Clean up asserts, should assert desc != NULL instead of attr != NULL X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1104 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=09a7bd4331ef5141d9709d2179ba6b859c0cd8d0;p=openldap Clean up asserts, should assert desc != NULL instead of attr != NULL --- diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 657145712a..c71cee75bb 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -87,10 +87,16 @@ access_allowed( #endif slap_mask_t mask; slap_control_t control; + const char *attr; + regmatch_t matches[MAXREMATCHES]; - const char *attr = desc ? desc->ad_cname->bv_val : NULL; + assert( e != NULL ); + assert( desc != NULL ); + assert( access > ACL_NONE ); - regmatch_t matches[MAXREMATCHES]; + attr = desc->ad_cname->bv_val; + + assert( attr != NULL ); #ifdef NEW_LOGGING LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY, @@ -103,10 +109,6 @@ access_allowed( e->e_dn, attr ); #endif - assert( e != NULL ); - assert( attr != NULL ); - assert( access > ACL_NONE ); - if ( op == NULL ) { /* no-op call */ return 1; @@ -289,8 +291,11 @@ acl_get( assert( e != NULL ); assert( count != NULL ); + assert( desc != NULL ); - attr = desc ? desc->ad_cname->bv_val : NULL; + attr = desc->ad_cname->bv_val; + + assert( attr != NULL ); if( a == NULL ) { if( be == NULL ) { @@ -453,10 +458,15 @@ acl_mask( #ifdef LDAP_DEBUG char accessmaskbuf[ACCESSMASK_MAXLEN]; #endif - const char *attr = desc ? desc->ad_cname->bv_val : NULL; + const char *attr; assert( a != NULL ); assert( mask != NULL ); + assert( desc != NULL ); + + attr = desc->ad_cname->bv_val; + + assert( attr != NULL ); #ifdef NEW_LOGGING LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY, @@ -676,15 +686,17 @@ acl_mask( struct berval bv; int rc, match = 0; const char *text; - const char *desc = b->a_dn_at->ad_cname->bv_val; + const char *attr = b->a_dn_at->ad_cname->bv_val; + + assert( attr != NULL ); #ifdef NEW_LOGGING LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1, "acl_mask: conn %d check a_dn_pat: %s\n", - conn->c_connid, desc )); + conn->c_connid, attr )); #else Debug( LDAP_DEBUG_ACL, "<= check a_dn_at: %s\n", - desc, 0, 0); + attr, 0, 0); #endif bv.bv_val = op->o_ndn; bv.bv_len = strlen( bv.bv_val ); @@ -1549,6 +1561,8 @@ aci_mask( int rc; char *attr = desc->ad_cname->bv_val; + assert( attr != NULL ); + /* parse an aci of the form: oid#scope#action;rights;attr;rights;attr$action;rights;attr;rights;attr#dnType#subjectDN