/* backglue.c - backend glue routines */
/* $OpenLDAP$ */
/*
- * Copyright 2001 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2001-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
int matchlen;
char *matched;
int nrefs;
- struct berval **refs;
+ BVarray refs;
} glue_state;
static void
ber_int_t err,
const char *matched,
const char *text,
- struct berval **ref,
+ BVarray ref,
const char *resoid,
struct berval *resdata,
struct berval *sasldata,
}
if (ref) {
int i, j, k;
- struct berval **new;
+ BVarray new;
- for (i=0; ref[i]; i++);
+ for (i=0; ref[i].bv_val; i++);
j = gs->nrefs;
if (!j) {
- new = ch_malloc ((i+1)*sizeof(struct berval *));
+ new = ch_malloc ((i+1)*sizeof(struct berval));
} else {
new = ch_realloc(gs->refs,
- (j+i+1)*sizeof(struct berval *));
+ (j+i+1)*sizeof(struct berval));
}
for (k=0; k<i; j++,k++) {
- new[j] = ber_bvdup(ref[k]);
+ ber_dupbv( &new[j], &ref[k] );
}
- new[j] = NULL;
+ new[j].bv_val = NULL;
gs->nrefs = j;
gs->refs = new;
}
ber_int_t err,
const char *matched,
const char *text,
- struct berval **refs,
+ BVarray refs,
LDAPControl **ctrls,
int nentries
)
int slimit,
int tlimit,
Filter *filter,
- const char *filterstr,
- struct berval **attrs,
+ struct berval *filterstr,
+ AttributeName *attrs,
int attrsonly
)
{
if (gs.matched)
free (gs.matched);
if (gs.refs)
- ber_bvecfree(gs.refs);
+ bvarray_free(gs.refs);
return rc;
}
Entry *target,
struct berval *ndn,
AttributeDescription *ad,
- struct berval ***vals
+ BVarray *vals
)
{
BackendDB *be;
int i;
/* just sync everyone */
- for (i = 0; b0->be_nsuffix[i]; i++)
+ for (i = 0; i<gi->nodes; i++)
if (gi->n[i].be->be_sync)
gi->n[i].be->be_sync (gi->n[i].be);
return 0;
* backends and connect them to their superior.
*/
for (i = nBackendDB - 1, b1=&backendDB[i]; cont && i>=0; b1--,i--) {
- if (b1->be_glueflags & SLAP_GLUE_SUBORDINATE) {
+ if (b1->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE) {
/* The last database cannot be a subordinate of noone */
- if (i == nBackendDB - 1)
- b1->be_glueflags ^= SLAP_GLUE_SUBORDINATE;
+ if (i == nBackendDB - 1) {
+ b1->be_flags ^= SLAP_BFLAG_GLUE_SUBORDINATE;
+ }
continue;
}
gi = NULL;
for (j = i-1, be=&backendDB[j]; j>=0; be--,j--) {
- if (!(be->be_glueflags & SLAP_GLUE_SUBORDINATE))
+ if (!(be->be_flags & SLAP_BFLAG_GLUE_SUBORDINATE)) {
continue;
+ }
/* We will only link it once */
- if (be->be_glueflags & SLAP_GLUE_LINKED)
+ if (be->be_flags & SLAP_BFLAG_GLUE_LINKED) {
continue;
- if (!dnIsSuffix(be->be_nsuffix[0],
- b1->be_nsuffix[0]))
+ }
+ if (!dnIsSuffix(be->be_nsuffix[0], b1->be_nsuffix[0])) {
continue;
+ }
cont--;
- be->be_glueflags |= SLAP_GLUE_LINKED;
+ be->be_flags |= SLAP_BFLAG_GLUE_LINKED;
if (gi == NULL) {
/* We create a copy of the superior's be
* structure, pointing to all of its original
* is used whenever we have operations to pass
* down to the real database.
*/
- b1->be_glueflags |= SLAP_GLUE_INSTANCE;
+ b1->be_flags |= SLAP_BFLAG_GLUE_INSTANCE;
gi = (glueinfo *)ch_malloc(sizeof(glueinfo));
- gi->be = (BackendDB *)ch_malloc(sizeof(BackendDB) + sizeof(BackendInfo));
+ gi->be = (BackendDB *)ch_malloc(
+ sizeof(BackendDB) + sizeof(BackendInfo));
bi = (BackendInfo *)(gi->be+1);
*gi->be = *b1;
gi->nodes = 0;