s4:dsdb/common/util.c - add a function "dsdb_add"
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 5 Aug 2010 19:58:57 +0000 (21:58 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sat, 7 Aug 2010 12:22:41 +0000 (14:22 +0200)
source4/dsdb/common/util.c

index b8d72781f618629307c444908d82c2f89ca3d3fc..52ba81d975d0d6ea15d387f3eb5d38dfd6c13df4 100644 (file)
@@ -3527,6 +3527,36 @@ int dsdb_request_add_controls(struct ldb_request *req, uint32_t dsdb_flags)
        return LDB_SUCCESS;
 }
 
+/*
+  an add with a set of controls
+*/
+int dsdb_add(struct ldb_context *ldb, const struct ldb_message *message,
+            uint32_t dsdb_flags)
+{
+       struct ldb_request *req;
+       int ret;
+
+       ret = ldb_build_add_req(&req, ldb, ldb,
+                               message,
+                               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;
+}
+
 /*
   a modify with a set of controls
 */