summaryrefslogtreecommitdiff
path: root/source4/ldap_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/ldap_server')
-rw-r--r--source4/ldap_server/ldap_server.c14
-rw-r--r--source4/ldap_server/ldap_server.h2
-rw-r--r--source4/ldap_server/ldap_simple_ldb.c45
3 files changed, 52 insertions, 9 deletions
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
index 1aaaf8e066..b59a884442 100644
--- a/source4/ldap_server/ldap_server.c
+++ b/source4/ldap_server/ldap_server.c
@@ -330,21 +330,21 @@ static NTSTATUS ldapsrv_AddRequest(struct ldapsrv_call *call)
return part->ops->Add(part, call, req);
}
-static NTSTATUS ldapsrv_DelRequest(struct ldapsrv_call *call)
+static NTSTATUS ldapsrv_DeleteRequest(struct ldapsrv_call *call)
{
- struct ldap_DelRequest *req = &call->request.r.DelRequest;
+ struct ldap_DeleteRequest *req = &call->request.r.DeleteRequest;
struct ldapsrv_partition *part;
- DEBUG(10, ("DelRequest"));
+ DEBUG(10, ("DeleteRequest"));
DEBUGADD(10, (" dn: %s", req->dn));
part = ldapsrv_get_partition(call->conn, req->dn);
- if (!part->ops->Del) {
+ if (!part->ops->Delete) {
return ldapsrv_unwilling(call, 53);
}
- return part->ops->Del(part, call, req);
+ return part->ops->Delete(part, call, req);
}
static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
@@ -419,8 +419,8 @@ static NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
return ldapsrv_ModifyRequest(call);
case LDAP_TAG_AddRequest:
return ldapsrv_AddRequest(call);
- case LDAP_TAG_DelRequest:
- return ldapsrv_DelRequest(call);
+ case LDAP_TAG_DeleteRequest:
+ return ldapsrv_DeleteRequest(call);
case LDAP_TAG_ModifyDNRequest:
return ldapsrv_ModifyDNRequest(call);
case LDAP_TAG_CompareRequest:
diff --git a/source4/ldap_server/ldap_server.h b/source4/ldap_server/ldap_server.h
index 6ae9cb42d3..591aa3affe 100644
--- a/source4/ldap_server/ldap_server.h
+++ b/source4/ldap_server/ldap_server.h
@@ -82,7 +82,7 @@ struct ldapsrv_partition_ops {
NTSTATUS (*Search)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_SearchRequest *r);
NTSTATUS (*Modify)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_ModifyRequest *r);
NTSTATUS (*Add)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_AddRequest *r);
- NTSTATUS (*Del)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_DelRequest *r);
+ NTSTATUS (*Delete)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_DeleteRequest *r);
NTSTATUS (*ModifyDN)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_ModifyDNRequest *r);
NTSTATUS (*Compare)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_CompareRequest *r);
NTSTATUS (*Abandon)(struct ldapsrv_partition *partition, struct ldapsrv_call *call, struct ldap_AbandonRequest *r);
diff --git a/source4/ldap_server/ldap_simple_ldb.c b/source4/ldap_server/ldap_simple_ldb.c
index d45b8fa055..c7ebd0b237 100644
--- a/source4/ldap_server/ldap_simple_ldb.c
+++ b/source4/ldap_server/ldap_simple_ldb.c
@@ -138,8 +138,51 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
return ldapsrv_queue_reply(call, done_r);
}
+static NTSTATUS sldb_Delete(struct ldapsrv_partition *partition, struct ldapsrv_call *call,
+ struct ldap_DeleteRequest *r)
+{
+ struct ldap_Result *delete_result;
+ struct ldapsrv_reply *delete_reply;
+ int ldb_ret;
+ struct samdb_context *samdb;
+ struct ldb_context *ldb;
+
+ DEBUG(0, ("sldb_Delete: %s\n", r->dn));
+
+ samdb = samdb_connect(call);
+ ldb = samdb->ldb;
+
+ ldb_set_alloc(ldb, talloc_ldb_alloc, samdb);
+ ldb_ret = ldb_delete(ldb, r->dn);
+
+ delete_reply = ldapsrv_init_reply(call, LDAP_TAG_DeleteResponse);
+
+ delete_result = &delete_reply->msg.r.DeleteResponse;
+ delete_result->dn = talloc_steal(delete_reply, r->dn);
+
+ if (ldb_ret != 0) {
+ /* currently we have no way to tell if there was an internal ldb error
+ * or if the object was not found, return the most probable error
+ */
+ delete_result->resultcode = LDAP_NO_SUCH_OBJECT;
+ delete_result->errormessage = ldb_errstring(ldb);
+ delete_result->referral = NULL;
+ } else {
+ delete_result->resultcode = LDAP_SUCCESS;
+ delete_result->errormessage = NULL;
+ delete_result->referral = NULL;
+ }
+
+ ldapsrv_queue_reply(call, delete_reply);
+
+ talloc_free(samdb);
+
+ return NT_STATUS_OK;
+}
+
static const struct ldapsrv_partition_ops sldb_ops = {
- .Search = sldb_Search
+ .Search = sldb_Search,
+ .Delete = sldb_Delete
};
const struct ldapsrv_partition_ops *ldapsrv_get_sldb_partition_ops(void)