]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/aclparse.c
backend operations and callbacks conforms to the new API.
[openldap] / servers / slapd / aclparse.c
index 02703af4706bfa0f80dd51d884936b0a7a77f6db..e22f3263ec5a715c7550dc5f20dc42c43942534c 100644 (file)
@@ -1,7 +1,7 @@
 /* aclparse.c - routines to parse and check acl's */
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 
@@ -17,6 +17,7 @@
 
 #include "slap.h"
 #include "lber_pvt.h"
+#include "lutil.h"
 
 static void            split(char *line, int splitchar, char **left, char **right);
 static void            access_append(Access **l, Access *a);
@@ -184,7 +185,7 @@ parse_acl(
                                        } else if ( strcasecmp( style, "one" ) == 0 ) {
                                                a->acl_dn_style = ACL_STYLE_ONE;
                                                ber_str2bv( right, 0, 1, &a->acl_dn_pat );
-                                       } else if ( strcasecmp( style, "subtree" ) == 0 ) {
+                                       } else if ( strcasecmp( style, "subtree" ) == 0 || strcasecmp( style, "sub" ) == 0 ) {
                                                a->acl_dn_style = ACL_STYLE_SUBTREE;
                                                ber_str2bv( right, 0, 1, &a->acl_dn_pat );
                                        } else if ( strcasecmp( style, "children" ) == 0 ) {
@@ -201,8 +202,7 @@ parse_acl(
                                }
 
                                if ( strcasecmp( left, "filter" ) == 0 ) {
-                                       if ( (a->acl_filter = str2filter(
-                                           right )) == NULL ) {
+                                       if ( (a->acl_filter = str2filter( right )) == NULL ) {
                                                fprintf( stderr,
                                "%s: line %d: bad filter \"%s\" in to clause\n",
                                                    fname, lineno, right );
@@ -227,7 +227,7 @@ parse_acl(
                        }
 
                        if ( a->acl_dn_pat.bv_len != 0 &&
-                               strcmp(a->acl_dn_pat.bv_val, "*") == 0)
+                               strcmp(a->acl_dn_pat.bv_val, "*") == 0 )
                        {
                                free( a->acl_dn_pat.bv_val );
                                a->acl_dn_pat.bv_val = NULL;
@@ -307,7 +307,7 @@ parse_acl(
                                        sty = ACL_STYLE_BASE;
                                } else if ( strcasecmp( style, "one" ) == 0 ) {
                                        sty = ACL_STYLE_ONE;
-                               } else if ( strcasecmp( style, "subtree" ) == 0 ) {
+                               } else if ( strcasecmp( style, "subtree" ) == 0 || strcasecmp( style, "sub" ) == 0 ) {
                                        sty = ACL_STYLE_SUBTREE;
                                } else if ( strcasecmp( style, "children" ) == 0 ) {
                                        sty = ACL_STYLE_CHILDREN;
@@ -464,6 +464,15 @@ parse_acl(
                                                acl_usage();
                                        }
 
+                                       if( b->a_dn_at->ad_type->sat_equality == NULL )
+                                       {
+                                               fprintf( stderr,
+                                                       "%s: line %d: dnattr \"%s\": "
+                                                       "inappropriate matching (no EQUALITY)\n",
+                                                       fname, lineno, right );
+                                               acl_usage();
+                                       }
+
                                        continue;
                                }
 
@@ -1107,24 +1116,24 @@ accessmask2str( slap_mask_t mask, char *buf )
 
        if ( ACL_IS_LEVEL( mask ) ) {
                if ( ACL_LVL_IS_NONE(mask) ) {
-                       ptr = slap_strcopy( ptr, "none" );
+                       ptr = lutil_strcopy( ptr, "none" );
 
                } else if ( ACL_LVL_IS_AUTH(mask) ) {
-                       ptr = slap_strcopy( ptr, "auth" );
+                       ptr = lutil_strcopy( ptr, "auth" );
 
                } else if ( ACL_LVL_IS_COMPARE(mask) ) {
-                       ptr = slap_strcopy( ptr, "compare" );
+                       ptr = lutil_strcopy( ptr, "compare" );
 
                } else if ( ACL_LVL_IS_SEARCH(mask) ) {
-                       ptr = slap_strcopy( ptr, "search" );
+                       ptr = lutil_strcopy( ptr, "search" );
 
                } else if ( ACL_LVL_IS_READ(mask) ) {
-                       ptr = slap_strcopy( ptr, "read" );
+                       ptr = lutil_strcopy( ptr, "read" );
 
                } else if ( ACL_LVL_IS_WRITE(mask) ) {
-                       ptr = slap_strcopy( ptr, "write" );
+                       ptr = lutil_strcopy( ptr, "write" );
                } else {
-                       ptr = slap_strcopy( ptr, "unknown" );
+                       ptr = lutil_strcopy( ptr, "unknown" );
                }
                
                *ptr++ = '(';
@@ -1273,7 +1282,7 @@ acl_usage( void )
                        "\t[aci=<attrname>]\n"
 #endif
                        "\t[ssf=<n>] [transport_ssf=<n>] [tls_ssf=<n>] [sasl_ssf=<n>]\n"
-               "<dnstyle> ::= regex | base | exact (alias of base) | one | sub | children\n"
+               "<dnstyle> ::= regex | base | exact (alias of base) | one | subtree | children\n"
                "<style> ::= regex | base | exact (alias of base)\n"
                "<groupflags> ::= R\n"
                "<access> ::= [self]{<level>|<priv>}\n"