} 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 ) ) {
};
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(
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
{
assert( at );
- *at = attr_list;
+ *at = LDAP_SLIST_FIRST(&attr_list);
return (*at != NULL);
}
#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;
}
}
#endif
- *at = (*at)->sat_next;
+ *at = LDAP_SLIST_NEXT(*at,sat_next);
return (*at != NULL);
}
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 *)
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 ) {
)
{
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 ) */
#include "slap.h"
#include "slapi.h"
+
int
do_bind(
Connection *conn,
};
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(
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);
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 *)
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;
}
ber_tag_t tag;
ber_len_t len;
int err;
- ValuesReturnFilter *f;
+ ValuesReturnFilter *vrf;
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ENTRY,
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,
#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:
#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:
#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;
}
#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;
}
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;
}
#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;
}
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:
#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
int
get_vrFilter( Connection *conn, BerElement *ber,
- ValuesReturnFilter **f,
+ ValuesReturnFilter **vrf,
const char **text )
{
/*
* matchValue [3] AssertionValue }
*/
- ValuesReturnFilter **new;
+ ValuesReturnFilter **n;
ber_tag_t tag;
ber_len_t len;
char *last;
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,
}
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;
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:
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;
}
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 );
}
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 );
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 );
}
}
- 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 );
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 );
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;
get_substring_vrFilter(
Connection *conn,
BerElement *ber,
- ValuesReturnFilter *f,
+ ValuesReturnFilter *vrf,
const char **text )
{
ber_tag_t tag;
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 ) )
}
/* 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;
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:
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:
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:
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;
}
}
#include "ldap_pvt.h"
-
#include "slap.h"
#include "slapi.h"
#include "lutil.h"
}
#endif
-
#ifdef HAVE_NT_SERVICE_MANAGER
{
int *i;
Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 );
#endif
-
if( serverName == NULL ) {
if ( (serverName = strrchr( argv[0], *LDAP_DIRSEP )) == NULL ) {
serverName = argv[0];
char ***e_flags
)
{
- ValuesReturnFilter *f;
+ ValuesReturnFilter *vrf;
int rc = LDAP_SUCCESS;
#ifdef NEW_LOGGING
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;
#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;
#endif
rc = test_substrings_vrFilter( be, conn, op, a,
- f, e_flags );
+ vrf, e_flags );
if( rc == -1 ) {
return rc;
}
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;
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;
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;
}
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;
}
Connection *conn,
Operation *op,
Attribute *a,
- ValuesReturnFilter *f,
+ ValuesReturnFilter *vrf,
char ***e_flags
)
{
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;
}
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;
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;
}
};
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(
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);
}
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 *)
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 );
}
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 );
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;
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;
/* 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);
}
}
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;
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 ) );
};
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(
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);
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 *)
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 ) {
#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"
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 ) {
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 );
}
}
}
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;
}
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);
#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
#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"
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 */
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)
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
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
/* 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
#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
#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
#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 ). */
#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;
-
- struct slap_valuesreturnfilter *f_next;
+ MatchingRuleAssertion *vrf_un_mra;
+
+#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;
/*
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
* (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
# 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
# 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
# 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
# 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
};
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(
{
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);
}
}
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) );
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;
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;