Merge "rtp_engine/res_rtp_asterisk: Fix RTP struct reentrancy crashes."
[asterisk/asterisk.git] / res / res_security_log.c
index 1a4f379..555ba23 100644 (file)
@@ -33,8 +33,6 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
-
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
 #include "asterisk/threadstorage.h"
@@ -98,15 +96,14 @@ static void security_event_stasis_cb(struct ast_json *json)
        event_type_json = ast_json_object_get(json, "SecurityEvent");
        event_type = ast_json_integer_get(event_type_json);
 
-       ast_assert(event_type >= 0 && event_type < AST_SECURITY_EVENT_NUM_TYPES);
+       ast_assert((unsigned int)event_type < AST_SECURITY_EVENT_NUM_TYPES);
 
        if (!(str = ast_str_thread_get(&security_event_buf,
                        SECURITY_EVENT_BUF_INIT_LEN))) {
                return;
        }
 
-       ast_str_set(&str, 0, "%s=\"%s\"",
-                       ast_event_get_ie_type_name(AST_EVENT_IE_SECURITY_EVENT),
+       ast_str_set(&str, 0, "SecurityEvent=\"%s\"",
                        ast_security_event_get_name(event_type));
 
        append_json(&str, json,
@@ -118,7 +115,7 @@ static void security_event_stasis_cb(struct ast_json *json)
 }
 
 static void security_stasis_cb(void *data, struct stasis_subscription *sub,
-       struct stasis_topic *topic, struct stasis_message *message)
+       struct stasis_message *message)
 {
        struct ast_json_payload *payload = stasis_message_data(message);
 
@@ -153,9 +150,11 @@ static int load_module(void)
 static int unload_module(void)
 {
        if (security_stasis_sub) {
-               security_stasis_sub = stasis_unsubscribe(security_stasis_sub);
+               security_stasis_sub = stasis_unsubscribe_and_join(security_stasis_sub);
        }
 
+       ast_logger_unregister_level(LOG_SECURITY_NAME);
+
        ast_verb(3, "Security Logging Disabled\n");
 
        return 0;