Merge branch 'master' of ssh://git.samba.org/data/git/abartlet/samba into extended...
[abartlet/samba.git/.git] / source4 / lib / ldb / common / ldb_controls.c
index e3f8551407a393042af393f3886c95f52857f910..6fad5012b699527c15f199525512fe556e73d07a 100644 (file)
@@ -53,6 +53,26 @@ struct ldb_control *ldb_request_get_control(struct ldb_request *req, const char
        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)
+{
+       int i;
+
+       /* check if there's a paged request control */
+       if (rep->controls != NULL) {
+               for (i = 0; rep->controls[i]; i++) {
+                       if (strcmp(oid, rep->controls[i]->oid) == 0) {
+                               break;
+                       }
+               }
+
+               return rep->controls[i];
+       }
+
+       return NULL;
+}
+
 /* saves the current controls list into the "saver" and replace the one in req with a new one excluding
 the "exclude" control */
 /* returns False on error */