s4:ldb - add a check which has to be done on beginning of a "modify" operation
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Wed, 7 Oct 2009 21:49:29 +0000 (23:49 +0200)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Wed, 7 Oct 2009 22:18:06 +0000 (00:18 +0200)
source4/lib/ldb/common/ldb.c

index e9c924583e37c161e44898af3f7cc68949eb92c0..4c27de7cb73477f47160a402dd046806d2ec9467 100644 (file)
@@ -1358,6 +1358,14 @@ int ldb_modify(struct ldb_context *ldb,
                return ret;
        }
 
                return ret;
        }
 
+       if (message->num_elements == 0) {
+               /* this needs also to be returned when the specified object
+                  doesn't exist. Therefore this test is located here. */
+               ldb_asprintf_errstring(ldb, "LDB message has to have elements/attributes (%s)!",
+                                      ldb_dn_get_linearized(message->dn));
+               return LDB_ERR_UNWILLING_TO_PERFORM;
+       }
+
        ret = ldb_build_mod_req(&req, ldb, ldb,
                                        message,
                                        NULL,
        ret = ldb_build_mod_req(&req, ldb, ldb,
                                        message,
                                        NULL,