Browse Source

Bug 741744 - part2 - MOD operations with chained delete/add get back error 53 on backend config

https://bugzilla.redhat.com/show_bug.cgi?id=741744
Resolves: bug 741744
Bug Description: part2 - MOD operations with chained delete/add get back error 53 on backend config
Reviewed by: nhosoi (Thanks!)
Branch: master
Fix Description: If a value was specified with a mod delete, fail the entire
modify operation with LDAP_NO_SUCH_ATTRIBUTE if the specified value does not
match the current value.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson 14 years ago
parent
commit
ede5dec630
1 changed files with 13 additions and 0 deletions
  1. 13 0
      ldap/servers/slapd/back-ldbm/ldbm_config.c

+ 13 - 0
ldap/servers/slapd/back-ldbm/ldbm_config.c

@@ -1637,6 +1637,19 @@ int ldbm_config_set(void *arg, char *attr_name, config_info *config_array, struc
             return LDAP_OBJECT_CLASS_VIOLATION;
         }
     }
+
+    /* if delete, and a specific value was provided to delete, the existing value must
+       match that value, or return LDAP_NO_SUCH_ATTRIBUTE */
+    if (SLAPI_IS_MOD_DELETE(mod_op) && bval && bval->bv_len && bval->bv_val) {
+        char buf[BUFSIZ];
+        ldbm_config_get(arg, config, buf);
+        if (PL_strncmp(buf, bval->bv_val, bval->bv_len)) {
+            PR_snprintf(err_buf, SLAPI_DSE_RETURNTEXT_SIZE,
+                        "value [%s] for attribute %s does not match existing value [%s].\n",
+                        bval->bv_val, attr_name, buf);
+            return LDAP_NO_SUCH_ATTRIBUTE;
+        }
+    }
     
     switch(config->config_type) {
     case CONFIG_TYPE_INT: