*
* Modifications:
*
- * - description: make the module use asyncronous calls
+ * - description: make the module use asynchronous calls
* date: Feb 2006
* author: Simo Sorce
*/
struct ildb_private *ildb;
struct ldap_request *ireq;
+ /* indicate we are already processing
+ * the ldap_request in ildb_callback() */
+ bool in_ildb_callback;
+
bool done;
struct ildb_destructor_ctx *dc;
request_done = false;
controls = NULL;
+ /* check if we are already processing this request */
+ if (ac->in_ildb_callback) {
+ return;
+ }
+ /* mark the request as being in process */
+ ac->in_ildb_callback = true;
+
if (!NT_STATUS_IS_OK(req->status)) {
ret = ildb_map_error(ac->module, req->status);
ildb_request_done(ac, NULL, ret);
if (ret != LDB_SUCCESS) {
callback_failed = true;
}
+
break;
case LDAP_TAG_SearchResultReference:
if (ret != LDB_SUCCESS) {
callback_failed = true;
}
+
break;
default:
}
}
+ /* mark the request as not being in progress */
+ ac->in_ildb_callback = false;
+
if (request_done) {
ildb_request_done(ac, controls, ret);
}
+
return;
}
for (i = 0; i < n; i++) {
msg->r.AddRequest.attributes[i] = mods[i]->attrib;
}
+ msg->controls = req->controls;
return ildb_request_send(ac, msg);
}
for (i = 0; i < n; i++) {
msg->r.ModifyRequest.mods[i] = *mods[i];
}
-
+ msg->controls = req->controls;
return ildb_request_send(ac, msg);
}
talloc_free(msg);
return LDB_ERR_INVALID_DN_SYNTAX;
}
+ msg->controls = req->controls;
return ildb_request_send(ac, msg);
}
{
struct ldb_request *req = ac->req;
struct ldap_message *msg;
+ const char *rdn_name;
+ const struct ldb_val *rdn_val;
msg = new_ldap_message(req);
if (msg == NULL) {
return LDB_ERR_INVALID_DN_SYNTAX;
}
- msg->r.ModifyDNRequest.newrdn =
- talloc_asprintf(msg, "%s=%s",
- ldb_dn_get_rdn_name(req->op.rename.newdn),
- ldb_dn_escape_value(msg, *ldb_dn_get_rdn_val(req->op.rename.newdn)));
+ rdn_name = ldb_dn_get_rdn_name(req->op.rename.newdn);
+ rdn_val = ldb_dn_get_rdn_val(req->op.rename.newdn);
+
+ if ((rdn_name != NULL) && (rdn_val != NULL)) {
+ msg->r.ModifyDNRequest.newrdn =
+ talloc_asprintf(msg, "%s=%s", rdn_name,
+ ldb_dn_escape_value(msg, *rdn_val));
+ } else {
+ msg->r.ModifyDNRequest.newrdn = talloc_strdup(msg, "");
+ }
if (msg->r.ModifyDNRequest.newrdn == NULL) {
talloc_free(msg);
return LDB_ERR_OPERATIONS_ERROR;
}
msg->r.ModifyDNRequest.deleteolddn = true;
+ msg->controls = req->controls;
return ildb_request_send(ac, msg);
}
struct loadparm_context *lp_ctx;
module = ldb_module_new(ldb, ldb, "ldb_ildap backend", &ildb_ops);
- if (!module) return -1;
+ if (!module) return LDB_ERR_OPERATIONS_ERROR;
ildb = talloc(module, struct ildb_private);
if (!ildb) {
}
*_module = module;
- return 0;
+ return LDB_SUCCESS;
failed:
talloc_free(module);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
_PUBLIC_ const struct ldb_backend_ops ldb_ldap_backend_ops = {