From: Howard Chu Date: Tue, 10 May 2005 00:51:28 +0000 (+0000) Subject: More value ACL style tweaks X-Git-Tag: OPENLDAP_AC_BP~678 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f19a4ea9ecef75408898dce53641f0f48c9abfad;p=openldap More value ACL style tweaks --- diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index d51ffa37d2..e71d14fcca 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -920,11 +920,11 @@ acl_get( if ( vdnlen < patlen ) continue; - if ( a->acl_dn_style == ACL_STYLE_BASE ) { + if ( a->acl_attrval_style == ACL_STYLE_BASE ) { if ( vdnlen > patlen ) continue; - } else if ( a->acl_dn_style == ACL_STYLE_ONE ) { + } else if ( a->acl_attrval_style == ACL_STYLE_ONE ) { int rdnlen = -1; if ( !DN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) @@ -934,11 +934,11 @@ acl_get( if ( rdnlen != vdnlen - patlen - 1 ) continue; - } else if ( a->acl_dn_style == ACL_STYLE_SUBTREE ) { + } else if ( a->acl_attrval_style == ACL_STYLE_SUBTREE ) { if ( vdnlen > patlen && !DN_SEPARATOR( val->bv_val[vdnlen - patlen - 1] ) ) continue; - } else if ( a->acl_dn_style == ACL_STYLE_CHILDREN ) { + } else if ( a->acl_attrval_style == ACL_STYLE_CHILDREN ) { if ( vdnlen <= patlen ) continue; diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index 56ac41e109..62f7dad9fb 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -38,10 +38,11 @@ #include "lber_pvt.h" #include "lutil.h" +static const char style_base[] = "base"; static char *style_strings[] = { "regex", "expand", - "base", + "exact", "one", "subtree", "children", @@ -2349,7 +2350,10 @@ dnaccess2text( slap_dn_access *bdn, char *ptr, int is_realdn ) } else { ptr = lutil_strcopy( ptr, "dn." ); - ptr = lutil_strcopy( ptr, style_strings[bdn->a_style] ); + if ( bdn->a_style == ACL_STYLE_BASE ) + ptr = lutil_strcopy( ptr, style_base ); + else + ptr = lutil_strcopy( ptr, style_strings[bdn->a_style] ); if ( bdn->a_style == ACL_STYLE_LEVEL ) { int n = sprintf( ptr, "{%d}", bdn->a_level ); if ( n > 0 ) { @@ -2537,7 +2541,10 @@ acl_unparse( AccessControl *a, struct berval *bv ) if ( !BER_BVISNULL( &a->acl_dn_pat ) ) { to++; ptr = lutil_strcopy( ptr, " dn." ); - ptr = lutil_strcopy( ptr, style_strings[a->acl_dn_style] ); + if ( a->acl_dn_style == ACL_STYLE_BASE ) + ptr = lutil_strcopy( ptr, style_base ); + else + ptr = lutil_strcopy( ptr, style_strings[a->acl_dn_style] ); *ptr++ = '='; *ptr++ = '"'; ptr = lutil_strcopy( ptr, a->acl_dn_pat.bv_val ); @@ -2579,7 +2586,12 @@ acl_unparse( AccessControl *a, struct berval *bv ) if ( !BER_BVISEMPTY( &a->acl_attrval ) ) { to++; ptr = lutil_strcopy( ptr, " val." ); - ptr = lutil_strcopy( ptr, style_strings[a->acl_attrval_style] ); + if ( a->acl_attrval_style == ACL_STYLE_BASE && + a->acl_attrs[0].an_desc->ad_type->sat_syntax == + slap_schema.si_syn_distinguishedName ) + ptr = lutil_strcopy( ptr, style_base ); + else + ptr = lutil_strcopy( ptr, style_strings[a->acl_attrval_style] ); *ptr++ = '='; *ptr++ = '"'; ptr = lutil_strcopy( ptr, a->acl_attrval.bv_val );