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--;
}
} 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;
}
}
+ 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 ) {