From da03eb03908d6992aaada9465e2b80a393929967 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 9 Dec 2005 10:33:01 +0000 Subject: [PATCH] normalize value in "exact" attrval clause (ITS#4255) --- servers/slapd/acl.c | 4 ++-- servers/slapd/aclparse.c | 51 ++++++++++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 48d5eb7f14..e4a2b8f169 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -885,7 +885,7 @@ slap_acl_get( if ( a->acl_attrs[0].an_desc->ad_type->sat_syntax != slap_schema.si_syn_distinguishedName ) { if (value_match( &match, desc, - /* desc->ad_type->sat_equality */ a->acl_attrval_mr, 0, + a->acl_attrval_mr, 0, val, &a->acl_attrval, &text ) != LDAP_SUCCESS || match ) continue; @@ -925,7 +925,7 @@ slap_acl_get( continue; } - if ( strcmp( a->acl_attrval.bv_val, val->bv_val + vdnlen - patlen )) + if ( strcmp( a->acl_attrval.bv_val, val->bv_val + vdnlen - patlen ) ) continue; } } diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index c9ae1809fe..5893faa200 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -475,7 +475,8 @@ parse_acl( } } else if ( strncasecmp( left, "val", 3 ) == 0 ) { - char *mr; + struct berval bv; + char *mr; if ( !BER_BVISEMPTY( &a->acl_attrval ) ) { Debug( LDAP_DEBUG_ANY, @@ -491,7 +492,7 @@ parse_acl( return acl_usage(); } - ber_str2bv( right, 0, 1, &a->acl_attrval ); + ber_str2bv( right, 0, 0, &bv ); a->acl_attrval_style = ACL_STYLE_BASE; mr = strchr( left, '/' ); @@ -525,7 +526,7 @@ parse_acl( if ( style != NULL ) { if ( strcasecmp( style, "regex" ) == 0 ) { - int e = regcomp( &a->acl_attrval_re, a->acl_attrval.bv_val, + int e = regcomp( &a->acl_attrval_re, bv.bv_val, REG_EXTENDED | REG_ICASE | REG_NOSUB ); if ( e ) { char err[SLAP_TEXT_BUFLEN], @@ -553,8 +554,6 @@ parse_acl( } else if ( a->acl_attrs[0].an_desc->ad_type-> sat_syntax == slap_schema.si_syn_distinguishedName ) { - struct berval bv; - if ( !strcasecmp( style, "baseObject" ) || !strcasecmp( style, "base" ) ) { @@ -576,8 +575,10 @@ parse_acl( snprintf( buf, sizeof( buf ), "unknown val.