]> git.sur5r.net Git - openldap/commitdiff
improve error handling for attr val ACL syntax
authorPierangelo Masarati <ando@openldap.org>
Tue, 16 Dec 2003 10:56:21 +0000 (10:56 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 16 Dec 2003 10:56:21 +0000 (10:56 +0000)
servers/slapd/aclparse.c

index 73ab0db6349601796c7cf0f11aa27b58e7451abd..67081a149ff3d122280cea8f8029020f678803d6 100644 (file)
@@ -38,6 +38,9 @@
 #include "lber_pvt.h"
 #include "lutil.h"
 
+static char *style_strings[] = { "regex",
+       "base", "one", "subtree", "children", NULL };
+
 static void            split(char *line, int splitchar, char **left, char **right);
 static void            access_append(Access **l, Access *a);
 static void            acl_usage(void) LDAP_GCCATTR((noreturn));
@@ -280,30 +283,34 @@ parse_acl(
                                                a->acl_attrval_style = ACL_STYLE_REGEX;
                                        } else {
                                                /* FIXME: if the attribute has DN syntax,
-                                                * we might allow subtree and children styles as well */
+                                                * we might allow one, subtree and children styles as well */
                                                if ( !strcasecmp( style, "exact" ) ) {
                                                        a->acl_attrval_style = ACL_STYLE_BASE;
 
                                                } else if ( a->acl_attrs[0].an_desc->ad_type->sat_syntax == slap_schema.si_syn_distinguishedName ) {
                                                        if ( !strcasecmp( style, "base" ) ) {
                                                                a->acl_attrval_style = ACL_STYLE_BASE;
-                                                       } else if ( !strcasecmp( style, "children" ) ) {
-                                                               a->acl_attrval_style = ACL_STYLE_CHILDREN;
                                                        } else if ( !strcasecmp( style, "onelevel" ) || !strcasecmp( style, "one" ) ) {
                                                                a->acl_attrval_style = ACL_STYLE_ONE;
                                                        } else if ( !strcasecmp( style, "subtree" ) || !strcasecmp( style, "sub" ) ) {
                                                                a->acl_attrval_style = ACL_STYLE_SUBTREE;
+                                                       } else if ( !strcasecmp( style, "children" ) ) {
+                                                               a->acl_attrval_style = ACL_STYLE_CHILDREN;
                                                        } else {
                                                                fprintf( stderr, 
-                                                                       "%s: line %d: unknown val.<style>, got \"%s\" (ignored)\n",
-                                                                           fname, lineno, style );
+                                                                       "%s: line %d: unknown val.<style> \"%s\" "
+                                                                       "for attributeType \"%s\" with DN syntax; using \"base\"\n",
+                                                                       fname, lineno, style,
+                                                                       a->acl_attrs[0].an_desc->ad_cname.bv_val );
                                                                a->acl_attrval_style = ACL_STYLE_BASE;
                                                        }
                                                        
                                                } else {
                                                        fprintf( stderr, 
-                                                               "%s: line %d: unknown val.<style>, got \"%s\" (ignored)\n",
-                                                                   fname, lineno, style );
+                                                               "%s: line %d: unknown val.<style> \"%s\" "
+                                                               "for attributeType \"%s\"; using \"exact\"\n",
+                                                               fname, lineno, style,
+                                                               a->acl_attrs[0].an_desc->ad_cname.bv_val );
                                                        a->acl_attrval_style = ACL_STYLE_BASE;
                                                }
                                        }
@@ -1591,9 +1598,6 @@ str2access( const char *str )
 
 #ifdef LDAP_DEBUG
 
-static char *style_strings[5] = { "regex",
-       "base", "one", "subtree", "children" };
-
 static void
 print_access( Access *b )
 {