mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-03 20:40:05 -05:00
Always compile acl_dn_pat when it is set, otherwise acl.c breaks
This commit is contained in:
parent
1b0aa8cf23
commit
1a16766b3c
1 changed files with 18 additions and 13 deletions
|
|
@ -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 ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue