summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-10-31 03:05:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:33 -0500
commitda048ad7cac35f9f1515c5f3e3551b7326b7ef34 (patch)
treec0a39e6b019ceb69c76ee6b5c0ec0f2e636127a8 /source4
parent9bdc1a77f5d80827d1e352d30ff7b322a933dc0e (diff)
downloadsamba-da048ad7cac35f9f1515c5f3e3551b7326b7ef34.tar.gz
samba-da048ad7cac35f9f1515c5f3e3551b7326b7ef34.tar.bz2
samba-da048ad7cac35f9f1515c5f3e3551b7326b7ef34.zip
r11408: fixed the mapping of ldb errors to ldap errors in the ldap server
(This used to be commit 647cb90360d1a790c8da34d48c46737762046e1b)
Diffstat (limited to 'source4')
-rw-r--r--source4/ldap_server/ldap_simple_ldb.c61
1 files changed, 20 insertions, 41 deletions
diff --git a/source4/ldap_server/ldap_simple_ldb.c b/source4/ldap_server/ldap_simple_ldb.c
index 5baa3f92f9..b4e4cf8078 100644
--- a/source4/ldap_server/ldap_simple_ldb.c
+++ b/source4/ldap_server/ldap_simple_ldb.c
@@ -35,6 +35,21 @@
}\
} while(0)
+
+/*
+ map an error code from ldb to ldap
+*/
+static int sldb_map_error(struct ldapsrv_partition *partition, int ldb_ret,
+ const char **errstr)
+{
+ struct ldb_context *samdb = talloc_get_type(partition->private,
+ struct ldb_context);
+ *errstr = ldb_errstring(samdb);
+
+ /* its 1:1 for now */
+ return ldb_ret;
+}
+
/*
connect to the sam database
*/
@@ -219,7 +234,7 @@ reply:
}
static NTSTATUS sldb_Add(struct ldapsrv_partition *partition, struct ldapsrv_call *call,
- struct ldap_AddRequest *r)
+ struct ldap_AddRequest *r)
{
void *local_ctx;
struct ldb_dn *dn;
@@ -293,16 +308,7 @@ reply:
if (result == LDAP_SUCCESS) {
ldb_ret = ldb_add(samdb, msg);
- if (ldb_ret == 0) {
- result = LDAP_SUCCESS;
- errstr = NULL;
- } else {
- /* 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
- */
- result = LDAP_OPERATIONS_ERROR;
- errstr = ldb_errstring(samdb);
- }
+ result = sldb_map_error(partition, ldb_ret, &errstr);
}
add_result = &add_reply->msg->r.AddResponse;
@@ -345,16 +351,7 @@ reply:
if (result == LDAP_SUCCESS) {
ldb_ret = ldb_delete(samdb, dn);
- if (ldb_ret == 0) {
- result = LDAP_SUCCESS;
- errstr = NULL;
- } else {
- /* 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
- */
- result = LDAP_NO_SUCH_OBJECT;
- errstr = ldb_errstring(samdb);
- }
+ result = sldb_map_error(partition, ldb_ret, &errstr);
}
del_result = &del_reply->msg->r.DelResponse;
@@ -455,16 +452,7 @@ reply:
if (result == LDAP_SUCCESS) {
ldb_ret = ldb_modify(samdb, msg);
- if (ldb_ret == 0) {
- result = LDAP_SUCCESS;
- errstr = NULL;
- } else {
- /* 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
- */
- result = LDAP_OPERATIONS_ERROR;
- errstr = ldb_errstring(samdb);
- }
+ result = sldb_map_error(partition, ldb_ret, &errstr);
}
modify_result = &modify_reply->msg->r.AddResponse;
@@ -614,16 +602,7 @@ reply:
if (result == LDAP_SUCCESS) {
ldb_ret = ldb_rename(samdb, olddn, newdn);
- if (ldb_ret == 0) {
- result = LDAP_SUCCESS;
- errstr = NULL;
- } else {
- /* 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
- */
- result = LDAP_NO_SUCH_OBJECT;
- errstr = ldb_errstring(samdb);
- }
+ result = sldb_map_error(partition, ldb_ret, &errstr);
}
modifydn = &modifydn_r->msg->r.ModifyDNResponse;