]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/filter.c
unifdef -DLDAP_NOCACHE
[openldap] / libraries / libldap / filter.c
index 7d40d1ceb472588ee886da4c89df09f19c7a18b5..912bf20c28f9710f3440348fb0c2a8de32f6cc87 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*  Portions
@@ -335,7 +335,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
         *              lessOrEqual     [6]     AttributeValueAssertion,
         *              present         [7]     AttributeType,
         *              approxMatch     [8]     AttributeValueAssertion,
-        *                              extensibleMatch [9]             MatchingRuleAssertion -- LDAPv3
+        *              extensibleMatch [9]     MatchingRuleAssertion -- LDAPv3
         *      }
         *
         *      SubstringFilter ::= SEQUENCE {
@@ -347,18 +347,17 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
         *              }
         *      }
         *
-        *              MatchingRuleAssertion ::= SEQUENCE {    -- LDAPv3
-        *                      matchingRule    [1] MatchingRuleId OPTIONAL,
-        *                      type            [2] AttributeDescription OPTIONAL,
-        *                      matchValue      [3] AssertionValue,
-        *                      dnAttributes    [4] BOOLEAN DEFAULT FALSE }
+        *      MatchingRuleAssertion ::= SEQUENCE {    -- LDAPv3
+        *              matchingRule    [1] MatchingRuleId OPTIONAL,
+        *              type            [2] AttributeDescription OPTIONAL,
+        *              matchValue      [3] AssertionValue,
+        *              dnAttributes    [4] BOOLEAN DEFAULT FALSE }
         *
         * Note: tags in a choice are always explicit
         */
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, "ldap_pvt_put_filter: \"%s\"\n",
-               str_in ));
+       LDAP_LOG ( FILTER, ARGS, "ldap_pvt_put_filter: \"%s\"\n", str_in,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_filter: \"%s\"\n", str_in, 0, 0 );
 #endif
@@ -380,8 +379,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
                        switch ( *str ) {
                        case '&':
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: AND\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: AND\n", 0,0,0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: AND\n",
                                    0, 0, 0 );
@@ -399,8 +397,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                        case '|':
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: OR\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: OR\n", 0,0,0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: OR\n",
                                    0, 0, 0 );
@@ -418,8 +415,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                        case '!':
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: NOT\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: NOT\n", 0,0,0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: NOT\n",
                                    0, 0, 0 );
@@ -437,8 +433,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                        default:
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: simple\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: simple\n", 0,0,0);
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: simple\n",
                                    0, 0, 0 );
@@ -488,8 +483,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                case /*'('*/ ')':
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                               "ldap_pvt_put_filter: end\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: end\n", 0,0,0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "put_filter: end\n",
                                0, 0, 0 );
@@ -508,8 +502,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                default:        /* assume it's a simple type=value filter */
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                               "ldap_pvt_put_filter: default\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: default\n", 0,0,0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "put_filter: default\n",
                                0, 0, 0 );
@@ -542,8 +535,7 @@ put_filter_list( BerElement *ber, char *str, ber_tag_t tag )
        char    save;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-                               "put_filter_list \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_filter_list \"%s\"\n", str,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_filter_list \"%s\"\n",
                str, 0, 0 );
@@ -587,8 +579,7 @@ put_simple_filter(
        int             rc = -1;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-                               "put_simple_filter: \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_simple_filter: \"%s\"\n", str,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_simple_filter: \"%s\"\n",
                str, 0, 0 );
@@ -759,8 +750,7 @@ put_substring_filter( BerElement *ber, char *type, char *val )
        ber_tag_t       ftype = LDAP_FILTER_SUBSTRINGS;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-                               "put_substring_filter \"%s=%s\"\n", type, val ));
+       LDAP_LOG ( FILTER, ARGS, "put_substring_filter \"%s=%s\"\n", type, val, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_substring_filter \"%s=%s\"\n",
                type, val, 0 );
@@ -808,8 +798,8 @@ put_substring_filter( BerElement *ber, char *type, char *val )
        return 0;
 }
 
-int
-ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in )
+static int
+put_vrFilter( BerElement *ber, const char *str_in )
 {
        int rc;
        char    *freeme;
@@ -847,8 +837,7 @@ ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in )
         */
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, "ldap_pvt_put_vrFilter: \"%s\"\n",
-               str_in ));
+       LDAP_LOG ( FILTER, ARGS, "put_vrFilter: \"%s\"\n", str_in, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_vrFilter: \"%s\"\n", str_in, 0, 0 );
 #endif
@@ -892,8 +881,8 @@ ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in )
 
                        default:
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_vrFilter: simple\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, 
+                                       "put_vrFilter: simple\n", 0, 0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_vrFilter: simple\n",
                                    0, 0, 0 );
@@ -943,10 +932,9 @@ ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in )
 
                case /*'('*/ ')':
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                               "ldap_pvt_put_filter: end\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "put_vrFilter: end\n", 0, 0, 0 );
 #else
-                       Debug( LDAP_DEBUG_TRACE, "put_filter: end\n",
+                       Debug( LDAP_DEBUG_TRACE, "put_vrFilter: end\n",
                                0, 0, 0 );
 #endif
                        if ( ber_printf( ber, /*"["*/ "]" ) == -1 ) {
@@ -963,10 +951,10 @@ ldap_pvt_put_vrFilter( BerElement *ber, const char *str_in )
 
                default:        /* assume it's a simple type=value filter */
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1
-                               "ldap_pvt_put_filter: default\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "put_vrFilter: default\n"
+                               0, 0, 0 );
 #else
-                       Debug( LDAP_DEBUG_TRACE, "put_filter: default\n",
+                       Debug( LDAP_DEBUG_TRACE, "put_vrFilter: default\n",
                                0, 0, 0 );
 #endif
                        next = strchr( str, '\0' );
@@ -987,7 +975,7 @@ done:
 }
 
 int
-put_vrFilter( BerElement *ber, const char *str_in )
+ldap_put_vrFilter( BerElement *ber, const char *str_in )
 {
        int rc =0;
        
@@ -995,7 +983,7 @@ put_vrFilter( BerElement *ber, const char *str_in )
                rc = -1;
        }
        
-       rc = ldap_pvt_put_vrFilter( ber, str_in );
+       rc = put_vrFilter( ber, str_in );
 
        if ( ber_printf( ber, /*"{"*/ "N}" ) == -1 ) {
                rc = -1;
@@ -1011,8 +999,7 @@ put_vrFilter_list( BerElement *ber, char *str )
        char    save;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-               "put_vrFilter_list \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_vrFilter_list \"%s\"\n", str, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_vrFilter_list \"%s\"\n",
                str, 0, 0 );
@@ -1031,7 +1018,7 @@ put_vrFilter_list( BerElement *ber, char *str )
 
                /* now we have "(filter)" with str pointing to it */
                *next = '\0';
-               if ( ldap_pvt_put_vrFilter( ber, str ) == -1 ) return -1;
+               if ( put_vrFilter( ber, str ) == -1 ) return -1;
                *next = save;
                str = next;
        }
@@ -1050,8 +1037,7 @@ put_simple_vrFilter(
        int             rc = -1;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-               "put_simple_vrFilter: \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_simple_vrFilter: \"%s\"\n", str, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_simple_vrFilter: \"%s\"\n",
                str, 0, 0 );