Remove values match v. filter struct field macro overloads

Use LDAP_SLISTs instead of per-struct list management for schema structs
misc cleanup and lint removal
This commit is contained in:
Kurt Zeilenga 2003-01-20 20:21:17 +00:00
parent 521d8384a1
commit 6d1ca4c747
16 changed files with 278 additions and 264 deletions

View file

@ -775,7 +775,7 @@ ad_define_option( const char *name, const char *fname, int lineno )
} while ( name[++optlen] );
options = ch_realloc( options,
(option_count+1) * sizeof(Attr_option) );
(option_count+1) * sizeof(Attr_option) );
if ( strcasecmp( name, "binary" ) == 0
|| ad_find_option_definition( name, optlen ) ) {

View file

@ -49,7 +49,8 @@ struct aindexrec {
};
static Avlnode *attr_index = NULL;
static AttributeType *attr_list = NULL;
static LDAP_SLIST_HEAD(ATList, slap_attribute_type) attr_list
= LDAP_SLIST_HEAD_INITIALIZER(&attr_list);
static int
attr_index_cmp(
@ -197,18 +198,22 @@ at_find_in_list(
void
at_destroy( void )
{
AttributeType *a, *n;
AttributeType *a;
avl_free(attr_index, ldap_memfree);
for (a=attr_list; a; a=n) {
n = a->sat_next;
while( !LDAP_SLIST_EMPTY(&attr_list) ) {
a = LDAP_SLIST_FIRST(&attr_list);
LDAP_SLIST_REMOVE_HEAD(&attr_list, sat_next);
if (a->sat_subtypes) ldap_memfree(a->sat_subtypes);
ad_destroy(a->sat_ad);
ldap_pvt_thread_mutex_destroy(&a->sat_ad_mutex);
ldap_attributetype_free((LDAPAttributeType *)a);
}
if ( slap_schema.si_at_undefined )
if ( slap_schema.si_at_undefined ) {
ad_destroy(slap_schema.si_at_undefined->sat_ad);
}
}
int
@ -216,7 +221,7 @@ at_start( AttributeType **at )
{
assert( at );
*at = attr_list;
*at = LDAP_SLIST_FIRST(&attr_list);
return (*at != NULL);
}
@ -228,9 +233,9 @@ at_next( AttributeType **at )
#if 1 /* pedantic check */
{
AttributeType *tmp;
AttributeType *tmp = NULL;
for ( tmp = attr_list; tmp; tmp = tmp->sat_next ) {
LDAP_SLIST_FOREACH(tmp,&attr_list,sat_next) {
if ( tmp == *at ) {
break;
}
@ -240,7 +245,7 @@ at_next( AttributeType **at )
}
#endif
*at = (*at)->sat_next;
*at = LDAP_SLIST_NEXT(*at,sat_next);
return (*at != NULL);
}
@ -253,15 +258,10 @@ at_insert(
const char **err
)
{
AttributeType **atp;
struct aindexrec *air;
char **names;
atp = &attr_list;
while ( *atp != NULL ) {
atp = &(*atp)->sat_next;
}
*atp = sat;
LDAP_SLIST_INSERT_HEAD( &attr_list, sat, sat_next );
if ( sat->sat_oid ) {
air = (struct aindexrec *)
@ -595,7 +595,7 @@ at_schema_info( Entry *e )
vals[1].bv_val = NULL;
for ( at = attr_list; at; at = at->sat_next ) {
LDAP_SLIST_FOREACH(at,&attr_list,sat_next) {
if( at->sat_flags & SLAP_AT_HIDE ) continue;
if ( ldap_attributetype2bv( &at->sat_atype, vals ) == NULL ) {

View file

@ -689,10 +689,10 @@ backend_unbind(
)
{
int i;
int rc;
Slapi_PBlock *pb = op->o_pb;
#if defined( LDAP_SLAPI )
int rc;
slapi_connection_set_pb( pb, conn );
slapi_operation_set_pb( pb, op );
#endif /* defined( LDAP_SLAPI ) */

View file

@ -29,6 +29,7 @@
#include "slap.h"
#include "slapi.h"
int
do_bind(
Connection *conn,

View file

@ -24,7 +24,8 @@ struct cindexrec {
};
static Avlnode *cr_index = NULL;
static ContentRule *cr_list = NULL;
static LDAP_SLIST_HEAD(CRList, slap_content_rule) cr_list
= LDAP_SLIST_HEAD_INITIALIZER(&cr_list);
static int
cr_index_cmp(
@ -80,12 +81,14 @@ cr_bvfind( struct berval *crname )
void
cr_destroy( void )
{
ContentRule *c, *n;
ContentRule *c;
avl_free(cr_index, ldap_memfree);
for (c=cr_list; c; c=n)
{
n = c->scr_next;
while( !LDAP_SLIST_EMPTY(&cr_list) ) {
c = LDAP_SLIST_FIRST(&cr_list);
LDAP_SLIST_REMOVE_HEAD(&cr_list, scr_next);
if (c->scr_auxiliaries) ldap_memfree(c->scr_auxiliaries);
if (c->scr_required) ldap_memfree(c->scr_required);
if (c->scr_allowed) ldap_memfree(c->scr_allowed);
@ -100,15 +103,10 @@ cr_insert(
const char **err
)
{
ContentRule **crp;
struct cindexrec *cir;
char **names;
crp = &cr_list;
while ( *crp != NULL ) {
crp = &(*crp)->scr_next;
}
*crp = scr;
LDAP_SLIST_INSERT_HEAD(&cr_list, scr, scr_next);
if ( scr->scr_oid ) {
cir = (struct cindexrec *)
@ -397,7 +395,7 @@ cr_schema_info( Entry *e )
vals[1].bv_val = NULL;
for ( cr = cr_list; cr; cr = cr->scr_next ) {
LDAP_SLIST_FOREACH(cr, &cr_list, scr_next) {
if ( ldap_contentrule2bv( &cr->scr_crule, vals ) == NULL ) {
return -1;
}

View file

@ -822,7 +822,7 @@ get_simple_vrFilter(
ber_tag_t tag;
ber_len_t len;
int err;
ValuesReturnFilter *f;
ValuesReturnFilter *vrf;
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ENTRY,
@ -838,13 +838,13 @@ get_simple_vrFilter(
return SLAPD_DISCONNECT;
}
f = (ValuesReturnFilter *) ch_malloc( sizeof(ValuesReturnFilter) );
f->f_next = NULL;
vrf = (ValuesReturnFilter *) ch_malloc( sizeof(ValuesReturnFilter) );
vrf->vrf_next = NULL;
err = LDAP_SUCCESS;
f->f_choice = tag;
vrf->vrf_choice = tag;
switch ( f->f_choice ) {
switch ( vrf->vrf_choice ) {
case LDAP_FILTER_EQUALITY:
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, DETAIL2,
@ -852,12 +852,12 @@ get_simple_vrFilter(
#else
Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY, text );
err = get_ava( ber, &vrf->vrf_ava, SLAP_MR_EQUALITY, text );
if ( err != LDAP_SUCCESS ) {
break;
}
assert( f->f_ava != NULL );
assert( vrf->vrf_ava != NULL );
break;
case LDAP_FILTER_SUBSTRINGS:
@ -867,7 +867,7 @@ get_simple_vrFilter(
#else
Debug( LDAP_DEBUG_FILTER, "SUBSTRINGS\n", 0, 0, 0 );
#endif
err = get_substring_filter( conn, ber, (Filter *)f, text );
err = get_substring_filter( conn, ber, (Filter *)vrf, text );
break;
case LDAP_FILTER_GE:
@ -877,7 +877,7 @@ get_simple_vrFilter(
#else
Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
err = get_ava( ber, &vrf->vrf_ava, SLAP_MR_ORDERING, text );
if ( err != LDAP_SUCCESS ) {
break;
}
@ -890,7 +890,7 @@ get_simple_vrFilter(
#else
Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
err = get_ava( ber, &vrf->vrf_ava, SLAP_MR_ORDERING, text );
if ( err != LDAP_SUCCESS ) {
break;
}
@ -911,13 +911,13 @@ get_simple_vrFilter(
break;
}
f->f_desc = NULL;
err = slap_bv2ad( &type, &f->f_desc, text );
vrf->vrf_desc = NULL;
err = slap_bv2ad( &type, &vrf->vrf_desc, text );
if( err != LDAP_SUCCESS ) {
/* unrecognized attribute description or other error */
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = LDAP_COMPARE_FALSE;
vrf->vrf_choice = SLAPD_FILTER_COMPUTED;
vrf->vrf_result = LDAP_COMPARE_FALSE;
err = LDAP_SUCCESS;
break;
}
@ -930,7 +930,7 @@ get_simple_vrFilter(
#else
Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
#endif
err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY_APPROX, text );
err = get_ava( ber, &vrf->vrf_ava, SLAP_MR_EQUALITY_APPROX, text );
if ( err != LDAP_SUCCESS ) {
break;
}
@ -944,12 +944,12 @@ get_simple_vrFilter(
Debug( LDAP_DEBUG_FILTER, "EXTENSIBLE\n", 0, 0, 0 );
#endif
err = get_mra( ber, &f->f_mra, text );
err = get_mra( ber, &vrf->vrf_mra, text );
if ( err != LDAP_SUCCESS ) {
break;
}
assert( f->f_mra != NULL );
assert( vrf->vrf_mra != NULL );
break;
default:
@ -957,30 +957,30 @@ get_simple_vrFilter(
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ERR,
"get_simple_vrFilter: conn %d unknown filter type=%lu\n",
conn->c_connid, f->f_choice, 0 );
conn->c_connid, vrf->vrf_choice, 0 );
#else
Debug( LDAP_DEBUG_ANY, "get_simple_vrFilter: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
vrf->vrf_choice, 0, 0 );
#endif
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = SLAPD_COMPARE_UNDEFINED;
vrf->vrf_choice = SLAPD_FILTER_COMPUTED;
vrf->vrf_result = SLAPD_COMPARE_UNDEFINED;
break;
}
if ( err != LDAP_SUCCESS ) {
if( err != SLAPD_DISCONNECT ) {
/* ignore error */
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = SLAPD_COMPARE_UNDEFINED;
vrf->vrf_choice = SLAPD_FILTER_COMPUTED;
vrf->vrf_result = SLAPD_COMPARE_UNDEFINED;
err = LDAP_SUCCESS;
*filt = f;
*filt = vrf;
} else {
free(f);
free(vrf);
}
} else {
*filt = f;
*filt = vrf;
}
#ifdef NEW_LOGGING
@ -994,7 +994,7 @@ get_simple_vrFilter(
int
get_vrFilter( Connection *conn, BerElement *ber,
ValuesReturnFilter **f,
ValuesReturnFilter **vrf,
const char **text )
{
/*
@ -1026,7 +1026,7 @@ get_vrFilter( Connection *conn, BerElement *ber,
* matchValue [3] AssertionValue }
*/
ValuesReturnFilter **new;
ValuesReturnFilter **n;
ber_tag_t tag;
ber_len_t len;
char *last;
@ -1050,16 +1050,17 @@ get_vrFilter( Connection *conn, BerElement *ber,
return SLAPD_DISCONNECT;
}
new = f;
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
n = vrf;
for ( tag = ber_first_element( ber, &len, &last );
tag != LBER_DEFAULT;
tag = ber_next_element( ber, &len, last ) )
{
int err = get_simple_vrFilter( conn, ber, new, text );
int err = get_simple_vrFilter( conn, ber, n, text );
if ( err != LDAP_SUCCESS )
return( err );
new = &(*new)->f_next;
n = &(*n)->vrf_next;
}
*new = NULL;
*n = NULL;
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ENTRY,
@ -1071,18 +1072,18 @@ get_vrFilter( Connection *conn, BerElement *ber,
}
void
vrFilter_free( ValuesReturnFilter *f )
vrFilter_free( ValuesReturnFilter *vrf )
{
ValuesReturnFilter *p, *next;
if ( f == NULL ) {
if ( vrf == NULL ) {
return;
}
for ( p = f; p != NULL; p = next ) {
next = p->f_next;
for ( p = vrf; p != NULL; p = next ) {
next = p->vrf_next;
switch ( f->f_choice ) {
switch ( vrf->vrf_choice ) {
case LDAP_FILTER_PRESENT:
break;
@ -1090,22 +1091,22 @@ vrFilter_free( ValuesReturnFilter *f )
case LDAP_FILTER_GE:
case LDAP_FILTER_LE:
case LDAP_FILTER_APPROX:
ava_free( f->f_ava, 1 );
ava_free( vrf->vrf_ava, 1 );
break;
case LDAP_FILTER_SUBSTRINGS:
if ( f->f_sub_initial.bv_val != NULL ) {
free( f->f_sub_initial.bv_val );
if ( vrf->vrf_sub_initial.bv_val != NULL ) {
free( vrf->vrf_sub_initial.bv_val );
}
ber_bvarray_free( f->f_sub_any );
if ( f->f_sub_final.bv_val != NULL ) {
free( f->f_sub_final.bv_val );
ber_bvarray_free( vrf->vrf_sub_any );
if ( vrf->vrf_sub_final.bv_val != NULL ) {
free( vrf->vrf_sub_final.bv_val );
}
ch_free( f->f_sub );
ch_free( vrf->vrf_sub );
break;
case LDAP_FILTER_EXT:
mra_free( f->f_mra, 1 );
mra_free( vrf->vrf_mra, 1 );
break;
case SLAPD_FILTER_COMPUTED:
@ -1114,27 +1115,27 @@ vrFilter_free( ValuesReturnFilter *f )
default:
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ERR,
"filter_free: unknown filter type %lu\n", f->f_choice, 0, 0 );
"filter_free: unknown filter type %lu\n", vrf->vrf_choice, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, "filter_free: unknown filter type=%lu\n",
f->f_choice, 0, 0 );
vrf->vrf_choice, 0, 0 );
#endif
break;
}
free( f );
free( vrf );
}
}
void
vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
vrFilter2bv( ValuesReturnFilter *vrf, struct berval *fstr )
{
ValuesReturnFilter *p;
struct berval tmp;
ber_len_t len;
if ( f == NULL ) {
if ( vrf == NULL ) {
ber_str2bv( "No filter!", sizeof("No filter!")-1, 1, fstr );
return;
}
@ -1144,7 +1145,7 @@ vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
snprintf( fstr->bv_val, fstr->bv_len + 1, "()");
for ( p = f; p != NULL; p = p->f_next ) {
for ( p = vrf; p != NULL; p = p->vrf_next ) {
len = fstr->bv_len;
simple_vrFilter2bv( p, &tmp );
@ -1160,84 +1161,84 @@ vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
}
static void
simple_vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
simple_vrFilter2bv( ValuesReturnFilter *vrf, struct berval *fstr )
{
struct berval tmp;
ber_len_t len;
if ( f == NULL ) {
if ( vrf == NULL ) {
ber_str2bv( "No filter!", sizeof("No filter!")-1, 1, fstr );
return;
}
switch ( f->f_choice ) {
switch ( vrf->vrf_choice ) {
case LDAP_FILTER_EQUALITY:
filter_escape_value( &f->f_av_value, &tmp );
filter_escape_value( &vrf->vrf_av_value, &tmp );
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
tmp.bv_len + ( sizeof("(=)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 1 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",
f->f_av_desc->ad_cname.bv_val,
vrf->vrf_av_desc->ad_cname.bv_val,
tmp.bv_val );
ber_memfree( tmp.bv_val );
break;
case LDAP_FILTER_GE:
filter_escape_value( &f->f_av_value, &tmp );
filter_escape_value( &vrf->vrf_av_value, &tmp );
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
tmp.bv_len + ( sizeof("(>=)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 1 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",
f->f_av_desc->ad_cname.bv_val,
vrf->vrf_av_desc->ad_cname.bv_val,
tmp.bv_val );
ber_memfree( tmp.bv_val );
break;
case LDAP_FILTER_LE:
filter_escape_value( &f->f_av_value, &tmp );
filter_escape_value( &vrf->vrf_av_value, &tmp );
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
tmp.bv_len + ( sizeof("(<=)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 1 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",
f->f_av_desc->ad_cname.bv_val,
vrf->vrf_av_desc->ad_cname.bv_val,
tmp.bv_val );
ber_memfree( tmp.bv_val );
break;
case LDAP_FILTER_APPROX:
filter_escape_value( &f->f_av_value, &tmp );
filter_escape_value( &vrf->vrf_av_value, &tmp );
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
tmp.bv_len + ( sizeof("(~=)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 1 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",
f->f_av_desc->ad_cname.bv_val,
vrf->vrf_av_desc->ad_cname.bv_val,
tmp.bv_val );
ber_memfree( tmp.bv_val );
break;
case LDAP_FILTER_SUBSTRINGS:
fstr->bv_len = f->f_sub_desc->ad_cname.bv_len +
fstr->bv_len = vrf->vrf_sub_desc->ad_cname.bv_len +
( sizeof("(=*)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 128 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
f->f_sub_desc->ad_cname.bv_val );
vrf->vrf_sub_desc->ad_cname.bv_val );
if ( f->f_sub_initial.bv_val != NULL ) {
if ( vrf->vrf_sub_initial.bv_val != NULL ) {
len = fstr->bv_len;
filter_escape_value( &f->f_sub_initial, &tmp );
filter_escape_value( &vrf->vrf_sub_initial, &tmp );
fstr->bv_len += tmp.bv_len;
fstr->bv_val = ch_realloc( fstr->bv_val, fstr->bv_len + 1 );
@ -1249,11 +1250,11 @@ simple_vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
ber_memfree( tmp.bv_val );
}
if ( f->f_sub_any != NULL ) {
if ( vrf->vrf_sub_any != NULL ) {
int i;
for ( i = 0; f->f_sub_any[i].bv_val != NULL; i++ ) {
for ( i = 0; vrf->vrf_sub_any[i].bv_val != NULL; i++ ) {
len = fstr->bv_len;
filter_escape_value( &f->f_sub_any[i], &tmp );
filter_escape_value( &vrf->vrf_sub_any[i], &tmp );
fstr->bv_len += tmp.bv_len + 1;
fstr->bv_val = ch_realloc( fstr->bv_val, fstr->bv_len + 1 );
@ -1265,10 +1266,10 @@ simple_vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
}
}
if ( f->f_sub_final.bv_val != NULL ) {
if ( vrf->vrf_sub_final.bv_val != NULL ) {
len = fstr->bv_len;
filter_escape_value( &f->f_sub_final, &tmp );
filter_escape_value( &vrf->vrf_sub_final, &tmp );
fstr->bv_len += tmp.bv_len;
fstr->bv_val = ch_realloc( fstr->bv_val, fstr->bv_len + 1 );
@ -1283,36 +1284,36 @@ simple_vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
break;
case LDAP_FILTER_PRESENT:
fstr->bv_len = f->f_desc->ad_cname.bv_len +
fstr->bv_len = vrf->vrf_desc->ad_cname.bv_len +
( sizeof("(=*)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 1 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
f->f_desc->ad_cname.bv_val );
vrf->vrf_desc->ad_cname.bv_val );
break;
case LDAP_FILTER_EXT: {
struct berval ad;
filter_escape_value( &f->f_mr_value, &tmp );
filter_escape_value( &vrf->vrf_mr_value, &tmp );
if ( f->f_mr_desc ) {
ad = f->f_mr_desc->ad_cname;
if ( vrf->vrf_mr_desc ) {
ad = vrf->vrf_mr_desc->ad_cname;
} else {
ad.bv_len = 0;
ad.bv_val = "";
}
fstr->bv_len = ad.bv_len +
( f->f_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
( f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_len+1 : 0 ) +
( vrf->vrf_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
( vrf->vrf_mr_rule_text.bv_len ? vrf->vrf_mr_rule_text.bv_len+1 : 0 ) +
tmp.bv_len + ( sizeof("(:=)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 1 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
ad.bv_val,
f->f_mr_dnattrs ? ":dn" : "",
f->f_mr_rule_text.bv_len ? ":" : "",
f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_val : "",
vrf->vrf_mr_dnattrs ? ":dn" : "",
vrf->vrf_mr_rule_text.bv_len ? ":" : "",
vrf->vrf_mr_rule_text.bv_len ? vrf->vrf_mr_rule_text.bv_val : "",
tmp.bv_val );
ber_memfree( tmp.bv_val );
@ -1320,13 +1321,13 @@ simple_vrFilter2bv( ValuesReturnFilter *f, struct berval *fstr )
case SLAPD_FILTER_COMPUTED:
ber_str2bv(
f->f_result == LDAP_COMPARE_FALSE ? "(?=false)" :
f->f_result == LDAP_COMPARE_TRUE ? "(?=true)" :
f->f_result == SLAPD_COMPARE_UNDEFINED ? "(?=undefined)" :
vrf->vrf_result == LDAP_COMPARE_FALSE ? "(?=false)" :
vrf->vrf_result == LDAP_COMPARE_TRUE ? "(?=true)" :
vrf->vrf_result == SLAPD_COMPARE_UNDEFINED ? "(?=undefined)" :
"(?=error)",
f->f_result == LDAP_COMPARE_FALSE ? sizeof("(?=false)")-1 :
f->f_result == LDAP_COMPARE_TRUE ? sizeof("(?=true)")-1 :
f->f_result == SLAPD_COMPARE_UNDEFINED ? sizeof("(?=undefined)")-1 :
vrf->vrf_result == LDAP_COMPARE_FALSE ? sizeof("(?=false)")-1 :
vrf->vrf_result == LDAP_COMPARE_TRUE ? sizeof("(?=true)")-1 :
vrf->vrf_result == SLAPD_COMPARE_UNDEFINED ? sizeof("(?=undefined)")-1 :
sizeof("(?=error)")-1,
1, fstr );
break;
@ -1341,7 +1342,7 @@ static int
get_substring_vrFilter(
Connection *conn,
BerElement *ber,
ValuesReturnFilter *f,
ValuesReturnFilter *vrf,
const char **text )
{
ber_tag_t tag;
@ -1362,21 +1363,21 @@ get_substring_vrFilter(
return SLAPD_DISCONNECT;
}
f->f_sub = ch_calloc( 1, sizeof(SubstringsAssertion) );
f->f_sub_desc = NULL;
rc = slap_bv2ad( &bv, &f->f_sub_desc, text );
vrf->vrf_sub = ch_calloc( 1, sizeof(SubstringsAssertion) );
vrf->vrf_sub_desc = NULL;
rc = slap_bv2ad( &bv, &vrf->vrf_sub_desc, text );
if( rc != LDAP_SUCCESS ) {
text = NULL;
ch_free( f->f_sub );
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = SLAPD_COMPARE_UNDEFINED;
ch_free( vrf->vrf_sub );
vrf->vrf_choice = SLAPD_FILTER_COMPUTED;
vrf->vrf_result = SLAPD_COMPARE_UNDEFINED;
return LDAP_SUCCESS;
}
f->f_sub_initial.bv_val = NULL;
f->f_sub_any = NULL;
f->f_sub_final.bv_val = NULL;
vrf->vrf_sub_initial.bv_val = NULL;
vrf->vrf_sub_any = NULL;
vrf->vrf_sub_final.bv_val = NULL;
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
tag = ber_next_element( ber, &len, last ) )
@ -1423,13 +1424,13 @@ get_substring_vrFilter(
}
/* valiate using equality matching rule validator! */
rc = value_validate( f->f_sub_desc->ad_type->sat_equality,
rc = value_validate( vrf->vrf_sub_desc->ad_type->sat_equality,
&value, text );
if( rc != LDAP_SUCCESS ) {
goto return_error;
}
rc = value_normalize( f->f_sub_desc, usage,
rc = value_normalize( vrf->vrf_sub_desc, usage,
&value, &bv, text );
if( rc != LDAP_SUCCESS ) {
goto return_error;
@ -1449,15 +1450,15 @@ get_substring_vrFilter(
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 );
#endif
if ( f->f_sub_initial.bv_val != NULL
|| f->f_sub_any != NULL
|| f->f_sub_final.bv_val != NULL )
if ( vrf->vrf_sub_initial.bv_val != NULL
|| vrf->vrf_sub_any != NULL
|| vrf->vrf_sub_final.bv_val != NULL )
{
free( value.bv_val );
goto return_error;
}
f->f_sub_initial = value;
vrf->vrf_sub_initial = value;
break;
case LDAP_SUBSTRING_ANY:
@ -1468,12 +1469,12 @@ get_substring_vrFilter(
Debug( LDAP_DEBUG_FILTER, " ANY\n", 0, 0, 0 );
#endif
if ( f->f_sub_final.bv_val != NULL ) {
if ( vrf->vrf_sub_final.bv_val != NULL ) {
free( value.bv_val );
goto return_error;
}
ber_bvarray_add( &f->f_sub_any, &value );
ber_bvarray_add( &vrf->vrf_sub_any, &value );
break;
case LDAP_SUBSTRING_FINAL:
@ -1484,12 +1485,12 @@ get_substring_vrFilter(
Debug( LDAP_DEBUG_FILTER, " FINAL\n", 0, 0, 0 );
#endif
if ( f->f_sub_final.bv_val != NULL ) {
if ( vrf->vrf_sub_final.bv_val != NULL ) {
free( value.bv_val );
goto return_error;
}
f->f_sub_final = value;
vrf->vrf_sub_final = value;
break;
default:
@ -1514,10 +1515,10 @@ return_error:
Debug( LDAP_DEBUG_FILTER, " error=%ld\n",
(long) rc, 0, 0 );
#endif
free( f->f_sub_initial.bv_val );
ber_bvarray_free( f->f_sub_any );
free( f->f_sub_final.bv_val );
ch_free( f->f_sub );
free( vrf->vrf_sub_initial.bv_val );
ber_bvarray_free( vrf->vrf_sub_any );
free( vrf->vrf_sub_final.bv_val );
ch_free( vrf->vrf_sub );
return rc;
}
}

View file

@ -17,7 +17,6 @@
#include "ldap_pvt.h"
#include "slap.h"
#include "slapi.h"
#include "lutil.h"
@ -160,7 +159,6 @@ int main( int argc, char **argv )
}
#endif
#ifdef HAVE_NT_SERVICE_MANAGER
{
int *i;
@ -328,7 +326,6 @@ int main( int argc, char **argv )
Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 );
#endif
if( serverName == NULL ) {
if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) {
serverName = argv[0];

View file

@ -70,7 +70,7 @@ filter_matched_values(
char ***e_flags
)
{
ValuesReturnFilter *f;
ValuesReturnFilter *vrf;
int rc = LDAP_SUCCESS;
#ifdef NEW_LOGGING
@ -79,22 +79,22 @@ filter_matched_values(
Debug( LDAP_DEBUG_FILTER, "=> filter_matched_values\n", 0, 0, 0 );
#endif
for ( f = op->vrFilter; f != NULL; f = f->f_next ) {
switch ( f->f_choice ) {
for ( vrf = op->vrFilter; vrf != NULL; vrf = vrf->vrf_next ) {
switch ( vrf->vrf_choice ) {
case SLAPD_FILTER_COMPUTED:
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, DETAIL1,
"test_vrFilter: COMPUTED %s (%d)\n",
f->f_result == LDAP_COMPARE_FALSE ? "false" :
f->f_result == LDAP_COMPARE_TRUE ? "true" :
f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" :
"error", f->f_result, 0 );
vrf->vrf_result == LDAP_COMPARE_FALSE ? "false" :
vrf->vrf_result == LDAP_COMPARE_TRUE ? "true" :
vrf->vrf_result == SLAPD_COMPARE_UNDEFINED ? "undefined" :
"error", vrf->vrf_result, 0 );
#else
Debug( LDAP_DEBUG_FILTER, " COMPUTED %s (%d)\n",
f->f_result == LDAP_COMPARE_FALSE ? "false" :
f->f_result == LDAP_COMPARE_TRUE ? "true" :
f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" : "error",
f->f_result, 0 );
vrf->vrf_result == LDAP_COMPARE_FALSE ? "false" :
vrf->vrf_result == LDAP_COMPARE_TRUE ? "true" :
vrf->vrf_result == SLAPD_COMPARE_UNDEFINED ? "undefined" : "error",
vrf->vrf_result, 0 );
#endif
/*This type of filter does not affect the result */
rc = LDAP_SUCCESS;
@ -106,7 +106,7 @@ filter_matched_values(
#else
Debug( LDAP_DEBUG_FILTER, " EQUALITY\n", 0, 0, 0 );
#endif
rc = test_ava_vrFilter( be, conn, op, a, f->f_ava,
rc = test_ava_vrFilter( be, conn, op, a, vrf->vrf_ava,
LDAP_FILTER_EQUALITY, e_flags );
if( rc == -1 ) {
return rc;
@ -121,7 +121,7 @@ filter_matched_values(
#endif
rc = test_substrings_vrFilter( be, conn, op, a,
f, e_flags );
vrf, e_flags );
if( rc == -1 ) {
return rc;
}
@ -134,14 +134,14 @@ filter_matched_values(
Debug( LDAP_DEBUG_FILTER, " PRESENT\n", 0, 0, 0 );
#endif
rc = test_presence_vrFilter( be, conn, op, a,
f->f_desc, e_flags );
vrf->vrf_desc, e_flags );
if( rc == -1 ) {
return rc;
}
break;
case LDAP_FILTER_GE:
rc = test_ava_vrFilter( be, conn, op, a, f->f_ava,
rc = test_ava_vrFilter( be, conn, op, a, vrf->vrf_ava,
LDAP_FILTER_GE, e_flags );
if( rc == -1 ) {
return rc;
@ -149,7 +149,7 @@ filter_matched_values(
break;
case LDAP_FILTER_LE:
rc = test_ava_vrFilter( be, conn, op, a, f->f_ava,
rc = test_ava_vrFilter( be, conn, op, a, vrf->vrf_ava,
LDAP_FILTER_LE, e_flags );
if( rc == -1 ) {
return rc;
@ -163,7 +163,7 @@ filter_matched_values(
Debug( LDAP_DEBUG_FILTER, " EXT\n", 0, 0, 0 );
#endif
rc = test_mra_vrFilter( be, conn, op, a,
f->f_mra, e_flags );
vrf->vrf_mra, e_flags );
if( rc == -1 ) {
return rc;
}
@ -172,10 +172,10 @@ filter_matched_values(
default:
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, INFO,
"test_vrFilter: unknown filter type %lu\n", f->f_choice, 0, 0 );
"test_vrFilter: unknown filter type %lu\n", vrf->vrf_choice, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY, " unknown filter type %lu\n",
f->f_choice, 0, 0 );
vrf->vrf_choice, 0, 0 );
#endif
rc = LDAP_PROTOCOL_ERROR;
}
@ -303,7 +303,7 @@ test_substrings_vrFilter(
Connection *conn,
Operation *op,
Attribute *a,
ValuesReturnFilter *f,
ValuesReturnFilter *vrf,
char ***e_flags
)
{
@ -313,7 +313,7 @@ test_substrings_vrFilter(
MatchingRule *mr = a->a_desc->ad_type->sat_substr;
struct berval *bv;
if ( !is_ad_subtype( a->a_desc, f->f_sub_desc ) ) {
if ( !is_ad_subtype( a->a_desc, vrf->vrf_sub_desc ) ) {
continue;
}
@ -328,7 +328,7 @@ test_substrings_vrFilter(
rc = value_match( &ret, a->a_desc, mr,
SLAP_MR_ASSERTION_SYNTAX_MATCH,
bv, f->f_sub, &text );
bv, vrf->vrf_sub, &text );
if( rc != LDAP_SUCCESS ) {
return rc;

View file

@ -464,10 +464,10 @@ do_modify(
cleanup:
free( pdn.bv_val );
free( ndn.bv_val );
if ( modlist != NULL )
slap_mods_free( modlist );
if ( modv != NULL )
FreeLDAPMods( modv );
if ( modlist != NULL ) slap_mods_free( modlist );
#ifdef LDAP_SLAPI
if ( modv != NULL ) FreeLDAPMods( modv );
#endif
return rc;
}

View file

@ -22,8 +22,10 @@ struct mindexrec {
};
static Avlnode *mr_index = NULL;
static MatchingRule *mr_list = NULL;
static MatchingRuleUse *mru_list = NULL;
static LDAP_SLIST_HEAD(MRList, slap_matching_rule) mr_list
= LDAP_SLIST_HEAD_INITIALIZER(&mr_list);
static LDAP_SLIST_HEAD(MRUList, slap_matching_rule_use) mru_list
= LDAP_SLIST_HEAD_INITIALIZER(&mru_list);
static int
mr_index_cmp(
@ -75,11 +77,12 @@ mr_bvfind( struct berval *mrname )
void
mr_destroy( void )
{
MatchingRule *m, *n;
MatchingRule *m;
avl_free(mr_index, ldap_memfree);
for (m=mr_list; m; m=n) {
n = m->smr_next;
while( !LDAP_SLIST_EMPTY(&mr_list) ) {
m = LDAP_SLIST_FIRST(&mr_list);
LDAP_SLIST_REMOVE_HEAD(&mr_list, smr_next);
ch_free( m->smr_str.bv_val );
ldap_matchingrule_free((LDAPMatchingRule *)m);
}
@ -91,15 +94,10 @@ mr_insert(
const char **err
)
{
MatchingRule **mrp;
struct mindexrec *mir;
char **names;
mrp = &mr_list;
while ( *mrp != NULL ) {
mrp = &(*mrp)->smr_next;
}
*mrp = smr;
LDAP_SLIST_INSERT_HEAD(&mr_list, smr, smr_next);
if ( smr->smr_oid ) {
mir = (struct mindexrec *)
@ -287,10 +285,12 @@ register_matching_rule(
void
mru_destroy( void )
{
MatchingRuleUse *m, *n;
MatchingRuleUse *m;
while( !LDAP_SLIST_EMPTY(&mru_list) ) {
m = LDAP_SLIST_FIRST(&mru_list);
LDAP_SLIST_REMOVE_HEAD(&mru_list, smru_next);
for (m=mru_list; m; m=n) {
n = m->smru_next;
if ( m->smru_str.bv_val ) {
ch_free( m->smru_str.bv_val );
}
@ -309,7 +309,7 @@ int
matching_rule_use_init( void )
{
MatchingRule *mr;
MatchingRuleUse **mru_ptr = &mru_list;
MatchingRuleUse **mru_ptr = &LDAP_SLIST_FIRST(&mru_list);
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "matching_rule_use_init\n", 0, 0, 0 );
@ -317,9 +317,9 @@ matching_rule_use_init( void )
Debug( LDAP_DEBUG_TRACE, "matching_rule_use_init\n", 0, 0, 0 );
#endif
for ( mr = mr_list; mr; mr = mr->smr_next ) {
LDAP_SLIST_FOREACH( mr, &mr_list, smr_next ) {
AttributeType *at;
MatchingRuleUse _mru, *mru = &_mru;
MatchingRuleUse mru_storage, *mru = &mru_storage;
char **applies_oids = NULL;
@ -353,7 +353,7 @@ matching_rule_use_init( void )
mru->smru_mr = mr;
mru->smru_obsolete = mr->smr_obsolete;
mru->smru_applies_oids = NULL;
mru->smru_next = NULL;
LDAP_SLIST_NEXT(mru, smru_next) = NULL;
mru->smru_oid = mr->smr_oid;
mru->smru_names = mr->smr_names;
mru->smru_desc = mr->smr_desc;
@ -402,11 +402,11 @@ matching_rule_use_init( void )
/* call-forward from MatchingRule to MatchingRuleUse */
mr->smr_mru = mru;
/* copy static data to newly allocated struct */
*mru = _mru;
*mru = mru_storage;
/* append the struct pointer to the end of the list */
*mru_ptr = mru;
/* update the list head pointer */
mru_ptr = &mru->smru_next;
mru_ptr = &LDAP_SLIST_NEXT(mru,smru_next);
}
}
@ -437,11 +437,11 @@ int mr_usable_with_at(
int mr_schema_info( Entry *e )
{
MatchingRule *mr;
MatchingRule *mr;
AttributeDescription *ad_matchingRules = slap_schema.si_ad_matchingRules;
for ( mr = mr_list; mr; mr = mr->smr_next ) {
LDAP_SLIST_FOREACH(mr, &mr_list, smr_next ) {
if ( mr->smr_usage & SLAP_MR_HIDE ) {
/* skip hidden rules */
continue;
@ -474,7 +474,7 @@ int mru_schema_info( Entry *e )
AttributeDescription *ad_matchingRuleUse
= slap_schema.si_ad_matchingRuleUse;
for ( mru = mru_list; mru; mru = mru->smru_next ) {
LDAP_SLIST_FOREACH( mru, &mru_list, smru_next ) {
assert( !( mru->smru_usage & SLAP_MR_HIDE ) );

View file

@ -124,7 +124,8 @@ struct oindexrec {
};
static Avlnode *oc_index = NULL;
static ObjectClass *oc_list = NULL;
static LDAP_SLIST_HEAD(OCList, slap_object_class) oc_list
= LDAP_SLIST_HEAD_INITIALIZER(&oc_list);
static int
oc_index_cmp(
@ -331,12 +332,13 @@ oc_add_sups(
void
oc_destroy( void )
{
ObjectClass *o, *n;
ObjectClass *o;
avl_free(oc_index, ldap_memfree);
for (o=oc_list; o; o=n)
{
n = o->soc_next;
while( !LDAP_SLIST_EMPTY(&oc_list) ) {
o = LDAP_SLIST_FIRST(&oc_list);
LDAP_SLIST_REMOVE_HEAD(&oc_list, soc_next);
if (o->soc_sups) ldap_memfree(o->soc_sups);
if (o->soc_required) ldap_memfree(o->soc_required);
if (o->soc_allowed) ldap_memfree(o->soc_allowed);
@ -350,15 +352,10 @@ oc_insert(
const char **err
)
{
ObjectClass **ocp;
struct oindexrec *oir;
char **names;
ocp = &oc_list;
while ( *ocp != NULL ) {
ocp = &(*ocp)->soc_next;
}
*ocp = soc;
LDAP_SLIST_INSERT_HEAD( &oc_list, soc, soc_next );
if ( soc->soc_oid ) {
oir = (struct oindexrec *)
@ -489,7 +486,7 @@ oc_schema_info( Entry *e )
vals[1].bv_val = NULL;
for ( oc = oc_list; oc; oc = oc->soc_next ) {
LDAP_SLIST_FOREACH( oc, &oc_list, soc_next ) {
if( oc->soc_flags & SLAP_OC_HIDE ) continue;
if ( ldap_objectclass2bv( &oc->soc_oclass, vals ) == NULL ) {

View file

@ -15,7 +15,8 @@
#include "slap.h"
static OidMacro *om_list = NULL;
static LDAP_SLIST_HEAD(OidMacroList, slap_oid_macro) om_list
= LDAP_SLIST_HEAD_INITIALIZER(om_list);
/* Replace an OID Macro invocation with its full numeric OID.
* If the macro is used with "macroname:suffix" append ".suffix"
@ -31,7 +32,7 @@ oidm_find(char *oid)
return oid;
}
for (om = om_list; om; om=om->som_next) {
LDAP_SLIST_FOREACH( om, &om_list, som_next ) {
char **names = om->som_names;
if( names == NULL ) {
@ -71,13 +72,16 @@ oidm_find(char *oid)
void
oidm_destroy()
{
OidMacro *om, *n;
OidMacro *om;
while( !LDAP_SLIST_EMPTY( &om_list )) {
om = LDAP_SLIST_FIRST( &om_list );
for (om = om_list; om; om = n) {
n = om->som_next;
ldap_charray_free(om->som_names);
free(om->som_oid.bv_val);
free(om);
LDAP_SLIST_REMOVE_HEAD( &om_list, som_next );
}
}
@ -133,8 +137,8 @@ usage: fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
}
om->som_oid.bv_len = strlen( om->som_oid.bv_val );
om->som_next = om_list;
om_list = om;
LDAP_SLIST_INSERT_HEAD( &om_list, om, som_next );
return 0;
}

View file

@ -19,11 +19,11 @@ LDAP_BEGIN_DECL
typedef BerVarray (SLAP_SET_GATHER)(
void *cookie, struct berval *name, struct berval *attr);
LDAP_SLAPD_F (long) slap_set_size (BerVarray set);
LDAP_SLAPD_F (void) slap_set_dispose (BerVarray set);
LDAP_SLAPD_F (long) slap_set_size(BerVarray set);
LDAP_SLAPD_F (void) slap_set_dispose(BerVarray set);
LDAP_SLAPD_F (int)
slap_set_filter (SLAP_SET_GATHER gatherer,
LDAP_SLAPD_F (int) slap_set_filter(
SLAP_SET_GATHER gatherer,
void *cookie, struct berval *filter,
struct berval *user, struct berval *this, BerVarray *results);

View file

@ -64,11 +64,9 @@ LDAP_BEGIN_DECL
#define SLAPD_ANONYMOUS "cn=anonymous"
/* LDAPMod.mod_op value ===> Must be kept in sync with ldap.h!
*
* This is a value used internally by the backends. It is needed to allow
* adding values that already exist without getting an error as required by
* modrdn when the new rdn was already an attribute value itself.
* JCG 05/1999 (gomez@engr.sgi.com)
*/
#define SLAP_MOD_SOFTADD 0x1000
@ -143,8 +141,6 @@ LDAP_BEGIN_DECL
#define SLAPD_ACI_SYNTAX "1.3.6.1.4.1.4203.666.2.1"
#endif
#define SLAPD_OCTETSTRING_SYNTAX "1.3.6.1.4.1.1466.115.121.1.40"
/* change this to "OpenLDAPset" */
#define SLAPD_ACI_SET_ATTR "template"
@ -277,7 +273,7 @@ extern int slap_inet4or6;
typedef struct slap_oid_macro {
struct berval som_oid;
char **som_names;
struct slap_oid_macro *som_next;
LDAP_SLIST_ENTRY(slap_oid_macro) som_next;
} OidMacro;
/* forward declarations */
@ -327,7 +323,7 @@ typedef struct slap_syntax {
slap_syntax_transform_func *ssyn_str2ber;
#endif
struct slap_syntax *ssyn_next;
LDAP_SLIST_ENTRY(slap_syntax) ssyn_next;
} Syntax;
#define slap_syntax_is_flag(s,flag) ((int)((s)->ssyn_flags & (flag)) ? 1 : 0)
@ -399,7 +395,7 @@ typedef struct slap_matching_rule {
struct berval smr_str;
/*
* Note: the former
ber_len_t smr_oidlen;
* ber_len_t smr_oidlen;
* has been replaced by a struct berval that uses the value
* provided by smr_mrule.mr_oid; a macro that expands to
* the bv_len field of the berval is provided for backward
@ -461,14 +457,14 @@ typedef struct slap_matching_rule {
slap_mr_filter_func *smr_filter;
/*
* null terminated list of syntaxes compatible with this syntax
* null terminated array of syntaxes compatible with this syntax
* note: when MS_EXT is set, this MUST NOT contain the assertion
* syntax of the rule. When MS_EXT is not set, it MAY.
*/
Syntax **smr_compat_syntaxes;
struct slap_matching_rule *smr_associated;
struct slap_matching_rule *smr_next;
LDAP_SLIST_ENTRY(slap_matching_rule)smr_next;
#define smr_oid smr_mrule.mr_oid
#define smr_names smr_mrule.mr_names
@ -484,7 +480,7 @@ struct slap_matching_rule_use {
/* RFC2252 string representation */
struct berval smru_str;
struct slap_matching_rule_use *smru_next;
LDAP_SLIST_ENTRY(slap_matching_rule_use) smru_next;
#define smru_oid smru_mruleuse.mru_oid
#define smru_names smru_mruleuse.mru_names
@ -538,7 +534,7 @@ typedef struct slap_attribute_type {
#define SLAP_AT_HIDE 0x8000U /* hide attribute */
slap_mask_t sat_flags;
struct slap_attribute_type *sat_next;
LDAP_SLIST_ENTRY(slap_attribute_type) sat_next;
#define sat_oid sat_atype.at_oid
#define sat_names sat_atype.at_names
@ -592,7 +588,7 @@ typedef struct slap_object_class {
#define soc_at_oids_may soc_oclass.oc_at_oids_may
#define soc_extensions soc_oclass.oc_extensions
struct slap_object_class *soc_next;
LDAP_SLIST_ENTRY(slap_object_class) soc_next;
} ObjectClass;
#define SLAP_OC_ALIAS 0x0001
@ -624,7 +620,7 @@ typedef struct slap_content_rule {
#define scr_at_oids_may scr_crule.cr_at_oids_may
#define scr_at_oids_not scr_crule.cr_at_oids_not
struct slap_content_rule *scr_next;
LDAP_SLIST_ENTRY( slap_content_rule ) scr_next;
} ContentRule;
/* Represents a recognized attribute description ( type + options ). */
@ -834,29 +830,50 @@ typedef struct slap_filter {
#define SLAPD_COMPARE_UNDEFINED ((ber_int_t) -1)
typedef struct slap_valuesreturnfilter {
ber_tag_t f_choice;
ber_tag_t vrf_choice;
union vrf_un_u {
/* precomputed result */
ber_int_t f_un_result;
ber_int_t vrf_un_result;
/* DN */
char *f_un_dn;
char *vrf_un_dn;
/* present */
AttributeDescription *f_un_desc;
AttributeDescription *vrf_un_desc;
/* simple value assertion */
AttributeAssertion *f_un_ava;
AttributeAssertion *vrf_un_ava;
/* substring assertion */
SubstringsAssertion *f_un_ssa;
SubstringsAssertion *vrf_un_ssa;
/* matching rule assertion */
MatchingRuleAssertion *f_un_mra;
} f_un;
MatchingRuleAssertion *vrf_un_mra;
struct slap_valuesreturnfilter *f_next;
#define vrf_result vrf_un.vrf_un_result
#define vrf_dn vrf_un.vrf_un_dn
#define vrf_desc vrf_un.vrf_un_desc
#define vrf_ava vrf_un.vrf_un_ava
#define vrf_av_desc vrf_un.vrf_un_ava->aa_desc
#define vrf_av_value vrf_un.vrf_un_ava->aa_value
#define vrf_ssa vrf_un.vrf_un_ssa
#define vrf_sub vrf_un.vrf_un_ssa
#define vrf_sub_desc vrf_un.vrf_un_ssa->sa_desc
#define vrf_sub_initial vrf_un.vrf_un_ssa->sa_initial
#define vrf_sub_any vrf_un.vrf_un_ssa->sa_any
#define vrf_sub_final vrf_un.vrf_un_ssa->sa_final
#define vrf_mra vrf_un.vrf_un_mra
#define vrf_mr_rule vrf_un.vrf_un_mra->ma_rule
#define vrf_mr_rule_text vrf_un.vrf_un_mra->ma_rule_text
#define vrf_mr_desc vrf_un.vrf_un_mra->ma_desc
#define vrf_mr_value vrf_un.vrf_un_mra->ma_value
#define vrf_mr_dnattrs vrf_un.vrf_un_mra->ma_dnattrs
} vrf_un;
struct slap_valuesreturnfilter *vrf_next;
} ValuesReturnFilter;
/*
@ -1112,7 +1129,8 @@ typedef struct slap_acl_state {
int as_result;
AttributeDescription *as_vd_ad;
} AccessControlState;
#define ACL_STATE_INIT { ACL_STATE_NOT_RECORDED, NULL, NULL, 0UL, { { 0, 0 } }, 0, NULL, 0, 0, NULL }
#define ACL_STATE_INIT { ACL_STATE_NOT_RECORDED, NULL, NULL, 0UL, \
{ { 0, 0 } }, 0, NULL, 0, 0, NULL }
/*
* replog moddn param structure
@ -1221,7 +1239,6 @@ struct slap_backend_db {
* (in previous use there was a flaw with back-bdb and back-ldbm; now it
* is fixed).
*/
#define be_has_subordinates bd_info->bi_has_subordinates
#define be_controls bd_info->bi_controls

View file

@ -45,7 +45,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "slapi" /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "slapi" /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@ -94,7 +94,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "slapi" /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@ -119,7 +119,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "slapi" /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe

View file

@ -22,7 +22,8 @@ struct sindexrec {
};
static Avlnode *syn_index = NULL;
static Syntax *syn_list = NULL;
static LDAP_SLIST_HEAD(SyntaxList, slap_syntax) syn_list
= LDAP_SLIST_HEAD_INITIALIZER(&syn_list);
static int
syn_index_cmp(
@ -59,20 +60,23 @@ syn_find_desc( const char *syndesc, int *len )
{
Syntax *synp;
for (synp = syn_list; synp; synp = synp->ssyn_next)
if ((*len = dscompare( synp->ssyn_syn.syn_desc, syndesc, '{')))
LDAP_SLIST_FOREACH(synp, &syn_list, ssyn_next) {
if ((*len = dscompare( synp->ssyn_syn.syn_desc, syndesc, '{' /*'}'*/ ))) {
return synp;
}
}
return( NULL );
}
void
syn_destroy( void )
{
Syntax *s, *n;
Syntax *s;
avl_free(syn_index, ldap_memfree);
for (s=syn_list; s; s=n) {
n = s->ssyn_next;
while( !LDAP_SLIST_EMPTY(&syn_list) ) {
s = LDAP_SLIST_FIRST(&syn_list);
LDAP_SLIST_REMOVE_HEAD(&syn_list, ssyn_next);
ldap_syntax_free((LDAPSyntax *)s);
}
}
@ -83,15 +87,10 @@ syn_insert(
const char **err
)
{
Syntax **synp;
struct sindexrec *sir;
synp = &syn_list;
while ( *synp != NULL ) {
synp = &(*synp)->ssyn_next;
}
*synp = ssyn;
LDAP_SLIST_INSERT_HEAD( &syn_list, ssyn, ssyn_next );
if ( ssyn->ssyn_oid ) {
sir = (struct sindexrec *)
SLAP_CALLOC( 1, sizeof(struct sindexrec) );
@ -141,7 +140,7 @@ syn_add(
AC_MEMCPY( &ssyn->ssyn_syn, syn, sizeof(LDAPSyntax) );
ssyn->ssyn_next = NULL;
LDAP_SLIST_NEXT(ssyn,ssyn_next) = NULL;
/*
* note: ssyn_bvoid uses the same memory of ssyn_syn.syn_oid;
@ -215,7 +214,7 @@ syn_schema_info( Entry *e )
vals[1].bv_val = NULL;
for ( syn = syn_list; syn; syn = syn->ssyn_next ) {
LDAP_SLIST_FOREACH(syn, &syn_list, ssyn_next ) {
if ( ! syn->ssyn_validate ) {
/* skip syntaxes without validators */
continue;