ldb_connect: int (struct ldb_context *, const char *, unsigned int, const char **)
ldb_control_to_string: char *(TALLOC_CTX *, const struct ldb_control *)
ldb_controls_except_specified: struct ldb_control **(struct ldb_control **, TALLOC_CTX *, struct ldb_control *)
+ldb_controls_get_control: struct ldb_control *(struct ldb_control **, const char *)
ldb_debug: void (struct ldb_context *, enum ldb_debug_level, const char *, ...)
ldb_debug_add: void (struct ldb_context *, const char *, ...)
ldb_debug_end: void (struct ldb_context *, enum ldb_debug_level)
/* check if a control with the specified "oid" exist and return it */
/* returns NULL if not found */
-struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char *oid)
+struct ldb_control *ldb_controls_get_control(struct ldb_control **controls, const char *oid)
{
unsigned int i;
- if (req->controls != NULL) {
- for (i = 0; req->controls[i]; i++) {
- if (req->controls[i]->oid && strcmp(oid, req->controls[i]->oid) == 0) {
+ if (controls != NULL) {
+ for (i = 0; controls[i]; i++) {
+ if (controls[i]->oid && strcmp(oid, controls[i]->oid) == 0) {
break;
}
}
- return req->controls[i];
+ return controls[i];
}
return NULL;
/* check if a control with the specified "oid" exist and return it */
/* returns NULL if not found */
-struct ldb_control *ldb_reply_get_control(struct ldb_reply *rep, const char *oid)
+struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char *oid)
{
- unsigned int i;
-
- if (rep->controls != NULL) {
- for (i = 0; rep->controls[i]; i++) {
- if (rep->controls[i]->oid && strcmp(oid, rep->controls[i]->oid) == 0) {
- break;
- }
- }
-
- return rep->controls[i];
- }
+ return ldb_controls_get_control(req->controls, oid);
+}
- return NULL;
+/* check if a control with the specified "oid" exist and return it */
+/* returns NULL if not found */
+struct ldb_control *ldb_reply_get_control(struct ldb_reply *rep, const char *oid)
+{
+ return ldb_controls_get_control(rep->controls, oid);
}
/*
*/
int ldb_request_replace_control(struct ldb_request *req, const char *oid, bool critical, void *data);
+/**
+ check if a control with the specified "oid" exist and return it
+ \param controls the array of controls
+ \param oid the object identifier of the control as string
+
+ \return the control, NULL if not found
+*/
+struct ldb_control *ldb_controls_get_control(struct ldb_control **controls, const char *oid);
+
/**
check if a control with the specified "oid" exist and return it
\param req the request struct to search for the control