]> git.sur5r.net Git - openldap/commitdiff
More value ACL style tweaks
authorHoward Chu <hyc@openldap.org>
Tue, 10 May 2005 00:51:28 +0000 (00:51 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 10 May 2005 00:51:28 +0000 (00:51 +0000)
servers/slapd/acl.c
servers/slapd/aclparse.c

index d51ffa37d2aa4db425f7d98ceab7c04e2e39a34b..e71d14fcca2ef5059df69accce86e1d2bcaa2b4a 100644 (file)
@@ -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;
        
index 56ac41e10998ed4208b3d212a97b239accf8e761..62f7dad9fb9f6dae05388efc5e1b24a4a5a7d053 100644 (file)
 #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 );