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(
int freeit
)
{
ber_bvfree( ava->aa_value );
free( ava->aa_value.bv_val );
if ( freeit ) {
ch_free( (char *) ava );
}
......@@ -36,7 +36,7 @@ get_ava(
)
{
int rc;
struct berval type, value, *nvalue;
struct berval type, value;
AttributeAssertion *aa;
rc = ber_scanf( ber, "{oo}", &type, &value );
......@@ -54,7 +54,7 @@ get_ava(
aa = ch_malloc( sizeof( AttributeAssertion ) );
aa->aa_desc = NULL;
aa->aa_value = NULL;
aa->aa_value.bv_val = NULL;
rc = slap_bv2ad( &type, &aa->aa_desc, text );
ch_free( type.bv_val );
......@@ -65,7 +65,7 @@ get_ava(
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 );
if( rc != LDAP_SUCCESS ) {
......@@ -73,9 +73,7 @@ get_ava(
return rc;
}
aa->aa_value = nvalue;
*ava = aa;
return LDAP_SUCCESS;
}
......@@ -86,7 +86,7 @@ bdb_compare(
}
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;
goto return_results;
......@@ -100,7 +100,7 @@ bdb_compare(
{
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;
break;
}
......
......@@ -263,7 +263,7 @@ equality_candidates(
int rc;
slap_mask_t mask;
struct berval prefix = {0};
struct berval **keys = NULL;
struct berval *keys = NULL;
MatchingRule *mr;
Debug( LDAP_DEBUG_TRACE, "=> bdb_equality_candidates\n", 0, 0, 0 );
......@@ -299,7 +299,7 @@ equality_candidates(
ava->aa_desc->ad_type->sat_syntax,
mr,
&prefix,
ava->aa_value,
&ava->aa_value,
&keys );
if( rc != LDAP_SUCCESS ) {
......@@ -316,8 +316,8 @@ equality_candidates(
return 0;
}
for ( i= 0; keys[i] != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, keys[i], tmp );
for ( i= 0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
......@@ -340,7 +340,7 @@ equality_candidates(
break;
}
ber_bvecfree( keys );
bvarray_free( keys );
Debug( LDAP_DEBUG_TRACE,
"<= bdb_equality_candidates id=%ld, first=%ld, last=%ld\n",
......@@ -363,7 +363,7 @@ approx_candidates(
int rc;
slap_mask_t mask;
struct berval prefix = {0};
struct berval **keys = NULL;
struct berval *keys = NULL;
MatchingRule *mr;
Debug( LDAP_DEBUG_TRACE, "=> bdb_approx_candidates\n", 0, 0, 0 );
......@@ -404,7 +404,7 @@ approx_candidates(
ava->aa_desc->ad_type->sat_syntax,
mr,
&prefix,
ava->aa_value,
&ava->aa_value,
&keys );
if( rc != LDAP_SUCCESS ) {
......@@ -421,8 +421,8 @@ approx_candidates(
return 0;
}
for ( i= 0; keys[i] != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, keys[i], tmp );
for ( i= 0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates key read failed (%d)\n",
......@@ -443,7 +443,7 @@ approx_candidates(
break;
}
ber_bvecfree( keys );
bvarray_free( keys );
Debug( LDAP_DEBUG_TRACE, "<= bdb_approx_candidates %ld, first=%ld, last=%ld\n",
(long) ids[0],
......@@ -465,7 +465,7 @@ substring_candidates(
int rc;
slap_mask_t mask;
struct berval prefix = {0};
struct berval **keys = NULL;
struct berval *keys = NULL;
MatchingRule *mr;
Debug( LDAP_DEBUG_TRACE, "=> bdb_substring_candidates\n", 0, 0, 0 );
......@@ -520,8 +520,8 @@ substring_candidates(
return 0;
}
for ( i= 0; keys[i] != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, keys[i], tmp );
for ( i= 0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates key read failed (%d)\n",
......@@ -542,7 +542,7 @@ substring_candidates(
break;
}
ber_bvecfree( keys );
bvarray_free( keys );
Debug( LDAP_DEBUG_TRACE, "<= bdb_substring_candidates %ld, first=%ld, last=%ld\n",
(long) ids[0],
......
......@@ -151,7 +151,7 @@ static int indexer(
const char *text;
DB *db;
AttributeDescription *ad = NULL;
struct berval **keys;
struct berval *keys;
assert( mask );
......@@ -188,14 +188,14 @@ static int indexer(
atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) {
rc = bdb_key_change( be, db, txn, keys[i], id, op );
for( i=0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_change( be, db, txn, &keys[i], id, op );
if( rc ) {
ber_bvecfree( keys );
bvarray_free( keys );
goto done;
}
}
ber_bvecfree( keys );
bvarray_free( keys );
}
rc = LDAP_SUCCESS;
}
......@@ -209,14 +209,14 @@ static int indexer(
atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) {
rc = bdb_key_change( be, db, txn, keys[i], id, op );
for( i=0; keys[i].bv_val != NULL; i++ ) {
rc = bdb_key_change( be, db, txn, &keys[i], id, op );
if( rc ) {
ber_bvecfree( keys );
bvarray_free( keys );
goto done;
}
}
ber_bvecfree( keys );
bvarray_free( keys );
}
rc = LDAP_SUCCESS;
......@@ -231,14 +231,14 @@ static int indexer(
atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) {
bdb_key_change( be, db, txn, keys[i], id, op );
for( i=0; keys[i].bv_val != NULL; i++ ) {
bdb_key_change( be, db, txn, &keys[i], id, op );
if( rc ) {
ber_bvecfree( keys );
bvarray_free( keys );
goto done;
}
}
ber_bvecfree( keys );
bvarray_free( keys );
}
rc = LDAP_SUCCESS;
......
......@@ -372,7 +372,7 @@ add_values(
int rc;
int j;
const char *text = NULL;
struct berval *asserted = NULL;
struct berval asserted;
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
......@@ -386,15 +386,15 @@ add_values(
int match;
int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match == 0 ) {
ber_bvfree( asserted );
free( asserted.bv_val );
return LDAP_TYPE_OR_VALUE_EXISTS;
}
}
ber_bvfree( asserted );
free( asserted.bv_val );
}
}
......@@ -447,7 +447,7 @@ delete_values(
int rc;
const char *text = NULL;
struct berval *asserted = NULL;
struct berval asserted;
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
......@@ -462,7 +462,7 @@ delete_values(
int match;
int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match != 0 ) {
continue;
......@@ -481,7 +481,7 @@ delete_values(
break;
}
ber_bvfree( asserted );
free( asserted.bv_val );
/* looked through them all w/o finding it */
if ( ! found ) {
......
......@@ -532,22 +532,22 @@ static int search_candidates(
*/
if (oc_filter(filter)) {
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_ava = &aa_ref;
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;
xf.f_or = &rf;
}
#ifdef BDB_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_ava = &aa_alias;
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;
xf.f_or = &af;
}
......
......@@ -105,7 +105,7 @@ ldap_back_compare(
if (mapped_oc == NULL)
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)
return( -1 );
......
......@@ -579,7 +579,7 @@ cache_find_entry_dn2id(
struct berval ndn;
ID id;
bv.bv_val = dn;
bv.bv_val = (char *)dn;
bv.bv_len = strlen( dn );
rc = dnNormalize2( NULL, &bv, &ndn );
......
......@@ -82,7 +82,7 @@ ldbm_back_compare(
}
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,
NULL, NULL, NULL, NULL );
......@@ -98,7 +98,7 @@ ldbm_back_compare(
{
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;
break;
}
......
......@@ -331,7 +331,7 @@ equality_candidates(
char *dbname;
slap_mask_t mask;
struct berval prefix = {0};
struct berval **keys = NULL;
struct berval *keys = NULL;
MatchingRule *mr;
#ifdef NEW_LOGGING
......@@ -389,7 +389,7 @@ equality_candidates(
ava->aa_desc->ad_type->sat_syntax,
mr,
&prefix,
ava->aa_value,
&ava->aa_value,
&keys );
if( rc != LDAP_SUCCESS ) {
......@@ -436,11 +436,11 @@ equality_candidates(
return idl;
}
for ( i= 0; keys[i] != NULL; i++ ) {
for ( i= 0; keys[i].bv_val != NULL; i++ ) {
ID_BLOCK *save;
ID_BLOCK *tmp;
rc = key_read( be, db, keys[i], &tmp );
rc = key_read( be, db, &keys[i], &tmp );
if( rc != LDAP_SUCCESS ) {
idl_free( idl );
......@@ -480,7 +480,7 @@ equality_candidates(
if( idl == NULL ) break;
}
ber_bvecfree( keys );
bvarray_free( keys );
ldbm_cache_close( be, db );
......@@ -510,7 +510,7 @@ approx_candidates(
char *dbname;
slap_mask_t mask;
struct berval prefix = {0};
struct berval **keys = NULL;
struct berval *keys = NULL;
MatchingRule *mr;
#ifdef NEW_LOGGING
......@@ -573,7 +573,7 @@ approx_candidates(
ava->aa_desc->ad_type->sat_syntax,
mr,
&prefix,
ava->aa_value,
&ava->aa_value,
&keys );
if( rc != LDAP_SUCCESS ) {
......@@ -620,11 +620,11 @@ approx_candidates(
return idl;
}
for ( i= 0; keys[i] != NULL; i++ ) {
for ( i= 0; keys[i].bv_val != NULL; i++ ) {
ID_BLOCK *save;
ID_BLOCK *tmp;
rc = key_read( be, db, keys[i], &tmp );
rc = key_read( be, db, &keys[i], &tmp );
if( rc != LDAP_SUCCESS ) {
idl_free( idl );
......@@ -662,7 +662,7 @@ approx_candidates(
if( idl == NULL ) break;
}
ber_bvecfree( keys );
bvarray_free( keys );
ldbm_cache_close( be, db );
......@@ -751,7 +751,7 @@ substring_candidates(
char *dbname;
slap_mask_t mask;
struct berval prefix = {0};
struct berval **keys = NULL;
struct berval *keys = NULL;
MatchingRule *mr;
#ifdef NEW_LOGGING
......@@ -857,11 +857,11 @@ substring_candidates(
return idl;
}
for ( i= 0; keys[i] != NULL; i++ ) {
for ( i= 0; keys[i].bv_val != NULL; i++ ) {
ID_BLOCK *save;
ID_BLOCK *tmp;
rc = key_read( be, db, keys[i], &tmp );
rc = key_read( be, db, &keys[i], &tmp );
if( rc != LDAP_SUCCESS ) {
idl_free( idl );
......@@ -900,7 +900,7 @@ substring_candidates(
if( idl == NULL ) break;
}
ber_bvecfree( keys );
bvarray_free( keys );
ldbm_cache_close( be, db );
......
......@@ -138,7 +138,7 @@ static int indexer(
const char *text;
DBCache *db;
AttributeDescription *ad = NULL;
struct berval **keys;
struct berval *keys;
assert( mask );
......@@ -175,10 +175,10 @@ static int indexer(
atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) {
key_change( be, db, keys[i], id, op );
for( i=0; keys[i].bv_val != NULL; i++ ) {
key_change( be, db, &keys[i], id, op );
}
ber_bvecfree( keys );
bvarray_free( keys );
}
}
......@@ -191,10 +191,10 @@ static int indexer(
atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) {
key_change( be, db, keys[i], id, op );
for( i=0; keys[i].bv_val != NULL; i++ ) {
key_change( be, db, &keys[i], id, op );
}
ber_bvecfree( keys );
bvarray_free( keys );
}
}
......@@ -207,10 +207,10 @@ static int indexer(
atname, vals, &keys );
if( rc == LDAP_SUCCESS && keys != NULL ) {
for( i=0; keys[i] != NULL; i++ ) {
key_change( be, db, keys[i], id, op );
for( i=0; keys[i].bv_val != NULL; i++ ) {
key_change( be, db, &keys[i], id, op );
}
ber_bvecfree( keys );
bvarray_free( keys );
}
}
......
......@@ -373,7 +373,7 @@ add_values(
int rc;
int j;
const char *text = NULL;
struct berval *asserted = NULL;
struct berval asserted;
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
......@@ -387,15 +387,15 @@ add_values(
int match;
int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match == 0 ) {
ber_bvfree( asserted );
free( asserted.bv_val );
return LDAP_TYPE_OR_VALUE_EXISTS;
}
}
ber_bvfree( asserted );
free( asserted.bv_val );
}
}
......@@ -459,7 +459,7 @@ delete_values(
int rc;
const char *text = NULL;
struct berval *asserted = NULL;
struct berval asserted;
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
......@@ -474,7 +474,7 @@ delete_values(
int match;
int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
a->a_vals[j], &asserted, &text );
if( rc == LDAP_SUCCESS && match != 0 ) {
continue;
......@@ -493,7 +493,7 @@ delete_values(
break;
}
ber_bvfree( asserted );
free( asserted.bv_val );
/* looked through them all w/o finding it */
if ( ! found ) {
......
......@@ -555,8 +555,8 @@ search_candidates(
ID_BLOCK *candidates;
Filter f, fand, rf, af, xf;
AttributeAssertion aa_ref, aa_alias;
static struct berval bv_ref = { sizeof("REFERRAL")-1, "REFERRAL" };
static struct berval bv_alias = { sizeof("ALIAS")-1, "ALIAS" };
struct berval bv_ref = { sizeof("REFERRAL")-1, "REFERRAL" };
struct berval bv_alias = { sizeof("ALIAS")-1, "ALIAS" };
#ifdef NEW_LOGGING
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
......@@ -578,7 +578,7 @@ search_candidates(
rf.f_choice = LDAP_FILTER_EQUALITY;
rf.f_ava = &aa_ref;
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;
xf.f_or = &rf;
}
......@@ -588,7 +588,7 @@ search_candidates(
af.f_choice = LDAP_FILTER_EQUALITY;
af.f_ava = &aa_alias;
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;
xf.f_or = &af;
}
......
......@@ -318,7 +318,7 @@ add_values( Entry *e, Modification *mod, int *newlevel )
int rc;
int j;
const char *text = NULL;
struct berval *asserted = NULL;
struct berval asserted;
rc = value_normalize( mod->sm_desc,
SLAP_MR_EQUALITY,
......@@ -334,15 +334,15 @@ add_values( Entry *e, Modification *mod, int *newlevel )
int match;
int rc = value_match( &match, mod->sm_desc, mr,
SLAP_MR_VALUE_SYNTAX_MATCH,
a->a_vals[j], asserted, &text );
a->a_vals[j], &asserted, &text );
if ( rc == LDAP_SUCCESS && match == 0 ) {
ber_bvfree( asserted );
free( asserted.bv_val );
return LDAP_TYPE_OR_VALUE_EXISTS;
}