handle trivial cases

This commit is contained in:
Pierangelo Masarati 2002-04-29 19:14:42 +00:00
parent 5291b41336
commit 6b8828ed28
2 changed files with 21 additions and 1 deletions

View file

@ -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;
}
}
}

View file

@ -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 */
/*