]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/modify.c
Removed unnecessary definition that is already in core.schema.
[openldap] / servers / slapd / back-ldbm / modify.c
index 8e3b6e7372230e9fdcf985a761e42a1b7b60e395..756ceaeadad79baa87639341284f6576561d5405 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <ac/string.h>
 #include <ac/socket.h>
+#include <ac/time.h>
 
 #include "slap.h"
 #include "back-ldbm.h"
@@ -96,7 +97,7 @@ add_lastmods( Operation *op, LDAPModList **modlist )
  * Juan C. Gomez (gomez@engr.sgi.com) 05/18/99
  */ 
 
-int ldbm_internal_modify(
+int ldbm_modify_internal(
     Backend    *be,
     Connection *conn,
     Operation  *op,
@@ -105,7 +106,7 @@ int ldbm_internal_modify(
     Entry      *e 
 )
 {
-       int             i, err;
+       int err;
        LDAPMod         *mod;
        LDAPModList     *ml;
 
@@ -143,6 +144,20 @@ int ldbm_internal_modify(
                case LDAP_MOD_REPLACE:
                        err = replace_values( e, mod, op->o_ndn );
                        break;
+
+               case LDAP_MOD_SOFTADD:
+                       /* Avoid problems in index_add_mods()
+                        * We need to add index if necessary.
+                        */
+                       mod->mod_op = LDAP_MOD_ADD;
+                       if ( (err = add_values( e, mod, op->o_ndn ))
+                               ==  LDAP_TYPE_OR_VALUE_EXISTS ) {
+                               err = LDAP_SUCCESS;
+                               mod->mod_op = LDAP_MOD_SOFTADD;
+                       }
+                       break;
                }
 
                if ( err != LDAP_SUCCESS ) {
@@ -183,7 +198,7 @@ int ldbm_internal_modify(
 
        return 0;
 
-}/* int ldbm_internal_modify() */
+}/* int ldbm_modify_internal() */
 
 
 int
@@ -198,7 +213,6 @@ ldbm_back_modify(
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
        char            *matched;
        Entry           *e;
-       int             err;
 
        Debug(LDAP_DEBUG_ARGS, "ldbm_back_modify:\n", 0, 0, 0);
 
@@ -213,14 +227,12 @@ ldbm_back_modify(
        }
 
        /* Modify the entry */
-       if ( ldbm_internal_modify( be, conn, op, dn, modlist, e ) != 0 ) {
+       if ( ldbm_modify_internal( be, conn, op, dn, modlist, e ) != 0 ) {
 
                goto error_return;
 
        }
 
-
-
        /* change the entry itself */
        if ( id2entry_add( be, e ) != 0 ) {
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL, NULL );