]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/backglue.c
More system schema checks
[openldap] / servers / slapd / backglue.c
index 222319122c176a0d90be300d575c28122cef8a51..11eca56d1328a55f4d3ecdb3e0a61b2e1694ba29 100644 (file)
@@ -1,7 +1,7 @@
 /* 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
  */
 
@@ -169,7 +169,7 @@ typedef struct glue_state {
        int matchlen;
        char *matched;
        int nrefs;
-       struct berval **refs;
+       BVarray refs;
 } glue_state;
 
 static void
@@ -181,7 +181,7 @@ glue_back_response (
        ber_int_t err,
        const char *matched,
        const char *text,
-       struct berval **ref,
+       BVarray ref,
        const char *resoid,
        struct berval *resdata,
        struct berval *sasldata,
@@ -208,21 +208,21 @@ glue_back_response (
        }
        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;
        }
@@ -235,7 +235,7 @@ glue_back_sresult (
        ber_int_t err,
        const char *matched,
        const char *text,
-       struct berval **refs,
+       BVarray refs,
        LDAPControl **ctrls,
        int nentries
 )
@@ -259,8 +259,8 @@ glue_back_search (
        int slimit,
        int tlimit,
        Filter *filter,
-       const char *filterstr,
-       struct berval **attrs,
+       struct berval *filterstr,
+       AttributeName *attrs,
        int attrsonly
 )
 {
@@ -360,7 +360,7 @@ done:
        if (gs.matched)
                free (gs.matched);
        if (gs.refs)
-               ber_bvecfree(gs.refs);
+               bvarray_free(gs.refs);
        return rc;
 }
 
@@ -575,7 +575,7 @@ glue_back_attribute (
        Entry *target,
        struct berval *ndn,
        AttributeDescription *ad,
-       struct berval ***vals
+       BVarray *vals
 )
 {
        BackendDB *be;
@@ -766,7 +766,7 @@ glue_tool_sync (
        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;
@@ -785,24 +785,27 @@ glue_sub_init( )
         * 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
@@ -811,9 +814,10 @@ glue_sub_init( )
                                 * 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;