]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ldb: Don't create error string if there is no error
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 7 Mar 2023 20:23:00 +0000 (09:23 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 22 Mar 2023 18:40:31 +0000 (18:40 +0000)
We should only do this in the LDB_ERR_NO_SUCH_ATTRIBUTE case.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ldb_key_value/ldb_kv.c

index aea6f0c1be0df4823f7ae06684ff71a093a6239b..4c153b21c3190b8dd52e5f22b87b9d244c331833 100644 (file)
@@ -1289,13 +1289,14 @@ int ldb_kv_modify_internal(struct ldb_module *module,
                                    ldb_kv,
                                    msg2,
                                    msg->elements[i].name);
-                               if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&
-                                   control_permissive) {
-                                       ret = LDB_SUCCESS;
-                               } else {
-                                       ldb_asprintf_errstring(ldb,
-                                                              "attribute '%s': no such attribute for delete on '%s'",
-                                                              msg->elements[i].name, dn);
+                               if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE) {
+                                       if (control_permissive) {
+                                               ret = LDB_SUCCESS;
+                                       } else {
+                                               ldb_asprintf_errstring(ldb,
+                                                                      "attribute '%s': no such attribute for delete on '%s'",
+                                                                      msg->elements[i].name, dn);
+                                       }
                                }
                                if (ret != LDB_SUCCESS) {
                                        goto done;