Commit 185ff129 authored by Howard Chu's avatar Howard Chu
Browse files

Change struct berval * to struct berval in various structures

parent 6d046b16
...@@ -21,7 +21,7 @@ ava_free( ...@@ -21,7 +21,7 @@ ava_free(
int freeit int freeit
) )
{ {
ber_bvfree( ava->aa_value ); free( ava->aa_value.bv_val );
if ( freeit ) { if ( freeit ) {
ch_free( (char *) ava ); ch_free( (char *) ava );
} }
...@@ -36,7 +36,7 @@ get_ava( ...@@ -36,7 +36,7 @@ get_ava(
) )
{ {
int rc; int rc;
struct berval type, value, *nvalue; struct berval type, value;
AttributeAssertion *aa; AttributeAssertion *aa;
rc = ber_scanf( ber, "{oo}", &type, &value ); rc = ber_scanf( ber, "{oo}", &type, &value );
...@@ -54,7 +54,7 @@ get_ava( ...@@ -54,7 +54,7 @@ get_ava(
aa = ch_malloc( sizeof( AttributeAssertion ) ); aa = ch_malloc( sizeof( AttributeAssertion ) );
aa->aa_desc = NULL; aa->aa_desc = NULL;
aa->aa_value = NULL; aa->aa_value.bv_val = NULL;
rc = slap_bv2ad( &type, &aa->aa_desc, text ); rc = slap_bv2ad( &type, &aa->aa_desc, text );
ch_free( type.bv_val ); ch_free( type.bv_val );
...@@ -65,7 +65,7 @@ get_ava( ...@@ -65,7 +65,7 @@ get_ava(
return rc; return rc;
} }
rc = value_normalize( aa->aa_desc, usage, &value, &nvalue, text ); rc = value_normalize( aa->aa_desc, usage, &value, &aa->aa_value, text );
ch_free( value.bv_val ); ch_free( value.bv_val );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
...@@ -73,9 +73,7 @@ get_ava( ...@@ -73,9 +73,7 @@ get_ava(
return rc; return rc;
} }
aa->aa_value = nvalue;
*ava = aa; *ava = aa;
return LDAP_SUCCESS; return LDAP_SUCCESS;
} }
...@@ -86,7 +86,7 @@ bdb_compare( ...@@ -86,7 +86,7 @@ bdb_compare(
} }
if ( ! access_allowed( be, conn, op, e, if ( ! access_allowed( be, conn, op, e,
ava->aa_desc, ava->aa_value, ACL_COMPARE ) ) ava->aa_desc, &ava->aa_value, ACL_COMPARE ) )
{ {
rc = LDAP_INSUFFICIENT_ACCESS; rc = LDAP_INSUFFICIENT_ACCESS;
goto return_results; goto return_results;
...@@ -100,7 +100,7 @@ bdb_compare( ...@@ -100,7 +100,7 @@ bdb_compare(
{ {
rc = LDAP_COMPARE_FALSE; rc = LDAP_COMPARE_FALSE;
if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) { if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 ) {
rc = LDAP_COMPARE_TRUE; rc = LDAP_COMPARE_TRUE;
break; break;
} }
......
...@@ -263,7 +263,7 @@ equality_candidates( ...@@ -263,7 +263,7 @@ equality_candidates(
int rc; int rc;
slap_mask_t mask; slap_mask_t mask;
struct berval prefix = {0}; struct berval prefix = {0};
struct berval **keys = NULL; struct berval *keys = NULL;
MatchingRule *mr; MatchingRule *mr;
Debug( LDAP_DEBUG_TRACE, "=> bdb_equality_candidates\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "=> bdb_equality_candidates\n", 0, 0, 0 );
...@@ -299,7 +299,7 @@ equality_candidates( ...@@ -299,7 +299,7 @@ equality_candidates(
ava->aa_desc->ad_type->sat_syntax, ava->aa_desc->ad_type->sat_syntax,
mr, mr,
&prefix, &prefix,
ava->aa_value, &ava->aa_value,
&keys ); &keys );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
...@@ -316,8 +316,8 @@ equality_candidates( ...@@ -316,8 +316,8 @@ equality_candidates(
return 0; return 0;
} }
for ( i= 0; keys[i] != NULL; i++ ) { for ( i= 0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, keys[i], tmp ); rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
...@@ -340,7 +340,7 @@ equality_candidates( ...@@ -340,7 +340,7 @@ equality_candidates(
break; break;
} }
ber_bvecfree( keys ); bvarray_free( keys );
Debug( LDAP_DEBUG_TRACE, Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates id=%ld, first=%ld, last=%ld\n", "<= bdb_equality_candidates id=%ld, first=%ld, last=%ld\n",
...@@ -363,7 +363,7 @@ approx_candidates( ...@@ -363,7 +363,7 @@ approx_candidates(
int rc; int rc;
slap_mask_t mask; slap_mask_t mask;
struct berval prefix = {0}; struct berval prefix = {0};
struct berval **keys = NULL; struct berval *keys = NULL;
MatchingRule *mr; MatchingRule *mr;
Debug( LDAP_DEBUG_TRACE, "=> bdb_approx_candidates\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "=> bdb_approx_candidates\n", 0, 0, 0 );
...@@ -404,7 +404,7 @@ approx_candidates( ...@@ -404,7 +404,7 @@ approx_candidates(
ava->aa_desc->ad_type->sat_syntax, ava->aa_desc->ad_type->sat_syntax,
mr, mr,
&prefix, &prefix,
ava->aa_value, &ava->aa_value,
&keys ); &keys );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
...@@ -421,8 +421,8 @@ approx_candidates( ...@@ -421,8 +421,8 @@ approx_candidates(
return 0; return 0;
} }
for ( i= 0; keys[i] != NULL; i++ ) { for ( i= 0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, keys[i], tmp ); rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates key read failed (%d)\n", Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates key read failed (%d)\n",
...@@ -443,7 +443,7 @@ approx_candidates( ...@@ -443,7 +443,7 @@ approx_candidates(
break; break;
} }
ber_bvecfree( keys ); bvarray_free( keys );
Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates %ld, first=%ld, last=%ld\n", Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates %ld, first=%ld, last=%ld\n",
(long) ids[0], (long) ids[0],
...@@ -465,7 +465,7 @@ substring_candidates( ...@@ -465,7 +465,7 @@ substring_candidates(
int rc; int rc;
slap_mask_t mask; slap_mask_t mask;
struct berval prefix = {0}; struct berval prefix = {0};
struct berval **keys = NULL; struct berval *keys = NULL;
MatchingRule *mr; MatchingRule *mr;
Debug( LDAP_DEBUG_TRACE, "=> bdb_substring_candidates\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "=> bdb_substring_candidates\n", 0, 0, 0 );
...@@ -520,8 +520,8 @@ substring_candidates( ...@@ -520,8 +520,8 @@ substring_candidates(
return 0; return 0;
} }
for ( i= 0; keys[i] != NULL; i++ ) { for ( i= 0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, keys[i], tmp ); rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates key read failed (%d)\n", Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates key read failed (%d)\n",
...@@ -542,7 +542,7 @@ substring_candidates( ...@@ -542,7 +542,7 @@ substring_candidates(
break; break;
} }
ber_bvecfree( keys ); bvarray_free( keys );
Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates %ld, first=%ld, last=%ld\n", Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates %ld, first=%ld, last=%ld\n",
(long) ids[0], (long) ids[0],
......
...@@ -151,7 +151,7 @@ static int indexer( ...@@ -151,7 +151,7 @@ static int indexer(
const char *text; const char *text;
DB *db; DB *db;
AttributeDescription *ad = NULL; AttributeDescription *ad = NULL;
struct berval **keys; struct berval *keys;
assert( mask ); assert( mask );
...@@ -188,14 +188,14 @@ static int indexer( ...@@ -188,14 +188,14 @@ static int indexer(
atname, vals, &keys ); atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) { if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) { for( i=0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_change( be, db, txn, keys[i], id, op ); rc = bdb_key_change( be, db, txn, &keys[i], id, op );
if( rc ) { if( rc ) {
ber_bvecfree( keys ); bvarray_free( keys );
goto done; goto done;
} }
} }
ber_bvecfree( keys ); bvarray_free( keys );
} }
rc = LDAP_SUCCESS; rc = LDAP_SUCCESS;
} }
...@@ -209,14 +209,14 @@ static int indexer( ...@@ -209,14 +209,14 @@ static int indexer(
atname, vals, &keys ); atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) { if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) { for( i=0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_change( be, db, txn, keys[i], id, op ); rc = bdb_key_change( be, db, txn, &keys[i], id, op );
if( rc ) { if( rc ) {
ber_bvecfree( keys ); bvarray_free( keys );
goto done; goto done;
} }
} }
ber_bvecfree( keys ); bvarray_free( keys );
} }
rc = LDAP_SUCCESS; rc = LDAP_SUCCESS;
...@@ -231,14 +231,14 @@ static int indexer( ...@@ -231,14 +231,14 @@ static int indexer(
atname, vals, &keys ); atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) { if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) { for( i=0; keys[i].bv_val != NULL; i++ ) {
bdb_key_change( be, db, txn, keys[i], id, op ); bdb_key_change( be, db, txn, &keys[i], id, op );
if( rc ) { if( rc ) {
ber_bvecfree( keys ); bvarray_free( keys );
goto done; goto done;
} }
} }
ber_bvecfree( keys ); bvarray_free( keys );
} }
rc = LDAP_SUCCESS; rc = LDAP_SUCCESS;
......
...@@ -372,7 +372,7 @@ add_values( ...@@ -372,7 +372,7 @@ add_values(
int rc; int rc;
int j; int j;
const char *text = NULL; const char *text = NULL;
struct berval *asserted = NULL; struct berval asserted;
rc = value_normalize( mod->sm_desc, rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY, SLAP_MR_EQUALITY,
...@@ -386,15 +386,15 @@ add_values( ...@@ -386,15 +386,15 @@ add_values(
int match; int match;
int rc = value_match( &match, mod->sm_desc, mr, int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH, SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text ); a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match == 0 ) { if( rc == LDAP_SUCCESS && match == 0 ) {
ber_bvfree( asserted ); free( asserted.bv_val );
return LDAP_TYPE_OR_VALUE_EXISTS; return LDAP_TYPE_OR_VALUE_EXISTS;
} }
} }
ber_bvfree( asserted ); free( asserted.bv_val );
} }
} }
...@@ -447,7 +447,7 @@ delete_values( ...@@ -447,7 +447,7 @@ delete_values(
int rc; int rc;
const char *text = NULL; const char *text = NULL;
struct berval *asserted = NULL; struct berval asserted;
rc = value_normalize( mod->sm_desc, rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY, SLAP_MR_EQUALITY,
...@@ -462,7 +462,7 @@ delete_values( ...@@ -462,7 +462,7 @@ delete_values(
int match; int match;
int rc = value_match( &match, mod->sm_desc, mr, int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH, SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text ); a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match != 0 ) { if( rc == LDAP_SUCCESS && match != 0 ) {
continue; continue;
...@@ -481,7 +481,7 @@ delete_values( ...@@ -481,7 +481,7 @@ delete_values(
break; break;
} }
ber_bvfree( asserted ); free( asserted.bv_val );
/* looked through them all w/o finding it */ /* looked through them all w/o finding it */
if ( ! found ) { if ( ! found ) {
......
...@@ -532,22 +532,22 @@ static int search_candidates( ...@@ -532,22 +532,22 @@ static int search_candidates(
*/ */
if (oc_filter(filter)) { if (oc_filter(filter)) {
if( !manageDSAit ) { /* match referrals */ if( !manageDSAit ) { /* match referrals */
static struct berval bv_ref = { sizeof("REFERRAL")-1, "REFERRAL" }; struct berval bv_ref = { sizeof("REFERRAL")-1, "REFERRAL" };
rf.f_choice = LDAP_FILTER_EQUALITY; rf.f_choice = LDAP_FILTER_EQUALITY;
rf.f_ava = &aa_ref; rf.f_ava = &aa_ref;
rf.f_av_desc = slap_schema.si_ad_objectClass; rf.f_av_desc = slap_schema.si_ad_objectClass;
rf.f_av_value = &bv_ref; rf.f_av_value = bv_ref;
rf.f_next = xf.f_or; rf.f_next = xf.f_or;
xf.f_or = &rf; xf.f_or = &rf;
} }
#ifdef BDB_ALIASES #ifdef BDB_ALIASES
if( deref & LDAP_DEREF_SEARCHING ) { /* match aliases */ if( deref & LDAP_DEREF_SEARCHING ) { /* match aliases */
static struct berval bv_alias = { sizeof("ALIAS")-1, "ALIAS" }; struct berval bv_alias = { sizeof("ALIAS")-1, "ALIAS" };
af.f_choice = LDAP_FILTER_EQUALITY; af.f_choice = LDAP_FILTER_EQUALITY;
af.f_ava = &aa_alias; af.f_ava = &aa_alias;
af.f_av_desc = slap_schema.si_ad_objectClass; af.f_av_desc = slap_schema.si_ad_objectClass;
af.f_av_value = &bv_alias; af.f_av_value = bv_alias;
af.f_next = xf.f_or; af.f_next = xf.f_or;
xf.f_or = &af; xf.f_or = &af;
} }
......
...@@ -105,7 +105,7 @@ ldap_back_compare( ...@@ -105,7 +105,7 @@ ldap_back_compare(
if (mapped_oc == NULL) if (mapped_oc == NULL)
return( -1 ); return( -1 );
mapped_at = ldap_back_map(&li->at_map, ava->aa_value->bv_val, 0); mapped_at = ldap_back_map(&li->at_map, ava->aa_value.bv_val, 0);
if (mapped_at == NULL) if (mapped_at == NULL)
return( -1 ); return( -1 );
......
...@@ -579,7 +579,7 @@ cache_find_entry_dn2id( ...@@ -579,7 +579,7 @@ cache_find_entry_dn2id(
struct berval ndn; struct berval ndn;
ID id; ID id;
bv.bv_val = dn; bv.bv_val = (char *)dn;
bv.bv_len = strlen( dn ); bv.bv_len = strlen( dn );
rc = dnNormalize2( NULL, &bv, &ndn ); rc = dnNormalize2( NULL, &bv, &ndn );
......
...@@ -82,7 +82,7 @@ ldbm_back_compare( ...@@ -82,7 +82,7 @@ ldbm_back_compare(
} }
if ( ! access_allowed( be, conn, op, e, if ( ! access_allowed( be, conn, op, e,
ava->aa_desc, ava->aa_value, ACL_COMPARE ) ) ava->aa_desc, &ava->aa_value, ACL_COMPARE ) )
{ {
send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS, send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS,
NULL, NULL, NULL, NULL ); NULL, NULL, NULL, NULL );
...@@ -98,7 +98,7 @@ ldbm_back_compare( ...@@ -98,7 +98,7 @@ ldbm_back_compare(
{ {
rc = LDAP_COMPARE_FALSE; rc = LDAP_COMPARE_FALSE;
if ( value_find( ava->aa_desc, a->a_vals, ava->aa_value ) == 0 ) { if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 ) {
rc = LDAP_COMPARE_TRUE; rc = LDAP_COMPARE_TRUE;
break; break;
} }
......
...@@ -331,7 +331,7 @@ equality_candidates( ...@@ -331,7 +331,7 @@ equality_candidates(
char *dbname; char *dbname;
slap_mask_t mask; slap_mask_t mask;
struct berval prefix = {0}; struct berval prefix = {0};
struct berval **keys = NULL; struct berval *keys = NULL;
MatchingRule *mr; MatchingRule *mr;
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
...@@ -389,7 +389,7 @@ equality_candidates( ...@@ -389,7 +389,7 @@ equality_candidates(
ava->aa_desc->ad_type->sat_syntax, ava->aa_desc->ad_type->sat_syntax,
mr, mr,
&prefix, &prefix,
ava->aa_value, &ava->aa_value,
&keys ); &keys );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
...@@ -436,11 +436,11 @@ equality_candidates( ...@@ -436,11 +436,11 @@ equality_candidates(
return idl; return idl;
} }
for ( i= 0; keys[i] != NULL; i++ ) { for ( i= 0; keys[i].bv_val != NULL; i++ ) {
ID_BLOCK *save; ID_BLOCK *save;
ID_BLOCK *tmp; ID_BLOCK *tmp;
rc = key_read( be, db, keys[i], &tmp ); rc = key_read( be, db, &keys[i], &tmp );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
idl_free( idl ); idl_free( idl );
...@@ -480,7 +480,7 @@ equality_candidates( ...@@ -480,7 +480,7 @@ equality_candidates(
if( idl == NULL ) break; if( idl == NULL ) break;
} }
ber_bvecfree( keys ); bvarray_free( keys );
ldbm_cache_close( be, db ); ldbm_cache_close( be, db );
...@@ -510,7 +510,7 @@ approx_candidates( ...@@ -510,7 +510,7 @@ approx_candidates(
char *dbname; char *dbname;
slap_mask_t mask; slap_mask_t mask;
struct berval prefix = {0}; struct berval prefix = {0};
struct berval **keys = NULL; struct berval *keys = NULL;
MatchingRule *mr; MatchingRule *mr;
#ifdef NEW_LOGGING #ifdef NEW_LOGGING
...@@ -573,7 +573,7 @@ approx_candidates( ...@@ -573,7 +573,7 @@ approx_candidates(
ava->aa_desc->ad_type->sat_syntax, ava->aa_desc->ad_type->sat_syntax,
mr, mr,
&prefix, &prefix,
ava->aa_value, &ava->aa_value,
&keys ); &keys );
if( rc != LDAP_SUCCESS ) { if( rc != LDAP_SUCCESS ) {
...@@ -620,11 +620,11 @@ approx_candidates( ...@@ -620,11 +620,11 @@ approx_candidates(