]> git.sur5r.net Git - openldap/commitdiff
Always compile acl_dn_pat when it is set, otherwise acl.c breaks
authorHallvard Furuseth <hallvard@openldap.org>
Sun, 22 Aug 1999 03:30:45 +0000 (03:30 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Sun, 22 Aug 1999 03:30:45 +0000 (03:30 +0000)
servers/slapd/aclparse.c

index a2d585a7c749684cae6c3b54f50aee48a2853193..99e97605d6300b86fa32bf937027a215810408e9 100644 (file)
@@ -106,6 +106,11 @@ parse_acl(
                                acl_usage();
                        }
                        a = (AccessControl *) ch_calloc( 1, sizeof(AccessControl) );
+                       a->acl_filter = NULL;
+                       a->acl_dn_pat = NULL;
+                       a->acl_attrs  = NULL;
+                       a->acl_access = NULL;
+                       a->acl_next   = NULL;
                        for ( ++i; i < argc; i++ ) {
                                if ( strcasecmp( argv[i], "by" ) == 0 ) {
                                        i--;
@@ -135,20 +140,7 @@ parse_acl(
                                        }
 
                                } else if ( strcasecmp( left, "dn" ) == 0 ) {
-                                       int e;
-
-                                       if ((e = regcomp(&a->acl_dn_re, right,
-                                               REG_EXTENDED|REG_ICASE))) {
-                                               char buf[512];
-                                               regerror(e, &a->acl_dn_re, buf, sizeof(buf));
-                                               fprintf( stderr,
-                               "%s: line %d: regular expression \"%s\" bad because of %s\n",
-                                                       fname, lineno, right, buf );
-                                               acl_usage();
-
-                                       } else {
                                                a->acl_dn_pat = ch_strdup( right );
-                                       }
 
                                } else if ( strncasecmp( left, "attr", 4 ) == 0 ) {
                                        char    **alist;
@@ -165,6 +157,19 @@ parse_acl(
                                }
                        }
 
+                       if ( a->acl_dn_pat != NULL ) {
+                               int e = regcomp( &a->acl_dn_re, a->acl_dn_pat,
+                                                REG_EXTENDED | REG_ICASE );
+                               if ( e ) {
+                                       char buf[512];
+                                       regerror( e, &a->acl_dn_re, buf, sizeof(buf) );
+                                       fprintf( stderr,
+                               "%s: line %d: regular expression \"%s\" bad because of %s\n",
+                                                fname, lineno, right, buf );
+                                       acl_usage();
+                               }
+                       }
+
                /* by clause - select who has what access to entries */
                } else if ( strcasecmp( argv[i], "by" ) == 0 ) {
                        if ( a == NULL ) {