[asterisk-commits] sgriepentrog: trunk r404387 - /trunk/main/security_events.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 19 14:48:25 CST 2013


Author: sgriepentrog
Date: Thu Dec 19 14:48:19 2013
New Revision: 404387

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404387
Log:
security_events: log events with descriptive names

This patch updates the log messages to include descriptive
names for event types.  This is an improvement over having
only cryptic type numbers.

(closes issue ASTERISK-22909)
Reported by: outtolunc
Review: https://reviewboard.asterisk.org/r/3081/
Patches:
     svn_security_events.c.names.diff.txt uploaded by outtolunc (license 5198)


Modified:
    trunk/main/security_events.c

Modified: trunk/main/security_events.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/security_events.c?view=diff&rev=404387&r1=404386&r2=404387
==============================================================================
--- trunk/main/security_events.c (original)
+++ trunk/main/security_events.c Thu Dec 19 14:48:19 2013
@@ -35,6 +35,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/strings.h"
 #include "asterisk/network.h"
+#include "asterisk/event.h"
 #include "asterisk/security_events.h"
 #include "asterisk/netsock2.h"
 #include "asterisk/stasis.h"
@@ -622,9 +623,10 @@
 		str = *((const char **)(((const char *) sec) + ie_type->offset));
 
 		if (req && !str) {
-			ast_log(LOG_WARNING, "Required IE '%d' for security event "
-					"type '%d' not present\n", ie_type->ie_type,
-					sec->event_type);
+			ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
+					"type '%d' (%s) not present\n", ie_type->ie_type,
+					ast_event_get_ie_type_name(ie_type->ie_type),
+					sec->event_type, ast_security_event_get_name(sec->event_type));
 			res = -1;
 			break;
 		}
@@ -667,9 +669,10 @@
 		addr = (const struct ast_security_event_ip_addr *)(((const char *) sec) + ie_type->offset);
 
 		if (req && !addr->addr) {
-			ast_log(LOG_WARNING, "Required IE '%d' for security event "
-					"type '%d' not present\n", ie_type->ie_type,
-					sec->event_type);
+			ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
+					"type '%d' (%s) not present\n", ie_type->ie_type,
+					ast_event_get_ie_type_name(ie_type->ie_type),
+					sec->event_type, ast_security_event_get_name(sec->event_type));
 			res = -1;
 		}
 
@@ -686,9 +689,10 @@
 		tval = *((const struct timeval **)(((const char *) sec) + ie_type->offset));
 
 		if (req && !tval) {
-			ast_log(LOG_WARNING, "Required IE '%d' for security event "
-					"type '%d' not present\n", ie_type->ie_type,
-					sec->event_type);
+			ast_log(LOG_WARNING, "Required IE '%d' (%s) for security event "
+					"type '%d' (%s) not present\n", ie_type->ie_type,
+					ast_event_get_ie_type_name(ie_type->ie_type),
+					sec->event_type, ast_security_event_get_name(sec->event_type));
 			res = -1;
 		}
 
@@ -708,8 +712,9 @@
 		/* Added automatically, nothing to do here. */
 		break;
 	default:
-		ast_log(LOG_WARNING, "Unhandled IE type '%d', this security event "
-				"will be missing data.\n", ie_type->ie_type);
+		ast_log(LOG_WARNING, "Unhandled IE type '%d' (%s), this security event "
+				"will be missing data.\n", ie_type->ie_type,
+				ast_event_get_ie_type_name(ie_type->ie_type));
 		break;
 	}
 




More information about the asterisk-commits mailing list