svn commit: samba r11408 - in
branches/SAMBA_4_0/source/ldap_server: .
tridge at samba.org
tridge at samba.org
Mon Oct 31 03:05:28 GMT 2005
Author: tridge
Date: 2005-10-31 03:05:26 +0000 (Mon, 31 Oct 2005)
New Revision: 11408
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11408
Log:
fixed the mapping of ldb errors to ldap errors in the ldap server
Modified:
branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c
Changeset:
Modified: branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c
===================================================================
--- branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c 2005-10-31 03:03:32 UTC (rev 11407)
+++ branches/SAMBA_4_0/source/ldap_server/ldap_simple_ldb.c 2005-10-31 03:05:26 UTC (rev 11408)
@@ -35,7 +35,22 @@
}\
} 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
*/
NTSTATUS sldb_Init(struct ldapsrv_partition *partition, struct ldapsrv_connection *conn)
@@ -219,7 +234,7 @@
}
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 @@
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 @@
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 @@
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 @@
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;
More information about the samba-cvs
mailing list