[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Jun 26 04:10:03 UTC 2018


The branch, master has been updated
       via  113da7a dsdb audit: Fix timestamp tests
       via  120fe41 dsdb-audit: Remove flapping part of the tests
       via  d18bae9 dsdb: Use GUID_zero() rather than memset in dsdb audit code
       via  2c883bd dsdb: Use customary variable names for the audit private context
       via  d2468f7 dsdb: Use customary variable names for audit event contexts
       via  d38160c dsdb: Use correct memory context for imessaging_client_init() in audit logging
       via  4b077e0 audit_logging: Remove duplciate error printing
       via  dad73e0 audit_logging: Initialise event_server
       via  4f50848 audit_logging: Remove incorrect check for NT_STATUS_OBJECT_NAME_NOT_FOUND
       via  450210c audit_logging: Clarify debug messages
      from  f33749f autobuild: Build samba-fileserver --without-json-audit

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


- Log -----------------------------------------------------------------
commit 113da7ac67a79deb71e3bfb2def9abd85655f36f
Author: Gary Lockyer <gary at catalyst.net.nz>
Date:   Tue Jun 26 09:39:56 2018 +1200

    dsdb audit: Fix timestamp tests
    
    Fix flapping test:
      [242(3560)/242 at 25m3s] samba4.dsdb.samdb.ldb_modules.audit_log
    UNEXPECTED(failure):
      samba4.dsdb.samdb.ldb_modules.audit_log.test_operation_json_empty(none)
    REASON: Exception: Exception: difftime(after, actual) >= 0
    ../source4/dsdb/samdb/ldb_modules/tests/test_audit_log.c:74: error:
    
    The tests truncate the microsecond portion of the time, so the
    difference could be less than 0.
    
    Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Tue Jun 26 06:09:46 CEST 2018 on sn-devel-144

commit 120fe41073039e8ed915fde1fff356aeaf2781e9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jun 26 08:29:46 2018 +1200

    dsdb-audit: Remove flapping part of the tests
    
    Because we have tests for this in the auth audit code, we do not need to have
    the complexity of checking that we got DCE/RPC over SMB as an authorization
    message here.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit d18bae916981a73cdad1103b866a9afabd9e0519
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 16:46:29 2018 +1200

    dsdb: Use GUID_zero() rather than memset in dsdb audit code
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 2c883bd9788d0142836af70599ade4aa3bad3d39
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 16:43:38 2018 +1200

    dsdb: Use customary variable names for the audit private context
    
    The variable name "ac" typically implies the async context, and the long-life
    private context is normally denoted private, not context.  This aligns better
    with other modules.
    
    talloc_get_type_abort() is now also used.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit d2468f732fb8a33fa28648b4928bd3a8a1e599ff
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 16:23:00 2018 +1200

    dsdb: Use customary variable names for audit event contexts
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit d38160c968cd78e179754f39576359a51619bc9f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 15:42:42 2018 +1200

    dsdb: Use correct memory context for imessaging_client_init() in audit logging
    
    This is only used for selftest, to send out the log messages for checking.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 4b077e07a0d295c8894dc842935612b4b768ebd8
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 14:52:59 2018 +1200

    audit_logging: Remove duplciate error printing
    
    These errors are already logged at DBG_NOTICE in get_event_server()
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit dad73e0b681cef247c83be5e2d6165922b2fb545
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 14:52:19 2018 +1200

    audit_logging: Initialise event_server
    
    It is better if this is a known zero value to start, even if we check the errors
    correctly.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 4f50848680605dfde8233f8b64a4fc1e79df6276
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 14:51:35 2018 +1200

    audit_logging: Remove incorrect check for NT_STATUS_OBJECT_NAME_NOT_FOUND
    
    NT_STATUS_OBJECT_NAME_NOT_FOUND is not a case we can ignore, it would mean that event_server
    is not initialised.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

commit 450210c39a31ac5e0d9cf576fdd4c90965a2f79c
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Jun 25 14:48:27 2018 +1200

    audit_logging: Clarify debug messages
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>

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

Summary of changes:
 lib/audit_logging/audit_logging.c                  |  18 +--
 python/samba/tests/audit_log_dsdb.py               |  26 ++--
 source4/dsdb/samdb/ldb_modules/audit_log.c         | 152 +++++++++++----------
 source4/dsdb/samdb/ldb_modules/group_audit.c       |   6 +-
 .../dsdb/samdb/ldb_modules/tests/test_audit_log.c  | 119 ++++++++--------
 5 files changed, 172 insertions(+), 149 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/audit_logging/audit_logging.c b/lib/audit_logging/audit_logging.c
index 13ff345..f94f2c2 100644
--- a/lib/audit_logging/audit_logging.c
+++ b/lib/audit_logging/audit_logging.c
@@ -173,7 +173,7 @@ static NTSTATUS get_event_server(
 	if (!NT_STATUS_IS_OK(status)) {
 		DBG_NOTICE(
 			"Failed to find '%s' registered on the message bus to "
-			"send audit events to: %s\n",
+			"send JSON audit events to: %s\n",
 			server_name,
 			nt_errstr(status));
 		TALLOC_FREE(frame);
@@ -199,7 +199,7 @@ static NTSTATUS get_event_server(
 	}
 	DBG_NOTICE(
 		"Failed to find '%s' registered on the message bus to "
-		"send audit events to: %s\n",
+		"send JSON audit events to: %s\n",
 		server_name,
 		nt_errstr(status));
 	TALLOC_FREE(frame);
@@ -230,7 +230,7 @@ void audit_message_send(
 	uint32_t message_type,
 	struct json_object *message)
 {
-	struct server_id event_server;
+	struct server_id event_server = {};
 	NTSTATUS status;
 
 	const char *message_string = NULL;
@@ -248,11 +248,7 @@ void audit_message_send(
 	 * messages may get lost
 	 */
 	status = get_event_server(msg_ctx, server_name, &event_server);
-	if (!NT_STATUS_IS_OK(status) &&
-	    !NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
-		DBG_ERR("get_event_server for %s returned (%s)\n",
-			server_name,
-			nt_errstr(status));
+	if (!NT_STATUS_IS_OK(status)) {
 		TALLOC_FREE(ctx);
 		return;
 	}
@@ -270,11 +266,7 @@ void audit_message_send(
 	 */
 	if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
 		status = get_event_server(msg_ctx, server_name, &event_server);
-		if (!NT_STATUS_IS_OK(status) &&
-		    !NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
-			DBG_ERR("get_event_server for %s returned (%s)\n",
-				server_name,
-				nt_errstr(status));
+		if (!NT_STATUS_IS_OK(status)) {
 			TALLOC_FREE(ctx);
 			return;
 		}
diff --git a/python/samba/tests/audit_log_dsdb.py b/python/samba/tests/audit_log_dsdb.py
index 53d4573..abcdb9d 100644
--- a/python/samba/tests/audit_log_dsdb.py
+++ b/python/samba/tests/audit_log_dsdb.py
@@ -150,8 +150,10 @@ class AuditLogDsdbTests(AuditLogTestBase):
                                  self.remoteAddress)
         session_id = self.get_session()
         self.assertEquals(session_id, audit["sessionId"])
-        service_description = self.get_service_description()
-        self.assertEquals(service_description, "DCE/RPC")
+        # We skip the check for self.get_service_description() as this
+        # is subject to a race between smbd and the s4 rpc_server code
+        # as to which will set the description as it is DCE/RPC over SMB
+
         self.assertTrue(self.is_guid(audit["transactionId"]))
 
         attributes = audit["attributes"]
@@ -189,8 +191,10 @@ class AuditLogDsdbTests(AuditLogTestBase):
                                  self.remoteAddress)
         session_id = self.get_session()
         self.assertEquals(session_id, audit["sessionId"])
-        service_description = self.get_service_description()
-        self.assertEquals(service_description, "DCE/RPC")
+        # We skip the check for self.get_service_description() as this
+        # is subject to a race between smbd and the s4 rpc_server code
+        # as to which will set the description as it is DCE/RPC over SMB
+
         self.assertTrue(self.is_guid(audit["transactionId"]))
 
         attributes = audit["attributes"]
@@ -434,8 +438,11 @@ class AuditLogDsdbTests(AuditLogTestBase):
         self.assertTrue(self.is_guid(audit["sessionId"]))
         session_id = self.get_session()
         self.assertEquals(session_id, audit["sessionId"])
-        service_description = self.get_service_description()
-        self.assertEquals(service_description, "DCE/RPC")
+
+        # We skip the check for self.get_service_description() as this
+        # is subject to a race between smbd and the s4 rpc_server code
+        # as to which will set the description as it is DCE/RPC over SMB
+
         attributes = audit["attributes"]
         self.assertEquals(2, len(attributes))
 
@@ -480,8 +487,11 @@ class AuditLogDsdbTests(AuditLogTestBase):
         self.assertTrue(self.is_guid(audit["sessionId"]))
         session_id = self.get_session()
         self.assertEquals(session_id, audit["sessionId"])
-        service_description = self.get_service_description()
-        self.assertEquals(service_description, "DCE/RPC")
+
+        # We skip the check for self.get_service_description() as this
+        # is subject to a race between smbd and the s4 rpc_server code
+        # as to which will set the description as it is DCE/RPC over SMB
+
 
     def test_modify(self):
 
diff --git a/source4/dsdb/samdb/ldb_modules/audit_log.c b/source4/dsdb/samdb/ldb_modules/audit_log.c
index fc2eb50..581f2f2 100644
--- a/source4/dsdb/samdb/ldb_modules/audit_log.c
+++ b/source4/dsdb/samdb/ldb_modules/audit_log.c
@@ -69,7 +69,7 @@
 /*
  * Private data for the module, stored in the ldb_module private data
  */
-struct audit_context {
+struct audit_private {
 	/*
 	 * Should details of database operations be sent over the
 	 * messaging bus.
@@ -192,9 +192,9 @@ static struct json_object operation_json(
 	const char* operation = NULL;
 	const struct GUID *unique_session_token = NULL;
 	const struct ldb_message *message = NULL;
-	struct audit_context *ac = talloc_get_type(
-		ldb_module_get_private(module),
-		struct audit_context);
+	struct audit_private *audit_private
+		= talloc_get_type_abort(ldb_module_get_private(module),
+					struct audit_private);
 
 	ldb = ldb_module_get_ctx(module);
 
@@ -221,7 +221,9 @@ static struct json_object operation_json(
 	json_add_bool(&audit, "performedAsSystem", as_system);
 	json_add_sid(&audit, "userSid", sid);
 	json_add_string(&audit, "dn", dn);
-	json_add_guid(&audit, "transactionId", &ac->transaction_guid);
+	json_add_guid(&audit,
+		      "transactionId",
+		      &audit_private->transaction_guid);
 	json_add_guid(&audit, "sessionId", unique_session_token);
 
 	message = dsdb_audit_get_message(request);
@@ -259,9 +261,9 @@ static struct json_object replicated_update_json(
 {
 	struct json_object wrapper;
 	struct json_object audit;
-	struct audit_context *ac = talloc_get_type(
-		ldb_module_get_private(module),
-		struct audit_context);
+	struct audit_private *audit_private
+		= talloc_get_type_abort(ldb_module_get_private(module),
+					struct audit_private);
 	struct dsdb_extended_replicated_objects *ro = talloc_get_type(
 		request->op.extended.data,
 		struct dsdb_extended_replicated_objects);
@@ -275,7 +277,9 @@ static struct json_object replicated_update_json(
 	json_add_version(&audit, REPLICATION_MAJOR, REPLICATION_MINOR);
 	json_add_int(&audit, "statusCode", reply->error);
 	json_add_string(&audit, "status", ldb_strerror(reply->error));
-	json_add_guid(&audit, "transactionId", &ac->transaction_guid);
+	json_add_guid(&audit,
+		      "transactionId",
+		      &audit_private->transaction_guid);
 	json_add_int(&audit, "objectCount", ro->num_objects);
 	json_add_int(&audit, "linkCount", ro->linked_attributes_count);
 	json_add_string(&audit, "partitionDN", partition_dn);
@@ -323,9 +327,9 @@ static struct json_object password_change_json(
 	const struct tsocket_address *remote = NULL;
 	const char* action = NULL;
 	const struct GUID *unique_session_token = NULL;
-	struct audit_context *ac = talloc_get_type(
-		ldb_module_get_private(module),
-		struct audit_context);
+	struct audit_private *audit_private
+		= talloc_get_type_abort(ldb_module_get_private(module),
+					struct audit_private);
 
 
 	ldb = ldb_module_get_ctx(module);
@@ -344,7 +348,9 @@ static struct json_object password_change_json(
 	json_add_sid(&audit, "userSid", sid);
 	json_add_string(&audit, "dn", dn);
 	json_add_string(&audit, "action", action);
-	json_add_guid(&audit, "transactionId", &ac->transaction_guid);
+	json_add_guid(&audit,
+		      "transactionId",
+		      &audit_private->transaction_guid);
 	json_add_guid(&audit, "sessionId", unique_session_token);
 
 	wrapper = json_new_object();
@@ -816,9 +822,9 @@ static void log_standard_operation(
 
 	const struct ldb_message *message = dsdb_audit_get_message(request);
 	bool password_changed = has_password_changed(message);
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				      struct audit_private);
 
 	TALLOC_CTX *ctx = talloc_new(NULL);
 
@@ -854,7 +860,8 @@ static void log_standard_operation(
 	}
 #ifdef HAVE_JANSSON
 	if (CHECK_DEBUGLVLC(DBGC_DSDB_AUDIT_JSON, OPERATION_LOG_LVL) ||
-		(ac->msg_ctx && ac->send_samdb_events)) {
+		(audit_private->msg_ctx
+		 && audit_private->send_samdb_events)) {
 		struct json_object json;
 		json = operation_json(module, request, reply);
 		audit_log_json(
@@ -862,9 +869,10 @@ static void log_standard_operation(
 			&json,
 			DBGC_DSDB_AUDIT_JSON,
 			OPERATION_LOG_LVL);
-		if (ac->msg_ctx && ac->send_password_events) {
+		if (audit_private->msg_ctx
+		    && audit_private->send_samdb_events) {
 			audit_message_send(
-				ac->msg_ctx,
+				audit_private->msg_ctx,
 				DSDB_EVENT_NAME,
 				MSG_DSDB_LOG,
 				&json);
@@ -872,7 +880,8 @@ static void log_standard_operation(
 		json_free(&json);
 	}
 	if (CHECK_DEBUGLVLC(DBGC_DSDB_PWD_AUDIT_JSON, PASSWORD_LOG_LVL) ||
-		(ac->msg_ctx && ac->send_password_events)) {
+		(audit_private->msg_ctx
+		 && audit_private->send_password_events)) {
 		if (password_changed) {
 			struct json_object json;
 			json = password_change_json(module, request, reply);
@@ -881,9 +890,9 @@ static void log_standard_operation(
 				&json,
 				DBGC_DSDB_PWD_AUDIT_JSON,
 				PASSWORD_LOG_LVL);
-			if (ac->send_password_events) {
+			if (audit_private->send_password_events) {
 				audit_message_send(
-					ac->msg_ctx,
+					audit_private->msg_ctx,
 					DSDB_PWD_EVENT_NAME,
 					MSG_DSDB_PWD_LOG,
 					&json);
@@ -912,9 +921,9 @@ static void log_replicated_operation(
 	const struct ldb_reply *reply)
 {
 
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				struct audit_private);
 
 	TALLOC_CTX *ctx = talloc_new(NULL);
 
@@ -934,7 +943,7 @@ static void log_replicated_operation(
 	}
 #ifdef HAVE_JANSSON
 	if (CHECK_DEBUGLVLC(DBGC_DSDB_AUDIT_JSON, REPLICATION_LOG_LVL) ||
-		(ac->msg_ctx && ac->send_samdb_events)) {
+		(audit_private->msg_ctx && audit_private->send_samdb_events)) {
 		struct json_object json;
 		json = replicated_update_json(module, request, reply);
 		audit_log_json(
@@ -942,9 +951,9 @@ static void log_replicated_operation(
 			&json,
 			DBGC_DSDB_AUDIT_JSON,
 			REPLICATION_LOG_LVL);
-		if (ac->send_samdb_events) {
+		if (audit_private->send_samdb_events) {
 			audit_message_send(
-				ac->msg_ctx,
+				audit_private->msg_ctx,
 				DSDB_EVENT_NAME,
 				MSG_DSDB_LOG,
 				&json);
@@ -1001,11 +1010,11 @@ static void log_transaction(
 	int log_level)
 {
 
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				      struct audit_private);
 	const struct timeval now = timeval_current();
-	const int64_t duration = usec_time_diff(&now, &ac->transaction_start);
+	const int64_t duration = usec_time_diff(&now, &audit_private->transaction_start);
 
 	TALLOC_CTX *ctx = talloc_new(NULL);
 
@@ -1021,20 +1030,20 @@ static void log_transaction(
 	}
 #ifdef HAVE_JANSSON
 	if (CHECK_DEBUGLVLC(DBGC_DSDB_TXN_AUDIT_JSON, log_level) ||
-		(ac->msg_ctx && ac->send_samdb_events)) {
+		(audit_private->msg_ctx && audit_private->send_samdb_events)) {
 		struct json_object json;
 		json = transaction_json(
 			action,
-			&ac->transaction_guid,
+			&audit_private->transaction_guid,
 			duration);
 		audit_log_json(
 			TRANSACTION_JSON_TYPE,
 			&json,
 			DBGC_DSDB_TXN_AUDIT_JSON,
 			log_level);
-		if (ac->send_samdb_events) {
+		if (audit_private->send_samdb_events) {
 			audit_message_send(
-				ac->msg_ctx,
+				audit_private->msg_ctx,
 				DSDB_EVENT_NAME,
 				MSG_DSDB_LOG,
 				&json);
@@ -1062,13 +1071,14 @@ static void log_commit_failure(
 	int status)
 {
 
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				      struct audit_private);
 	const char* reason = dsdb_audit_get_ldb_error_string(module, status);
 	const int log_level = TRANSACTION_LOG_FAILURE_LVL;
 	const struct timeval now = timeval_current();
-	const int64_t duration = usec_time_diff(&now, &ac->transaction_start);
+	const int64_t duration = usec_time_diff(&now,
+						&audit_private->transaction_start);
 
 	TALLOC_CTX *ctx = talloc_new(NULL);
 
@@ -1090,21 +1100,22 @@ static void log_commit_failure(
 	}
 #ifdef HAVE_JANSSON
 	if (CHECK_DEBUGLVLC(DBGC_DSDB_TXN_AUDIT_JSON, log_level) ||
-		(ac->msg_ctx && ac->send_samdb_events)) {
+		(audit_private->msg_ctx
+		 && audit_private->send_samdb_events)) {
 		struct json_object json;
 		json = commit_failure_json(
 			action,
 			duration,
 			status,
 			reason,
-			&ac->transaction_guid);
+			&audit_private->transaction_guid);
 		audit_log_json(
 			TRANSACTION_JSON_TYPE,
 			&json,
 			DBGC_DSDB_TXN_AUDIT_JSON,
 			log_level);
-		if (ac->send_samdb_events) {
-			audit_message_send(ac->msg_ctx,
+		if (audit_private->send_samdb_events) {
+			audit_message_send(audit_private->msg_ctx,
 					   DSDB_EVENT_NAME,
 					   MSG_DSDB_LOG,
 					   &json);
@@ -1196,9 +1207,9 @@ static int add_transaction_id(
 	struct ldb_module *module,
 	struct ldb_request *req)
 {
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				      struct audit_private);
 	struct dsdb_control_transaction_identifier *transaction_id;
 	int ret;
 
@@ -1209,7 +1220,7 @@ static int add_transaction_id(
 		struct ldb_context *ldb = ldb_module_get_ctx(module);
 		return ldb_oom(ldb);
 	}
-	transaction_id->transaction_guid = ac->transaction_guid;
+	transaction_id->transaction_guid = audit_private->transaction_guid;
 	ret = ldb_request_add_control(req,
 				      DSDB_CONTROL_TRANSACTION_IDENTIFIER_OID,
 				      false,
@@ -1383,9 +1394,9 @@ static int log_modify(
  */
 static int log_start_transaction(struct ldb_module *module)
 {
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				      struct audit_private);
 
 	/*
 	 * We do not log transaction begins
@@ -1393,8 +1404,8 @@ static int log_start_transaction(struct ldb_module *module)
 	 * time so that we can log the transaction duration.
 	 *
 	 */
-	ac->transaction_guid = GUID_random();
-	ac->transaction_start = timeval_current();
+	audit_private->transaction_guid = GUID_random();
+	audit_private->transaction_start = timeval_current();
 	return ldb_next_start_trans(module);
 }
 
@@ -1435,9 +1446,9 @@ static int log_prepare_commit(struct ldb_module *module)
  */
 static int log_end_transaction(struct ldb_module *module)
 {
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				      struct audit_private);
 	int ret = 0;
 
 
@@ -1453,7 +1464,7 @@ static int log_end_transaction(struct ldb_module *module)
 	/*
 	 * Clear the transaction id inserted by log_start_transaction
 	 */
-	memset(&ac->transaction_guid, 0, sizeof(struct GUID));
+	audit_private->transaction_guid = GUID_zero();
 	return ret;
 }
 
@@ -1469,12 +1480,12 @@ static int log_end_transaction(struct ldb_module *module)
  */
 static int log_del_transaction(struct ldb_module *module)
 {
-	struct audit_context *ac =
-		talloc_get_type(ldb_module_get_private(module),
-				struct audit_context);
+	struct audit_private *audit_private =
+		talloc_get_type_abort(ldb_module_get_private(module),
+				      struct audit_private);
 
 	log_transaction(module, "rollback", TRANSACTION_LOG_FAILURE_LVL);
-	memset(&ac->transaction_guid, 0, sizeof(struct GUID));
+	audit_private->transaction_guid = GUID_zero();
 	return ldb_next_del_trans(module);
 }
 
@@ -1546,16 +1557,16 @@ static int log_init(struct ldb_module *module)
 {
 
 	struct ldb_context *ldb = ldb_module_get_ctx(module);
-	struct audit_context *context = NULL;
+	struct audit_private *audit_private = NULL;
 	struct loadparm_context *lp_ctx
 		= talloc_get_type_abort(ldb_get_opaque(ldb, "loadparm"),
 					struct loadparm_context);
-	struct tevent_context *ec = ldb_get_event_context(ldb);
+	struct tevent_context *ev = ldb_get_event_context(ldb);
 	bool sdb_events = false;
 	bool pwd_events = false;
 
-	context = talloc_zero(module, struct audit_context);
-	if (context == NULL) {
+	audit_private = talloc_zero(module, struct audit_private);
+	if (audit_private == NULL) {
 		return ldb_module_oom(module);
 	}
 
@@ -1564,12 +1575,15 @@ static int log_init(struct ldb_module *module)
 		pwd_events = lpcfg_dsdb_password_event_notification(lp_ctx);
 	}
 	if (sdb_events || pwd_events) {
-		context->send_samdb_events = sdb_events;
-		context->send_password_events = pwd_events;
-		context->msg_ctx = imessaging_client_init(ec, lp_ctx, ec);
+		audit_private->send_samdb_events = sdb_events;
+		audit_private->send_password_events = pwd_events;
+		audit_private->msg_ctx
+			= imessaging_client_init(audit_private,
+						 lp_ctx,
+						 ev);
 	}
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list