Logo Search packages:      
Sourcecode: ldb version File versions  Download package

int ldb_build_search_req ( struct ldb_request **  ret_req,
struct ldb_context *  ldb,
void *  mem_ctx,
struct ldb_dn *  base,
enum ldb_scope  scope,
const char *  expression,
const char *const *  attrs,
struct ldb_control **  controls,
void *  context,
ldb_request_callback_t  callback 

Helper function to build a search request

ret_req the request structure is returned here (talloced on mem_ctx)
ldb the context associated with the database (from ldb_init())
mem_ctx a talloc emmory context (used as parent of ret_req)
base the Base Distinguished Name for the query (use ldb_dn_new() for an empty one)
scope the search scope for the query
expression the search expression to use for this query
attrs the search attributes for the query (pass NULL if none required)
controls an array of controls
context the callback function context
the callback function to handle the async replies
result code (LDB_SUCCESS on success, or a failure code)

Definition at line 631 of file ldb.c.


      struct ldb_request *req;

      *ret_req = NULL;

      req = talloc(mem_ctx, struct ldb_request);
      if (req == NULL) {
            ldb_set_errstring(ldb, "Out of Memory");
            return LDB_ERR_OPERATIONS_ERROR;

      req->operation = LDB_SEARCH;
      if (base == NULL) {
            req->op.search.base = ldb_dn_new(req, ldb, NULL);
      } else {
            req->op.search.base = base;
      req->op.search.scope = scope;

      req->op.search.tree = ldb_parse_tree(req, expression);
      if (req->op.search.tree == NULL) {
            ldb_set_errstring(ldb, "Unable to parse search expression");
            return LDB_ERR_OPERATIONS_ERROR;

      req->op.search.attrs = attrs;
      req->controls = controls;
      req->context = context;
      req->callback = callback;

      *ret_req = req;
      return LDB_SUCCESS;

Generated by  Doxygen 1.6.0   Back to index