]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/translucent.c
check for ee == NULL
[openldap] / servers / slapd / overlays / translucent.c
index c94d04b00a055238a7be084640094be6a53f9073..db9079692f43fe09b21a1c796b98a66a0eb09c9f 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2004-2006 The OpenLDAP Foundation.
+ * Copyright 2004-2007 The OpenLDAP Foundation.
  * Portions Copyright 2005 Symas Corporation.
  * All rights reserved.
  *
@@ -103,9 +103,9 @@ translucent_cfadd( Operation *op, SlapReply *rs, Entry *e, ConfigArgs *ca )
        Debug(LDAP_DEBUG_TRACE, "==> translucent_cfadd\n", 0, 0, 0);
 
        /* FIXME: should not hardcode "olcDatabase" here */
-       bv.bv_len = sprintf( ca->msg, "olcDatabase=%s",
+       bv.bv_len = sprintf( ca->cr_msg, "olcDatabase=%s",
                             ov->db.bd_info->bi_type );
-       bv.bv_val = ca->msg;
+       bv.bv_val = ca->cr_msg;
        ca->be = &ov->db;
 
        /* We can only create this entry if the database is table-driven
@@ -147,6 +147,7 @@ void glue_parent(Operation *op) {
        ber_dupbv(&e->e_nname, &ndn);
 
        a = attr_alloc( slap_schema.si_ad_objectClass );
+       a->a_numvals = 2;
        a->a_vals = ch_malloc(sizeof(struct berval) * 3);
        ber_dupbv(&a->a_vals[0], &glue[0]);
        ber_dupbv(&a->a_vals[1], &glue[1]);
@@ -156,6 +157,7 @@ void glue_parent(Operation *op) {
        e->e_attrs = a;
 
        a = attr_alloc( slap_schema.si_ad_structuralObjectClass );
+       a->a_numvals = 1;
        a->a_vals = ch_malloc(sizeof(struct berval) * 2);
        ber_dupbv(&a->a_vals[0], &glue[1]);
        ber_dupbv(&a->a_vals[1], &glue[2]);
@@ -428,6 +430,8 @@ release:
                atmp.a_desc = m->sml_desc;
                atmp.a_vals = m->sml_values;
                atmp.a_nvals = m->sml_nvalues ? m->sml_nvalues : atmp.a_vals;
+               atmp.a_numvals = m->sml_numvals;
+               atmp.a_flags = 0;
                a = attr_dup( &atmp );
                a->a_next  = ax;
                ax = a;
@@ -686,10 +690,9 @@ static int translucent_db_config(
 **
 */
 
-static int translucent_db_init(BackendDB *be) {
+static int translucent_db_init(BackendDB *be, ConfigReply *cr) {
        slap_overinst *on = (slap_overinst *) be->bd_info;
        translucent_info *ov;
-       int rc;
 
        Debug(LDAP_DEBUG_TRACE, "==> translucent_db_init\n", 0, 0, 0);
 
@@ -699,7 +702,7 @@ static int translucent_db_init(BackendDB *be) {
        ov->db.be_private = NULL;
        ov->db.be_pcl_mutexp = &ov->db.be_pcl_mutex;
 
-       if ( !backend_db_init( "ldap", &ov->db )) {
+       if ( !backend_db_init( "ldap", &ov->db, -1, NULL )) {
                Debug( LDAP_DEBUG_CONFIG, "translucent: unable to open captive back-ldap\n", 0, 0, 0);
                return 1;
        }
@@ -715,7 +718,7 @@ static int translucent_db_init(BackendDB *be) {
 **
 */
 
-static int translucent_db_open(BackendDB *be) {
+static int translucent_db_open(BackendDB *be, ConfigReply *cr) {
        slap_overinst *on = (slap_overinst *) be->bd_info;
        translucent_info *ov = on->on_bi.bi_private;
        int rc;
@@ -728,7 +731,7 @@ static int translucent_db_open(BackendDB *be) {
        ov->db.be_acl = be->be_acl;
        ov->db.be_dfltaccess = be->be_dfltaccess;
 
-       rc = backend_startup_one( &ov->db );
+       rc = backend_startup_one( &ov->db, NULL );
 
        if(rc) Debug(LDAP_DEBUG_TRACE,
                "translucent: bi_db_open() returned error %d\n", rc, 0, 0);
@@ -744,7 +747,7 @@ static int translucent_db_open(BackendDB *be) {
 */
 
 static int
-translucent_db_close( BackendDB *be )
+translucent_db_close( BackendDB *be, ConfigReply *cr )
 {
        slap_overinst *on = (slap_overinst *) be->bd_info;
        translucent_info *ov = on->on_bi.bi_private;
@@ -753,7 +756,7 @@ translucent_db_close( BackendDB *be )
        Debug(LDAP_DEBUG_TRACE, "==> translucent_db_close\n", 0, 0, 0);
 
        if ( ov && ov->db.bd_info && ov->db.bd_info->bi_db_close ) {
-               rc = ov->db.bd_info->bi_db_close(&ov->db);
+               rc = ov->db.bd_info->bi_db_close(&ov->db, NULL);
        }
 
        return(rc);
@@ -766,13 +769,13 @@ translucent_db_close( BackendDB *be )
 */
 
 static int
-translucent_db_destroy( BackendDB *be )
+translucent_db_destroy( BackendDB *be, ConfigReply *cr )
 {
        slap_overinst *on = (slap_overinst *) be->bd_info;
        translucent_info *ov = on->on_bi.bi_private;
        int rc = 0;
 
-       Debug(LDAP_DEBUG_TRACE, "==> translucent_db_close\n", 0, 0, 0);
+       Debug(LDAP_DEBUG_TRACE, "==> translucent_db_destroy\n", 0, 0, 0);
 
        if ( ov ) {
                if ( ov->db.be_private != NULL ) {