]> git.sur5r.net Git - openldap/commitdiff
handle trivial cases
authorPierangelo Masarati <ando@openldap.org>
Mon, 29 Apr 2002 19:14:42 +0000 (19:14 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 29 Apr 2002 19:14:42 +0000 (19:14 +0000)
servers/slapd/limits.c
servers/slapd/slap.h

index 01011a7250aeb9ce02ef2a83a89510d231c6505e..c33726e71190b011a143de2f8a8eb210618142a3 100644 (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;
+                       }
                }
        }
 
index ce76b301bc8e142dd3bfd719977ee99589c94c02..945c8407e6626eeadc3987797b136678abf52847 100644 (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 */
 
        /*