list = *listp;
if ( !list ) {
size = 2;
- list = calloc(size, sizeof(AttributeType *));
+ list = ch_calloc(size, sizeof(AttributeType *));
if ( !list ) {
return -1;
}
list1++;
}
size += 2;
- list1 = realloc(list, size*sizeof(AttributeType *));
+ list1 = ch_realloc(list, size*sizeof(AttributeType *));
if ( !list1 ) {
return -1;
}
}
list[i] = NULL;
/* Tell the runtime this can be shrinked */
- list1 = realloc(list, (i+1)*sizeof(AttributeType **));
+ list1 = ch_realloc(list, (i+1)*sizeof(AttributeType **));
if ( !list1 ) {
return -1;
}
return -1;
}
+void
+at_destroy( void )
+{
+ AttributeType *a, *n;
+ avl_free(attr_index, ldap_memfree);
+
+ for (a=attr_list; a; a=n) {
+ n = a->sat_next;
+ ldap_memfree(a->sat_subtypes);
+ ad_destroy(a->sat_ad);
+ ldap_pvt_thread_mutex_destroy(&a->sat_ad_mutex);
+ ldap_attributetype_free((LDAPAttributeType *)a);
+ }
+}
+
static int
at_insert(
AttributeType *sat,
while ( *names ) {
air = (struct aindexrec *)
ch_calloc( 1, sizeof(struct aindexrec) );
- air->air_name = ch_strdup(*names);
+ air->air_name = *names;
air->air_at = sat;
if ( avl_insert( &attr_index, (caddr_t) air,
(AVL_CMP) attr_index_cmp,
(AVL_DUP) avl_dup_error ) ) {
*err = *names;
- ldap_memfree(air->air_name);
ldap_memfree(air);
return SLAP_SCHERR_DUP_ATTR;
}
char *cname;
if ( at->at_names && at->at_names[0] ) {
+ int i;
+
+ for( i=0; at->at_names[i]; i++ ) {
+ if( !slap_valid_descr( at->at_names[i] ) ) {
+ return SLAP_SCHERR_BAD_DESCR;
+ }
+ }
+
cname = at->at_names[0];
+
} else if ( at->at_oid ) {
cname = at->at_oid;
} else {
- cname = "";
return SLAP_SCHERR_ATTR_INCOMPLETE;
}
+
+ if ( at->at_collective ) {
+ return SLAP_SCHERR_NOT_SUPPORTED;
+ }
+
sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
AC_MEMCPY( &sat->sat_atype, at, sizeof(LDAPAttributeType));
- sat->sat_cname = cname;
+ sat->sat_cname.bv_val = cname;
+ sat->sat_cname.bv_len = strlen( cname );
+ ldap_pvt_thread_mutex_init(&sat->sat_ad_mutex);
if ( at->at_sup_oid ) {
AttributeType *supsat = at_find(at->at_sup_oid);
if ( sat->sat_sup ) {
sat->sat_syntax = sat->sat_sup->sat_syntax;
sat->sat_equality = sat->sat_sup->sat_equality;
+ sat->sat_approx = sat->sat_sup->sat_approx;
sat->sat_ordering = sat->sat_sup->sat_ordering;
sat->sat_substr = sat->sat_sup->sat_substr;
}