From 1a16766b3cb01ac6e9493941703905e930193803 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Sun, 22 Aug 1999 03:30:45 +0000 Subject: [PATCH] Always compile acl_dn_pat when it is set, otherwise acl.c breaks --- servers/slapd/aclparse.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index a2d585a7c7..99e97605d6 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -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 ) { -- 2.39.5