[SCM] Samba Shared Repository - branch master updated

Nadezhda Ivanova nivanova at samba.org
Tue Dec 15 11:29:52 MST 2009


The branch, master has been updated
       via  4330efe... Removed ldb_modify_ctrl from ldb, implemented as a static in ldap_backend.
      from  b85f6f6... s4 torture: Add new RAW-SEARCH test to explore strange max count behavior

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 4330efe0f22b7318058867a554222c3c0049f644
Author: Nadezhda Ivanova <nadezhda.ivanova at postpath.com>
Date:   Tue Dec 15 20:29:20 2009 +0200

    Removed ldb_modify_ctrl from ldb, implemented as a static in ldap_backend.

-----------------------------------------------------------------------

Summary of changes:
 source4/ldap_server/ldap_backend.c |   44 +++++++++++++++++++++++++++++++++++-
 source4/lib/ldb/common/ldb.c       |   17 +++----------
 source4/lib/ldb/include/ldb.h      |   18 --------------
 3 files changed, 47 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 5eabda9..d983a54 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -171,6 +171,48 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err,
 	/* result is 1:1 for now */
 	return ldb_err;
 }
+/* create and execute a modify request */
+static int ldb_mod_req_with_controls(struct ldb_context *ldb,
+				     const struct ldb_message *message,
+				     struct ldb_control **controls)
+{
+	struct ldb_request *req;
+	int ret;
+
+	ret = ldb_msg_sanity_check(ldb, message);
+	if (ret != LDB_SUCCESS) {
+		return ret;
+	}
+
+	ret = ldb_build_mod_req(&req, ldb, ldb,
+					message,
+					controls,
+					NULL,
+					ldb_op_default_callback,
+					NULL);
+
+	if (ret != LDB_SUCCESS) {
+		return ret;
+	}
+
+	ret = ldb_transaction_start(ldb);
+	if (ret != LDB_SUCCESS) {
+		return ret;
+	}
+
+	ret = ldb_request(ldb, req);
+	if (ret == LDB_SUCCESS) {
+		ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+	}
+
+	if (ret == LDB_SUCCESS) {
+		return ldb_transaction_commit(ldb);
+	}
+	ldb_transaction_cancel(ldb);
+
+	talloc_free(req);
+	return ret;
+}
 
 /*
   connect to the sam database
@@ -546,7 +588,7 @@ reply:
 	NT_STATUS_HAVE_NO_MEMORY(modify_reply);
 
 	if (result == LDAP_SUCCESS) {
-		ldb_ret = ldb_modify_ctrl(samdb, msg, call->request->controls);
+		ldb_ret = ldb_mod_req_with_controls(samdb, msg, call->request->controls);
 		result = map_ldb_error(local_ctx, ldb_ret, &errstr);
 	}
 
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 94a5fb2..a3472a6 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -1388,11 +1388,10 @@ int ldb_add(struct ldb_context *ldb,
 }
 
 /*
-  same as ldb_modify, but accepts controls
+  modify the specified attributes of a record
 */
-int ldb_modify_ctrl(struct ldb_context *ldb,
-		    const struct ldb_message *message,
-		    struct ldb_control **controls)
+int ldb_modify(struct ldb_context *ldb,
+	       const struct ldb_message *message)
 {
 	struct ldb_request *req;
 	int ret;
@@ -1404,7 +1403,7 @@ int ldb_modify_ctrl(struct ldb_context *ldb,
 
 	ret = ldb_build_mod_req(&req, ldb, ldb,
 					message,
-					controls,
+					NULL,
 					NULL,
 					ldb_op_default_callback,
 					NULL);
@@ -1417,14 +1416,6 @@ int ldb_modify_ctrl(struct ldb_context *ldb,
 	talloc_free(req);
 	return ret;
 }
-/*
-  modify the specified attributes of a record
-*/
-int ldb_modify(struct ldb_context *ldb,
-	       const struct ldb_message *message)
-{
-	return ldb_modify_ctrl(ldb, message, NULL);
-}
 
 
 /*
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 2b80e42..cf55f0a 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -1231,24 +1231,6 @@ int ldb_add(struct ldb_context *ldb,
   ldb_init())
   \param message the message containing the changes required.
 
-  \param controls ldap controls for the request
-
-  \return result code (LDB_SUCCESS if the record was modified as
-  requested, otherwise a failure code)
-*/
-int ldb_modify_ctrl(struct ldb_context *ldb,
-		    const struct ldb_message *message,
-		    struct ldb_control **controls);
-
-/**
-  Modify the specified attributes of a record
-
-  This function modifies a record that is in the database.
-
-  \param ldb the context associated with the database (from
-  ldb_init())
-  \param message the message containing the changes required.
-
   \return result code (LDB_SUCCESS if the record was modified as
   requested, otherwise a failure code)
 */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list