s4-dsdb: added dsdb_delete() function
authorAndrew Tridgell <tridge@samba.org>
Thu, 14 Jul 2011 03:18:17 +0000 (13:18 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 21 Jul 2011 01:44:36 +0000 (11:44 +1000)
this gives us a delete function that takes the standard set of dsdb
flags

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/dsdb/common/util.c

index 7283405bb368f142d1d00e083a5e88c3cb050ee4..ae2ca74ea730da81dbad6687329a0275cc1dc861 100644 (file)
@@ -3722,6 +3722,36 @@ int dsdb_modify(struct ldb_context *ldb, const struct ldb_message *message,
        return ret;
 }
 
+/*
+  a delete with a set of flags
+*/
+int dsdb_delete(struct ldb_context *ldb, const struct ldb_dn *dn,
+               uint32_t dsdb_flags)
+{
+       struct ldb_request *req;
+       int ret;
+
+       ret = ldb_build_del_req(&req, ldb, ldb,
+                               dn,
+                               NULL,
+                               NULL,
+                               ldb_op_default_callback,
+                               NULL);
+
+       if (ret != LDB_SUCCESS) return ret;
+
+       ret = dsdb_request_add_controls(req, dsdb_flags);
+       if (ret != LDB_SUCCESS) {
+               talloc_free(req);
+               return ret;
+       }
+
+       ret = dsdb_autotransaction_request(ldb, req);
+
+       talloc_free(req);
+       return ret;
+}
+
 /*
   like dsdb_modify() but set all the element flags to
   LDB_FLAG_MOD_REPLACE