svn commit: samba r20852 - in branches/SAMBA_4_0/source/lib/ldb:
common include
metze at samba.org
metze at samba.org
Wed Jan 17 16:10:33 GMT 2007
Author: metze
Date: 2007-01-17 16:10:33 +0000 (Wed, 17 Jan 2007)
New Revision: 20852
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20852
Log:
add a function to add a ldb control to a ldb_request
metze
Modified:
branches/SAMBA_4_0/source/lib/ldb/common/ldb_controls.c
branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_controls.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_controls.c 2007-01-17 15:47:36 UTC (rev 20851)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_controls.c 2007-01-17 16:10:33 UTC (rev 20852)
@@ -104,3 +104,31 @@
return 0;
}
+
+int ldb_request_add_control(struct ldb_request *req, const char *oid, bool critical, void *data)
+{
+ unsigned n;
+ struct ldb_control **ctrls;
+ struct ldb_control *ctrl;
+
+ for (n=0; req->controls && req->controls[n];) { n++; }
+
+ ctrls = talloc_realloc(req, req->controls,
+ struct ldb_control *,
+ n + 2);
+ if (!ctrls) return LDB_ERR_OPERATIONS_ERROR;
+ req->controls = ctrls;
+ ctrls[n] = NULL;
+ ctrls[n+1] = NULL;
+
+ ctrl = talloc(ctrls, struct ldb_control);
+ if (!ctrl) return LDB_ERR_OPERATIONS_ERROR;
+
+ ctrl->oid = talloc_strdup(ctrl, oid);
+ if (!ctrl->oid) return LDB_ERR_OPERATIONS_ERROR;
+ ctrl->critical = critical;
+ ctrl->data = data;
+
+ ctrls[n] = ctrl;
+ return LDB_SUCCESS;
+}
Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2007-01-17 15:47:36 UTC (rev 20851)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h 2007-01-17 16:10:33 UTC (rev 20852)
@@ -990,6 +990,18 @@
ldb_request_callback_t callback);
/**
+ Add a ldb_control to a ldb_request
+
+ \param req the request struct where to add the control
+ \param oid the object identifier of the control as string
+ \param ciritical whether the control should be critical or not
+ \param data a talloc pointer to the control specific data
+
+ \return result code (LDB_SUCCESS on success, or a failure code)
+*/
+int ldb_request_add_control(struct ldb_request *req, const char *oid, bool critical, void *data);
+
+/**
Search the database
This function searches the database, and returns
More information about the samba-cvs
mailing list