From 6b8828ed28142c310661b5148f60962d79400bb7 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 29 Apr 2002 19:14:42 +0000 Subject: [PATCH] handle trivial cases --- servers/slapd/limits.c | 21 ++++++++++++++++++++- servers/slapd/slap.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index 01011a7250..c33726e711 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -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; + } } } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index ce76b301bc..945c8407e6 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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 */ /* -- 2.39.5