}
#endif /* SLAP_DYNACL */
-static void
+static int
regtest(const char *fname, int lineno, char *pat) {
int e;
regex_t re;
"%s: line %d: regular expression \"%s\" too large\n",
fname, lineno, pat );
(void)acl_usage();
- exit( EXIT_FAILURE );
+ return -1;
}
if ((e = regcomp(&re, buf, REG_EXTENDED|REG_ICASE))) {
"%s: line %d: regular expression \"%s\" bad because of %s\n",
fname, lineno, pat, error );
acl_usage();
- exit( EXIT_FAILURE );
+ regfree(&re);
+ return -1;
}
regfree(&re);
+ return 0;
}
/*
} else {
acl_regex_normalized_dn( right, &bv );
if ( !ber_bvccmp( &bv, '*' ) ) {
- regtest( fname, lineno, bv.bv_val );
+ if ( regtest( fname, lineno, bv.bv_val ) != 0)
+ goto fail;
}
}
if ( sty == ACL_STYLE_EXPAND ) {
acl_regex_normalized_dn( right, &bv );
if ( !ber_bvccmp( &bv, '*' ) ) {
- regtest( fname, lineno, bv.bv_val );
+ if ( regtest( fname, lineno, bv.bv_val ) != 0)
+ goto fail;
}
b->a_group_pat = bv;
if ( sty == ACL_STYLE_REGEX ) {
acl_regex_normalized_dn( right, &bv );
if ( !ber_bvccmp( &bv, '*' ) ) {
- regtest( fname, lineno, bv.bv_val );
+ if ( regtest( fname, lineno, bv.bv_val ) != 0)
+ goto fail;
}
b->a_peername_pat = bv;
if ( sty == ACL_STYLE_REGEX ) {
acl_regex_normalized_dn( right, &bv );
if ( !ber_bvccmp( &bv, '*' ) ) {
- regtest( fname, lineno, bv.bv_val );
+ if ( regtest( fname, lineno, bv.bv_val ) != 0)
+ goto fail;
}
b->a_sockname_pat = bv;
if ( sty == ACL_STYLE_REGEX ) {
acl_regex_normalized_dn( right, &bv );
if ( !ber_bvccmp( &bv, '*' ) ) {
- regtest( fname, lineno, bv.bv_val );
+ if ( regtest( fname, lineno, bv.bv_val ) != 0)
+ goto fail;
}
b->a_domain_pat = bv;
if ( sty == ACL_STYLE_REGEX ) {
acl_regex_normalized_dn( right, &bv );
if ( !ber_bvccmp( &bv, '*' ) ) {
- regtest( fname, lineno, bv.bv_val );
+ if ( regtest( fname, lineno, bv.bv_val ) != 0)
+ goto fail;
}
b->a_sockurl_pat = bv;
/*
* Set pattern to a "normalized" DN from src.
- * At present it simply eats the (optional) space after
+ * At present, it simply eats the (optional) space after
* a RDN separator (,)
* Eventually will evolve in a more complete normalization
*/