Skip to content
Snippets Groups Projects
Commit 6b8828ed authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

handle trivial cases

parent 5291b413
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,10 @@ get_limits(
}
break;
case SLAP_LIMITS_ANY:
*limit = &lm[0]->lm_limits;
return( 0 );
default:
assert( 0 ); /* unreachable */
return( -1 );
......@@ -179,6 +183,7 @@ add_limits(
case SLAP_LIMITS_ANONYMOUS:
case SLAP_LIMITS_USERS:
case SLAP_LIMITS_ANY:
lm->lm_type = type;
lm->lm_dn_pat.bv_val = NULL;
lm->lm_dn_pat.bv_len = 0;
......@@ -264,7 +269,10 @@ parse_limits(
*/
pattern = argv[1];
if ( strcasecmp( pattern, "anonymous" ) == 0 ) {
if ( strcmp( pattern, "*" ) == 0) {
type = SLAP_LIMITS_ANY;
} else if ( strcasecmp( pattern, "anonymous" ) == 0 ) {
type = SLAP_LIMITS_ANONYMOUS;
} else if ( strcasecmp( pattern, "users" ) == 0 ) {
......@@ -342,6 +350,17 @@ parse_limits(
/* skip '=' (required) */
pattern++;
/* trim obvious cases */
if ( strcmp( pattern, "*" ) == 0 ) {
type = SLAP_LIMITS_ANY;
pattern = NULL;
} else if ( ( type == SLAP_LIMITS_REGEX || type == SLAP_LIMITS_UNDEFINED )
&& strcmp( pattern, ".*" ) == 0 ) {
type = SLAP_LIMITS_ANY;
pattern = NULL;
}
}
}
......
......@@ -1035,6 +1035,7 @@ struct slap_limits {
#define SLAP_LIMITS_REGEX 0x0005
#define SLAP_LIMITS_ANONYMOUS 0x0006
#define SLAP_LIMITS_USERS 0x0007
#define SLAP_LIMITS_ANY 0x0008
regex_t lm_dn_regex; /* regex data for REGEX */
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment