-/*
+/*
ldb database library - ildap backend
Copyright (C) Andrew Tridgell 2005
- Copyright (C) Simo Sorce 2006
+ Copyright (C) Simo Sorce 2008
** NOTE! The following LGPL license applies to the ldb
** library. This does NOT imply that all of Samba is released
** under the LGPL
-
+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
ready for ildap_add() or ildap_modify()
*/
static struct ldap_mod **ildb_msg_to_mods(void *mem_ctx, int *num_mods,
- const struct ldb_message *msg, int use_flags)
+ const struct ldb_message *msg,
+ int use_flags)
{
struct ldap_mod **mods;
unsigned int i;
ldb_oom(ildb->module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- ldb_set_errstring(ildb->module->ldb, ldap_errstr(ildb->ldap, mem_ctx, status));
+ ldb_set_errstring(ildb->module->ldb,
+ ldap_errstr(ildb->ldap, mem_ctx, status));
talloc_free(mem_ctx);
if (NT_STATUS_IS_LDAP(status)) {
return NT_STATUS_LDAP_CODE(status);
return LDB_ERR_OPERATIONS_ERROR;
}
-static void ildb_request_timeout(struct event_context *ev, struct timed_event *te,
+static void ildb_request_timeout(struct event_context *ev,
+ struct timed_event *te,
struct timeval t, void *private_data)
{
- struct ildb_context *ac = talloc_get_type(private_data, struct ildb_context);
+ struct ildb_context *ac;
struct ldb_handle *handle = ac->handle;
+ ac = talloc_get_type(private_data, struct ildb_context);
+
if (ac->req->state == LDAP_REQUEST_PENDING) {
DLIST_REMOVE(ac->req->conn->pending, ac->req);
}
static void ildb_callback(struct ldap_request *req)
{
- struct ildb_context *ac = talloc_get_type(req->async.private_data, struct ildb_context);
+ struct ildb_context *ac;
struct ldb_handle *handle = ac->handle;
struct ildb_private *ildb = ac->ildb;
NTSTATUS status;
int i;
+ ac =talloc_get_type(req->async.private_data, struct ildb_context);
handle->status = LDB_SUCCESS;
if (!NT_STATUS_IS_OK(req->status)) {
if (req->num_replies < 1) {
handle->status = LDB_ERR_OPERATIONS_ERROR;
return;
- }
-
+ }
+
switch (req->type) {
case LDAP_TAG_ModifyRequest:
handle->status = ildb_map_error(ildb, status);
return;
}
-
+
ares->controls = talloc_move(ares, &msg->controls);
if (msg->r.SearchResultDone.resultcode) {
if (msg->r.SearchResultDone.errormessage) {
}
search = &(msg->r.SearchResultEntry);
-
+
ares->message->dn = ldb_dn_new(ares->message, ac->ildb->module->ldb, search->dn);
if ( ! ldb_dn_validate(ares->message->dn)) {
handle->status = LDB_ERR_OPERATIONS_ERROR;
case LDAP_TAG_SearchResultReference:
ares->referral = talloc_strdup(ares, msg->r.SearchResultReference.referral);
-
+
handle->status = LDB_SUCCESS;
handle->state = LDB_ASYNC_PENDING;
ares->type = LDB_REPLY_REFERRAL;
req->num_replies = 0;
break;
-
+
default:
handle->status = LDB_ERR_PROTOCOL_ERROR;
return;
struct ldap_request *req;
if (!ildb_ac) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return LDB_ERR_OPERATIONS_ERROR;
}
req = ldap_request_send(ildb->ldap, msg);
int ret = LDB_SUCCESS;
if (!ildb_ac) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return LDB_ERR_OPERATIONS_ERROR;
}
if (ildb_ac->callback) {
ldb_set_errstring(module->ldb, "Async interface called with NULL callback function or NULL context");
return LDB_ERR_OPERATIONS_ERROR;
}
-
+
if (req->op.search.tree == NULL) {
ldb_set_errstring(module->ldb, "Invalid expression parse tree");
return LDB_ERR_OPERATIONS_ERROR;
} else {
msg->r.SearchRequest.scope = req->op.search.scope;
}
-
+
msg->r.SearchRequest.deref = LDAP_DEREFERENCE_NEVER;
msg->r.SearchRequest.timelimit = 0;
msg->r.SearchRequest.sizelimit = 0;
msg->r.SearchRequest.attributesonly = 0;
msg->r.SearchRequest.tree = discard_const(req->op.search.tree);
-
+
for (n = 0; req->op.search.attrs && req->op.search.attrs[n]; n++) /* noop */ ;
msg->r.SearchRequest.num_attributes = n;
msg->r.SearchRequest.attributes = discard_const(req->op.search.attrs);
}
msg->type = LDAP_TAG_DelRequest;
-
+
msg->r.DelRequest.dn = ldb_dn_alloc_linearized(msg, req->op.del.dn);
if (msg->r.DelRequest.dn == NULL) {
talloc_free(msg);
return LDB_ERR_INVALID_DN_SYNTAX;
}
- msg->r.ModifyDNRequest.newrdn =
+ 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)));
default:
return LDB_ERR_OPERATIONS_ERROR;
}
-
+
return handle->status;
}
/*
connect to the database
*/
-static int ildb_connect(struct ldb_context *ldb, const char *url,
+static int ildb_connect(struct ldb_context *ldb, const char *url,
unsigned int flags, const char *options[],
struct ldb_module **_module)
{