]> git.sur5r.net Git - openldap/commitdiff
Changed ma_rule_text to struct berval.
authorHoward Chu <hyc@openldap.org>
Wed, 26 Dec 2001 13:47:10 +0000 (13:47 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 26 Dec 2001 13:47:10 +0000 (13:47 +0000)
Changed get_filter to struct bervals

servers/slapd/aclparse.c
servers/slapd/filter.c
servers/slapd/mra.c
servers/slapd/proto-slap.h
servers/slapd/search.c
servers/slapd/slap.h

index 84054905901b211dabb657993414b21e092a2402..5a28ebfd749d5f0e1759ee02390f412c1b5b0f21 100644 (file)
@@ -172,16 +172,16 @@ parse_acl(
                                                }
                                        } else if ( strcasecmp( style, "base" ) == 0 ) {
                                                a->acl_dn_style = ACL_STYLE_BASE;
-                                               ber_str2bv( right, 1, &a->acl_dn_pat );
+                                               ber_str2bv( right, 0, 1, &a->acl_dn_pat );
                                        } else if ( strcasecmp( style, "one" ) == 0 ) {
                                                a->acl_dn_style = ACL_STYLE_ONE;
-                                               ber_str2bv( right, 1, &a->acl_dn_pat );
+                                               ber_str2bv( right, 0, 1, &a->acl_dn_pat );
                                        } else if ( strcasecmp( style, "subtree" ) == 0 ) {
                                                a->acl_dn_style = ACL_STYLE_SUBTREE;
-                                               ber_str2bv( right, 1, &a->acl_dn_pat );
+                                               ber_str2bv( right, 0, 1, &a->acl_dn_pat );
                                        } else if ( strcasecmp( style, "children" ) == 0 ) {
                                                a->acl_dn_style = ACL_STYLE_CHILDREN;
-                                               ber_str2bv( right, 1, &a->acl_dn_pat );
+                                               ber_str2bv( right, 0, 1, &a->acl_dn_pat );
                                        } else {
                                                fprintf( stderr,
        "%s: line %d: unknown dn style \"%s\" in to clause\n",
@@ -296,36 +296,39 @@ parse_acl(
                                        bv.bv_len = 1;
 
                                } else if ( strcasecmp( argv[i], "anonymous" ) == 0 ) {
-                                       bv.bv_val = ch_strdup( "anonymous" );
-                                       bv.bv_len = sizeof("anonymous")-1;
+                                       ber_str2bv("anonymous",
+                                               sizeof("anonymous")-1,
+                                               1, &bv);
 
                                } else if ( strcasecmp( argv[i], "self" ) == 0 ) {
-                                       bv.bv_val = ch_strdup( "self" );
-                                       bv.bv_len = sizeof("self")-1;
+                                       ber_str2bv("self",
+                                               sizeof("self")-1,
+                                               1, &bv);
 
                                } else if ( strcasecmp( argv[i], "users" ) == 0 ) {
-                                       bv.bv_val = ch_strdup( "users" );
-                                       bv.bv_len = sizeof("users")-1;
+                                       ber_str2bv("users",
+                                               sizeof("users")-1,
+                                               1, &bv);
 
                                } else if ( strcasecmp( left, "dn" ) == 0 ) {
                                        if ( sty == ACL_STYLE_REGEX ) {
                                                b->a_dn_style = ACL_STYLE_REGEX;
                                                if( right == NULL ) {
                                                        /* no '=' */
-                                                       bv.bv_val = ch_strdup( "users" );
-                                                       bv.bv_len = sizeof("users")-1;
-
+                                                       ber_str2bv("users",
+                                                               sizeof("users")-1,
+                                                               1, &bv);
                                                } else if (*right == '\0' ) {
                                                        /* dn="" */
-                                                       bv.bv_val = ch_strdup( "anonymous" );
-                                                       bv.bv_len = sizeof("anonymous")-1;
-
+                                                       ber_str2bv("anonymous",
+                                                               sizeof("anonymous")-1,
+                                                               1, &bv);
                                                } else if ( strcmp( right, "*" ) == 0 ) {
                                                        /* dn=* */
                                                        /* any or users?  users for now */
-                                                       bv.bv_val = ch_strdup( "users" );
-                                                       bv.bv_len = sizeof("users")-1;
-
+                                                       ber_str2bv("users",
+                                                               sizeof("users")-1,
+                                                               1, &bv);
                                                } else if ( strcmp( right, ".+" ) == 0
                                                        || strcmp( right, "^.+" ) == 0
                                                        || strcmp( right, ".+$" ) == 0
@@ -333,9 +336,9 @@ parse_acl(
                                                        || strcmp( right, ".+$$" ) == 0
                                                        || strcmp( right, "^.+$$" ) == 0 )
                                                {
-                                                       bv.bv_val = ch_strdup( "users" );
-                                                       bv.bv_len = sizeof("users")-1;
-
+                                                       ber_str2bv("users",
+                                                               sizeof("users")-1,
+                                                               1, &bv);
                                                } else if ( strcmp( right, ".*" ) == 0
                                                        || strcmp( right, "^.*" ) == 0
                                                        || strcmp( right, ".*$" ) == 0
@@ -343,8 +346,9 @@ parse_acl(
                                                        || strcmp( right, ".*$$" ) == 0
                                                        || strcmp( right, "^.*$$" ) == 0 )
                                                {
-                                                       bv.bv_val = ch_strdup( "*" );
-                                                       bv.bv_len = 1;
+                                                       ber_str2bv("*",
+                                                               sizeof("*")-1,
+                                                               1, &bv);
 
                                                } else {
                                                        bv.bv_val = right;
@@ -358,7 +362,7 @@ parse_acl(
                                                acl_usage();
 
                                        } else {
-                                               ber_str2bv( right, 1, &bv );
+                                               ber_str2bv( right, 0, 1, &bv );
                                        }
 
                                } else {
@@ -470,7 +474,7 @@ parse_acl(
                                                b->a_group_pat = bv;
                                        } else {
                                                struct berval *ndn = NULL;
-                                               ber_str2bv( right, 0, &bv );
+                                               ber_str2bv( right, 0, 0, &bv );
                                                dnNormalize( NULL, &bv, &ndn );
                                                b->a_group_pat = *ndn;
                                                free(ndn);
@@ -702,7 +706,7 @@ parse_acl(
                                        }
 
                                        b->a_set_style = sty;
-                                       ber_str2bv( right, 1, &b->a_set_pat );
+                                       ber_str2bv( right, 0, 1, &b->a_set_pat );
 
                                        continue;
                                }
index 6c16a68046c464d151b886fdab3f6dd773b6a7e5..0bf9089f8b3462413f5b830dc6acc3a139a23a43 100644 (file)
@@ -18,14 +18,14 @@ static int  get_filter_list(
        Connection *conn,
        BerElement *ber,
        Filter **f,
-       char **fstr,
+       struct berval *fstr,
        const char **text );
 
 static int     get_substring_filter(
        Connection *conn,
        BerElement *ber,
        Filter *f,
-       char **fstr,
+       struct berval *fstr,
        const char **text );
 
 static int filter_escape_value(
@@ -37,14 +37,14 @@ get_filter(
        Connection *conn,
        BerElement *ber,
        Filter **filt,
-       char **fstr,
+       struct berval *fstr,
        const char **text )
 {
        ber_tag_t       tag;
        ber_len_t       len;
        int             err;
        Filter          *f;
-       char            *ftmp = NULL;
+       struct berval   ftmp = { 0, NULL };
        struct berval escaped;
 
 #ifdef NEW_LOGGING
@@ -97,7 +97,7 @@ get_filter(
        f->f_next = NULL;
 
        err = LDAP_SUCCESS;
-       *fstr = NULL;
+       *fstr = ftmp;
        f->f_choice = tag; 
 
        switch ( f->f_choice ) {
@@ -117,11 +117,13 @@ get_filter(
 
                filter_escape_value( f->f_av_value, &escaped );
 
-               *fstr = ch_malloc( sizeof("(=)")
+               fstr->bv_len = sizeof("(=)")-1
                        + f->f_av_desc->ad_cname.bv_len
-                       + escaped.bv_len );
+                       + escaped.bv_len;
 
-               sprintf( *fstr, "(%s=%s)",
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
+
+               sprintf( fstr->bv_val, "(%s=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                    escaped.bv_val );
 
@@ -152,11 +154,13 @@ get_filter(
 
                filter_escape_value( f->f_av_value, &escaped );
 
-               *fstr = ch_malloc( sizeof("(>=)")
+               fstr->bv_len = sizeof("(>=)")-1
                        + f->f_av_desc->ad_cname.bv_len
-                       + escaped.bv_len );
+                       + escaped.bv_len;
+
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
 
-               sprintf( *fstr, "(%s>=%s)",
+               sprintf( fstr->bv_val, "(%s>=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                    escaped.bv_val );
 
@@ -178,11 +182,13 @@ get_filter(
 
                filter_escape_value( f->f_av_value, &escaped );
 
-               *fstr = ch_malloc( sizeof("(<=)")
+               fstr->bv_len = sizeof("(<=)")-1
                        + f->f_av_desc->ad_cname.bv_len
-                       + escaped.bv_len );
+                       + escaped.bv_len;
+
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
 
-               sprintf( *fstr, "(%s<=%s)",
+               sprintf( fstr->bv_val, "(%s<=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                    escaped.bv_val );
 
@@ -211,7 +217,8 @@ get_filter(
                        /* unrecognized attribute description or other error */
                        f->f_choice = SLAPD_FILTER_COMPUTED;
                        f->f_result = LDAP_COMPARE_FALSE;
-                       *fstr = ch_strdup( "(unrecogized=*)" );
+                       ber_str2bv("(unrecognized=*)",
+                               sizeof("(unrecognized=*)")-1, 1, fstr);
                        ch_free( type.bv_val );
                        err = LDAP_SUCCESS;
                        break;
@@ -219,9 +226,10 @@ get_filter(
 
                ch_free( type.bv_val );
 
-               *fstr = ch_malloc( sizeof("(=*)")
-                       + f->f_desc->ad_cname.bv_len );
-               sprintf( *fstr, "(%s=*)",
+               fstr->bv_len = sizeof("(=*)") - 1 
+                       + f->f_desc->ad_cname.bv_len;
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1);
+               sprintf( fstr->bv_val, "(%s=*)",
                        f->f_desc->ad_cname.bv_val );
 
                } break;
@@ -240,11 +248,12 @@ get_filter(
 
                filter_escape_value( f->f_av_value, &escaped );
 
-               *fstr = ch_malloc( sizeof("(~=)")
+               fstr->bv_len = sizeof("(~=)") - 1
                        + f->f_av_desc->ad_cname.bv_len
-                       + escaped.bv_len );
+                       + escaped.bv_len;
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1);
 
-               sprintf( *fstr, "(%s~=%s)",
+               sprintf( fstr->bv_val, "(%s~=%s)",
                        f->f_av_desc->ad_cname.bv_val,
                    escaped.bv_val );
 
@@ -262,10 +271,10 @@ get_filter(
                if ( err != LDAP_SUCCESS ) {
                        break;
                }
-               *fstr = ch_malloc( sizeof("(&)")
-                       + ( ftmp == NULL ? 0 : strlen( ftmp ) ) );
-               sprintf( *fstr, "(&%s)",
-                       ftmp == NULL ? "" : ftmp );
+               fstr->bv_len = sizeof("(&)") - 1 + ftmp.bv_len;
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
+               sprintf( fstr->bv_val, "(&%s)",
+                       ftmp.bv_len ? ftmp.bv_val : "" );
                break;
 
        case LDAP_FILTER_OR:
@@ -279,10 +288,10 @@ get_filter(
                if ( err != LDAP_SUCCESS ) {
                        break;
                }
-               *fstr = ch_malloc( sizeof("(!)")
-                       + ( ftmp == NULL ? 0 : strlen( ftmp ) ) );
-               sprintf( *fstr, "(|%s)",
-                       ftmp == NULL ? "" : ftmp );
+               fstr->bv_len = sizeof("(|)") - 1 + ftmp.bv_len;
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
+               sprintf( fstr->bv_val, "(|%s)",
+                       ftmp.bv_len ? ftmp.bv_val : "" );
                break;
 
        case LDAP_FILTER_NOT:
@@ -297,10 +306,10 @@ get_filter(
                if ( err != LDAP_SUCCESS ) {
                        break;
                }
-               *fstr = ch_malloc( sizeof("(!)")
-                       + ( ftmp == NULL ? 0 : strlen( ftmp ) ) );
-               sprintf( *fstr, "(!%s)",
-                       ftmp == NULL ? "" : ftmp );
+               fstr->bv_len = sizeof("(!)") - 1 + ftmp.bv_len;
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
+               sprintf( fstr->bv_val, "(!%s)",
+                       ftmp.bv_len ? ftmp.bv_val : "" );
                break;
 
        case LDAP_FILTER_EXT:
@@ -320,16 +329,17 @@ get_filter(
 
                filter_escape_value( f->f_mr_value, &escaped );
 
-               *fstr = ch_malloc( sizeof("(:dn::=)")
+               fstr->bv_len = sizeof("(:dn::=)") - 1
                        + (f->f_mr_desc ? f->f_mr_desc->ad_cname.bv_len : 0)
-                       + (f->f_mr_rule_text ? strlen(f->f_mr_rule_text) : 0)
-                       + escaped.bv_len );
+                       + f->f_mr_rule_text.bv_len
+                       + escaped.bv_len;
 
-               sprintf( *fstr, "(%s%s%s%s:=%s)",
+               fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
+               sprintf( fstr->bv_val, "(%s%s%s%s:=%s)",
                         (f->f_mr_desc ? f->f_mr_desc->ad_cname.bv_val : ""),
                         (f->f_mr_dnattrs ? ":dn" : ""),
-                        (f->f_mr_rule_text ? ":" : ""),
-                        (f->f_mr_rule_text ? f->f_mr_rule_text : ""),
+                        (f->f_mr_rule_text.bv_len ? ":" : ""),
+                        (f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_val : ""),
                         escaped.bv_val );
 
                ber_memfree( escaped.bv_val );
@@ -347,22 +357,24 @@ get_filter(
 #endif
                f->f_choice = SLAPD_FILTER_COMPUTED;
                f->f_result = SLAPD_COMPARE_UNDEFINED;
-               *fstr = ch_strdup( "(undefined)" );
+               ber_str2bv( "(undefined)", sizeof("(undefined)") - 1,
+                       1, fstr );
                break;
        }
 
-       free( ftmp );
+       free( ftmp.bv_val );
 
        if ( err != LDAP_SUCCESS ) {
-               if ( *fstr != NULL ) {
-                       free( *fstr );
+               if ( fstr->bv_val != NULL ) {
+                       free( fstr->bv_val );
                }
 
                if( err != SLAPD_DISCONNECT ) {
                        /* ignore error */
                        f->f_choice = SLAPD_FILTER_COMPUTED;
                        f->f_result = SLAPD_COMPARE_UNDEFINED;
-                       *fstr = ch_strdup( "(badfilter)" );
+                       ber_str2bv( "(badfilter)", sizeof("(badfilter)") - 1,
+                               1, fstr );
                        err = LDAP_SUCCESS;
                        *filt = f;
 
@@ -384,14 +396,15 @@ get_filter(
 
 static int
 get_filter_list( Connection *conn, BerElement *ber,
-       Filter **f, char **fstr,
+       Filter **f, struct berval *fstr,
        const char **text )
 {
        Filter          **new;
        int             err;
        ber_tag_t       tag;
        ber_len_t       len;
-       char            *last, *ftmp;
+       char            *last;
+       struct berval   ftmp;
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "filter", LDAP_LEVEL_ENTRY,
@@ -399,7 +412,6 @@ get_filter_list( Connection *conn, BerElement *ber,
 #else
        Debug( LDAP_DEBUG_FILTER, "begin get_filter_list\n", 0, 0, 0 );
 #endif
-       *fstr = NULL;
        new = f;
        for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
            tag = ber_next_element( ber, &len, last ) )
@@ -408,13 +420,15 @@ get_filter_list( Connection *conn, BerElement *ber,
                if ( err != LDAP_SUCCESS )
                        return( err );
 
-               if ( *fstr == NULL ) {
+               if ( !fstr->bv_len ) {
                        *fstr = ftmp;
                } else {
-                       *fstr = ch_realloc( *fstr, strlen( *fstr ) +
-                           strlen( ftmp ) + 1 );
-                       strcat( *fstr, ftmp );
-                       free( ftmp );
+                       int i = fstr->bv_len;
+                       fstr->bv_len += ftmp.bv_len;
+                       fstr->bv_val = ch_realloc( fstr->bv_val,
+                               fstr->bv_len + 1 );
+                       strcpy( fstr->bv_val+i, ftmp.bv_val );
+                       free( ftmp.bv_val );
                }
                new = &(*new)->f_next;
        }
@@ -434,7 +448,7 @@ get_substring_filter(
     Connection *conn,
     BerElement *ber,
     Filter     *f,
-    char       **fstr,
+    struct berval      *fstr,
        const char      **text
 )
 {
@@ -469,7 +483,7 @@ get_substring_filter(
                ch_free( f->f_sub );
                f->f_choice = SLAPD_FILTER_COMPUTED;
                f->f_result = SLAPD_COMPARE_UNDEFINED;
-               *fstr = ch_strdup( "(undefined)" );
+               ber_str2bv( "(undefined)", sizeof("(undefined)")-1, 1, fstr );
                return LDAP_SUCCESS;
        }
 
@@ -477,11 +491,10 @@ get_substring_filter(
        f->f_sub_any = NULL;
        f->f_sub_final = NULL;
 
-       if( fstr ) {
-               *fstr = ch_malloc( sizeof("(=" /*)*/) +
-                       f->f_sub_desc->ad_cname.bv_len );
-               sprintf( *fstr, "(%s=" /*)*/, f->f_sub_desc->ad_cname.bv_val );
-       }
+       fstr->bv_len = sizeof("(=" /*)*/) - 1 +
+               f->f_sub_desc->ad_cname.bv_len;
+       fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
+       sprintf( fstr->bv_val, "(%s=" /*)*/, f->f_sub_desc->ad_cname.bv_val );
 
        for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
            tag = ber_next_element( ber, &len, last ) )
@@ -560,11 +573,13 @@ get_substring_filter(
 
                        f->f_sub_initial = value;
 
-                       if( fstr ) {
+                       if( fstr->bv_val ) {
+                               int i = fstr->bv_len;
                                filter_escape_value( value, &escaped );
-                               *fstr = ch_realloc( *fstr,
-                                       strlen( *fstr ) + escaped.bv_len + 1 );
-                               strcat( *fstr, escaped.bv_val );
+                               fstr->bv_len += escaped.bv_len;
+                               fstr->bv_val = ch_realloc( fstr->bv_val,
+                                       fstr->bv_len + 1 );
+                               strcpy( fstr->bv_val+i, escaped.bv_val );
                                ber_memfree( escaped.bv_val );
                        }
                        break;
@@ -588,12 +603,14 @@ get_substring_filter(
                                goto return_error;
                        }
 
-                       if( fstr ) {
+                       if( fstr->bv_val ) {
+                               int i = fstr->bv_len;
                                filter_escape_value( value, &escaped );
-                               *fstr = ch_realloc( *fstr,
-                                       strlen( *fstr ) + escaped.bv_len + 2 );
-                               strcat( *fstr, "*" );
-                               strcat( *fstr, escaped.bv_val );
+                               fstr->bv_len += escaped.bv_len + 2;
+                               fstr->bv_val = ch_realloc( fstr->bv_val,
+                                       fstr->bv_len + 1 );
+                               strcpy( fstr->bv_val+i, "*" );
+                               strcpy( fstr->bv_val+i+1, escaped.bv_val );
                                ber_memfree( escaped.bv_val );
                        }
                        break;
@@ -614,12 +631,14 @@ get_substring_filter(
 
                        f->f_sub_final = value;
 
-                       if( fstr ) {
+                       if( fstr->bv_val ) {
+                               int i = fstr->bv_len;
                                filter_escape_value( value, &escaped );
-                               *fstr = ch_realloc( *fstr,
-                                       strlen( *fstr ) + escaped.bv_len + 2 );
-                               strcat( *fstr, "*" );
-                               strcat( *fstr, escaped.bv_val );
+                               fstr->bv_len += escaped.bv_len + 2;
+                               fstr->bv_val = ch_realloc( fstr->bv_val,
+                                       fstr->bv_len + 1 );
+                               strcpy( fstr->bv_val+i, "*" );
+                               strcpy( fstr->bv_val+i+1, escaped.bv_val );
                                ber_memfree( escaped.bv_val );
                        }
                        break;
@@ -646,9 +665,10 @@ return_error:
                        Debug( LDAP_DEBUG_FILTER, "  error=%ld\n",
                                (long) rc, 0, 0 );
 #endif
-                       if( fstr ) {
-                               free( *fstr );
-                               *fstr = NULL;
+                       if( fstr->bv_val ) {
+                               free( fstr->bv_val );
+                               fstr->bv_val = NULL;
+                               fstr->bv_len = 0;
                        }
 
                        ber_bvfree( f->f_sub_initial );
@@ -659,12 +679,15 @@ return_error:
                }
        }
 
-       if( fstr ) {
-               *fstr = ch_realloc( *fstr, strlen( *fstr ) + 3 );
+       if( fstr->bv_val ) {
+               int i = fstr->bv_len;
+               fstr->bv_len += 3;
+               fstr->bv_val = ch_realloc( fstr->bv_val, fstr->bv_len + 3 );
                if ( f->f_sub_final == NULL ) {
-                       strcat( *fstr, "*" );
+                       strcpy( fstr->bv_val+i, "*" );
+                       i++;
                }
-               strcat( *fstr, /*(*/ ")" );
+               strcpy( fstr->bv_val+i, /*(*/ ")" );
        }
 
 #ifdef NEW_LOGGING
index e62bddf059bb80527238769a901b665692cbcaa0..0b40979b91bf5c573793c021953e2a7f2d7a6bba 100644 (file)
@@ -21,7 +21,7 @@ mra_free(
     int        freeit
 )
 {
-       ch_free( mra->ma_rule_text );
+       ch_free( mra->ma_rule_text.bv_val );
        ber_bvfree( mra->ma_value );
        if ( freeit ) {
                ch_free( (char *) mra );
@@ -42,7 +42,8 @@ get_mra(
 
        ma = ch_malloc( sizeof( MatchingRuleAssertion ) );
        ma->ma_rule = NULL;
-       ma->ma_rule_text = NULL;
+       ma->ma_rule_text.bv_val = NULL;
+       ma->ma_rule_text.bv_len = 0;
        ma->ma_desc = NULL;
        ma->ma_dnattrs = 0;
        ma->ma_value = NULL;
@@ -63,11 +64,11 @@ get_mra(
        }
 
        if ( tag == LDAP_FILTER_EXT_OID ) {
-               rc = ber_scanf( ber, "a", &ma->ma_rule_text );
+               rc = ber_scanf( ber, "o", &ma->ma_rule_text );
                if ( rc == LBER_ERROR ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
-                                  "get_mra: ber_scanf(\"a\") failure.\n" ));
+                                  "get_mra: ber_scanf(\"o\") failure.\n" ));
 #else
                        Debug( LDAP_DEBUG_ANY, "  get_mra ber_scanf for mr\n", 0, 0, 0 );
 #endif
@@ -76,7 +77,7 @@ get_mra(
                        mra_free( ma, 1 );
                        return SLAPD_DISCONNECT;
                }
-               ma->ma_rule = mr_find( ma->ma_rule_text );
+               ma->ma_rule = mr_find( ma->ma_rule_text.bv_val );
 
                rc = ber_scanf( ber, "t", &tag );
 
index 816fe5d605dc0d2504d629bdce55282ca8932ceb..173ef010e99752f985d435ae7b3040097545721c 100644 (file)
@@ -445,7 +445,7 @@ LDAP_SLAPD_F (int) get_filter LDAP_P((
        Connection *conn,
        BerElement *ber,
        Filter **filt,
-       char **fstr,
+       struct berval *fstr,
        const char **text ));
 
 LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f ));
index 97927bf4b512e46d7a146d88ab79366d4dc30f4d..39f50d5c0be527a38dc1236d4edab5b1a130d763 100644 (file)
@@ -36,7 +36,7 @@ do_search(
        struct berval base = { 0, NULL };
        struct berval *pbase = NULL;
        struct berval *nbase = NULL;
-       char            *fstr = NULL;
+       struct berval   fstr = { 0, NULL };
        Filter          *filter = NULL;
        struct berval   **attrs = NULL;
        Backend         *be;
@@ -165,9 +165,9 @@ do_search(
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
-               "do_search: conn %d     filter: %s\n", conn->c_connid, fstr ));
+               "do_search: conn %d     filter: %s\n", conn->c_connid, fstr.bv_val ));
 #else
-       Debug( LDAP_DEBUG_ARGS, "    filter: %s\n", fstr, 0, 0 );
+       Debug( LDAP_DEBUG_ARGS, "    filter: %s\n", fstr.bv_val, 0, 0 );
 #endif
 
 
@@ -221,7 +221,7 @@ do_search(
 
        Statslog( LDAP_DEBUG_STATS,
            "conn=%ld op=%d SRCH base=\"%s\" scope=%d filter=\"%s\"\n",
-           op->o_connid, op->o_opid, pbase->bv_val, scope, fstr );
+           op->o_connid, op->o_opid, pbase->bv_val, scope, fstr.bv_val );
 
        manageDSAit = get_manageDSAit( op );
 
@@ -329,7 +329,7 @@ do_search(
        if ( be->be_search ) {
                (*be->be_search)( be, conn, op, pbase->bv_val, nbase->bv_val,
                        scope, deref, sizelimit,
-                   timelimit, filter, fstr, attrs, attrsonly );
+                   timelimit, filter, fstr.bv_val, attrs, attrsonly );
        } else {
                send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
                        NULL, "operation not supported within namingContext", NULL, NULL );
@@ -340,7 +340,7 @@ return_results:;
        if( pbase != NULL) ber_bvfree( pbase );
        if( nbase != NULL) ber_bvfree( nbase );
 
-       if( fstr != NULL) free( fstr );
+       if( fstr.bv_val != NULL) free( fstr.bv_val );
        if( filter != NULL) filter_free( filter );
        if ( attrs != NULL ) {
                ber_bvecfree( attrs );
index ebd0f0e7e4dc6a3b4931d6a936a4fc761afb2ea1..ef156cbf332dc5e690d13932ee35c2b728dc0878 100644 (file)
@@ -543,7 +543,7 @@ typedef struct slap_ss_assertion {
 
 typedef struct slap_mr_assertion {
        MatchingRule                            *ma_rule;       /* optional */
-       char                                    *ma_rule_text;  /* optional */
+       struct berval                           ma_rule_text;  /* optional */
        AttributeDescription    *ma_desc;       /* optional */
        int                                             ma_dnattrs; /* boolean */
        struct berval                   *ma_value;      /* required */