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

int ldb_request_add_control ( struct ldb_request *  req,
const char *  oid,
bool  critical,
void *  data 
)

Add a ldb_control to a ldb_request

Parameters:
req the request struct where to add the control
oid the object identifier of the control as string
ciritical whether the control should be critical or not
data a talloc pointer to the control specific data
Returns:
result code (LDB_SUCCESS on success, or a failure code)

Definition at line 107 of file ldb_controls.c.

References LDB_ERR_OPERATIONS_ERROR, and LDB_SUCCESS.

{
      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;
}


Generated by  Doxygen 1.6.0   Back to index