int argc,
char **argv )
{
- int rc;
+ int rc = 0;
int i;
slap_mask_t mask;
char **attrs;
fprintf( stderr, "%s: line %d: "
"no indexes specified: %s\n",
fname, lineno, argv[1] );
- return LDAP_PARAM_ERROR;
+ rc = LDAP_PARAM_ERROR;
+ goto done;
}
}
fprintf( stderr, "%s: line %d: "
"index type \"%s\" undefined\n",
fname, lineno, indexes[i] );
- return LDAP_PARAM_ERROR;
+ rc = LDAP_PARAM_ERROR;
+ goto done;
}
mask |= index;
fprintf( stderr, "%s: line %d: "
"no indexes selected\n",
fname, lineno );
- return LDAP_PARAM_ERROR;
+ rc = LDAP_PARAM_ERROR;
+ goto done;
}
for ( i = 0; attrs[i] != NULL; i++ ) {
fprintf( stderr, "%s: line %d: "
"index component reference\"%s\" undefined\n",
fname, lineno, attrs[i] );
- return rc;
+ goto done;
}
cr->cr_indexmask = mask;
/*
} else {
cr = NULL;
}
-#endif
- a = (AttrInfo *) ch_malloc( sizeof(AttrInfo) );
-
-#ifdef LDAP_COMP_MATCH
- a->ai_cr = NULL;
#endif
ad = NULL;
rc = slap_str2ad( attrs[i], &ad, &text );
fprintf( stderr, "%s: line %d: "
"index attribute \"%s\" undefined\n",
fname, lineno, attrs[i] );
- return rc;
+ goto done;
}
if( slap_ad_is_binary( ad ) ) {
fprintf( stderr, "%s: line %d: "
"index of attribute \"%s\" disallowed\n",
fname, lineno, attrs[i] );
- return LDAP_UNWILLING_TO_PERFORM;
+ rc = LDAP_UNWILLING_TO_PERFORM;
+ goto done;
}
if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) && !(
fprintf( stderr, "%s: line %d: "
"approx index of attribute \"%s\" disallowed\n",
fname, lineno, attrs[i] );
- return LDAP_INAPPROPRIATE_MATCHING;
+ rc = LDAP_INAPPROPRIATE_MATCHING;
+ goto done;
}
if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) && !(
fprintf( stderr, "%s: line %d: "
"equality index of attribute \"%s\" disallowed\n",
fname, lineno, attrs[i] );
- return LDAP_INAPPROPRIATE_MATCHING;
+ rc = LDAP_INAPPROPRIATE_MATCHING;
+ goto done;
}
if( IS_SLAP_INDEX( mask, SLAP_INDEX_SUBSTR ) && !(
fprintf( stderr, "%s: line %d: "
"substr index of attribute \"%s\" disallowed\n",
fname, lineno, attrs[i] );
- return LDAP_INAPPROPRIATE_MATCHING;
+ rc = LDAP_INAPPROPRIATE_MATCHING;
+ goto done;
}
Debug( LDAP_DEBUG_CONFIG, "index %s 0x%04lx\n",
ad->ad_cname.bv_val, mask, 0 );
+ a = (AttrInfo *) ch_malloc( sizeof(AttrInfo) );
+
+#ifdef LDAP_COMP_MATCH
+ a->ai_cr = NULL;
+#endif
a->ai_desc = ad;
if ( bdb->bi_flags & BDB_IS_OPEN ) {
rc = insert_component_reference( cr, &a_cr->ai_cr );
if ( rc != LDAP_SUCCESS) {
fprintf( stderr, " error during inserting component reference in %s ", attrs[i]);
- return LDAP_PARAM_ERROR;
+ rc = LDAP_PARAM_ERROR;
+ goto done;
}
continue;
} else {
rc = insert_component_reference( cr, &a->ai_cr );
if ( rc != LDAP_SUCCESS) {
fprintf( stderr, " error during inserting component reference in %s ", attrs[i]);
- return LDAP_PARAM_ERROR;
+ rc = LDAP_PARAM_ERROR;
+ goto done;
}
}
}
"%s: line %d: duplicate index definition for attr \"%s\".\n",
fname, lineno, attrs[i] );
- return LDAP_PARAM_ERROR;
+ rc = LDAP_PARAM_ERROR;
+ goto done;
}
}
+done:
ldap_charray_free( attrs );
if ( indexes != NULL ) ldap_charray_free( indexes );
- return LDAP_SUCCESS;
+ return rc;
}
static int