]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/chain.c
Zero out op2
[openldap] / servers / slapd / back-ldap / chain.c
index 8b79f2ac50f3668bac8281a511f55b13f355d822..2cba84c833adb8002556bd4ebf184bf32dcebb93 100644 (file)
@@ -132,8 +132,8 @@ chaining_control_remove(
         * added by the chain overlay, so it's the only one we explicitly 
         * free */
        if ( op->o_ctrls != oldctrls ) {
-               assert( op->o_ctrls );
-               assert( op->o_ctrls[ 0 ] );
+               assert( op->o_ctrls != NULL );
+               assert( op->o_ctrls[ 0 ] != NULL );
 
                free( op->o_ctrls );
 
@@ -441,43 +441,10 @@ ldap_chain_response( Operation *op, SlapReply *rs )
                }
                break;
        case LDAP_REQ_ADD:
-               {
-               int             cleanup_attrs = 0;
-
-               if ( op->ora_e->e_attrs == NULL ) {
-                       char            textbuf[ SLAP_TEXT_BUFLEN ];
-                       size_t          textlen = sizeof( textbuf );
-
-#if 0
-                       /* FIXME: op->o_bd is still set to the BackendDB 
-                        * structure of the database that tried to handle
-                        * the operation and actually returned a referral
-                        * ... */
-                       assert( SLAP_DBFLAGS( op->o_bd ) & SLAP_DBFLAG_GLOBAL_OVERLAY );
-#endif
-
-                       /* global overlay: create entry */
-                       /* NOTE: this is a hack to use the chain overlay
-                        * as global.  I expect to be able to remove this
-                        * soon by using slap_mods2entry() earlier in
-                        * do_add(), adding the operational attrs later
-                        * if required. */
-                       rs->sr_err = slap_mods2entry( op->ora_modlist,
-                                       &op->ora_e, 0, 1,
-                                       &rs->sr_text, textbuf, textlen );
-                       if ( rs->sr_err != LDAP_SUCCESS ) {
-                               send_ldap_result( op, rs );
-                               rc = 1;
-                               break;
-                       }
-               }
+               /* slap_mods2entry () should be called in do_add() */
+               assert( op->ora_e->e_attrs != NULL );
                rc = ldap_chain_op( op, rs, lback->bi_op_add, ref );
-               if ( cleanup_attrs ) {
-                       attrs_free( op->ora_e->e_attrs );
-                       op->ora_e->e_attrs = NULL;
-               }
                break;
-               }
        case LDAP_REQ_DELETE:
                rc = ldap_chain_op( op, rs, lback->bi_op_delete, ref );
                break;
@@ -679,9 +646,11 @@ enum {
        PC_CHAINING = 1
 };
 
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
 static ConfigDriver chain_cf_gen;
-static ConfigLDAPadd chain_ldadd;
 static ConfigCfAdd chain_cfadd;
+#endif
+static ConfigLDAPadd chain_ldadd;
 
 static ConfigTable chaincfg[] = {
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
@@ -719,6 +688,8 @@ chain_ldadd( CfEntryInfo *p, Entry *e, ConfigArgs *ca )
        return LDAP_SUCCESS;
 }
 
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
+
 static int
 chain_cfadd( Operation *op, SlapReply *rs, Entry *p, ConfigArgs *ca )
 {
@@ -742,7 +713,6 @@ chain_cfadd( Operation *op, SlapReply *rs, Entry *p, ConfigArgs *ca )
        return 0;
 }
 
-#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
 static slap_verbmasks chaining_mode[] = {
        { BER_BVC("referralsRequired"),         LDAP_REFERRALS_REQUIRED },
        { BER_BVC("referralsPreferred"),        LDAP_REFERRALS_PREFERRED },
@@ -750,13 +720,14 @@ static slap_verbmasks chaining_mode[] = {
        { BER_BVC("chainingPreferred"),         LDAP_CHAINING_PREFERRED },
        { BER_BVNULL,                           0 }
 };
-#endif
 
 static int
 chain_cf_gen( ConfigArgs *c )
 {
        slap_overinst   *on = (slap_overinst *)c->bi;
+#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
        ldap_chain_t    *lc = (ldap_chain_t *)on->on_bi.bi_private;
+#endif
 
        int             rc = 0;
 
@@ -935,6 +906,8 @@ chain_cf_gen( ConfigArgs *c )
        return rc;
 }
 
+#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
+
 static int
 ldap_chain_db_config(
        BackendDB       *be,