[asterisk-commits] russell: branch group/security_events r191883 - in /team/group/security_event...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 2 16:27:56 CDT 2009


Author: russell
Date: Sat May  2 16:27:48 2009
New Revision: 191883

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191883
Log:
resolve, reset

Modified:
    team/group/security_events/   (props changed)
    team/group/security_events/CHANGES
    team/group/security_events/apps/app_sms.c
    team/group/security_events/apps/app_verbose.c
    team/group/security_events/configs/logger.conf.sample
    team/group/security_events/include/asterisk/logger.h
    team/group/security_events/main/event.c
    team/group/security_events/main/logger.c
    team/group/security_events/main/manager.c
    team/group/security_events/pbx/pbx_spool.c

Propchange: team/group/security_events/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/security_events/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/group/security_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat May  2 16:27:48 2009
@@ -1,1 +1,1 @@
-/trunk:1-191756
+/trunk:1-191882

Modified: team/group/security_events/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/CHANGES?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/CHANGES (original)
+++ team/group/security_events/CHANGES Sat May  2 16:27:48 2009
@@ -122,7 +122,7 @@
 http://svn.digium.com/svn/thirdparty/mISDN/trunk
 http://svn.digium.com/svn/thirdparty/mISDNuser/trunk
 
-Taged versions of the modified mISDN code are available under:
+Tagged versions of the modified mISDN code are available under:
 http://svn.digium.com/svn/thirdparty/mISDN/tags
 http://svn.digium.com/svn/thirdparty/mISDNuser/tags
 
@@ -139,6 +139,12 @@
    across all .conf files. All affected sample.conf files have been modified to
    reflect this change.  Previous options such as 'sslenable' still work,
    but options with the 'tls' prefix are preferred.
+
+Logger
+------
+ * The rarely used 'event_log' and LOG_EVENT channel have been removed; the few
+   users of this channel in the tree have been converted to LOG_NOTICE or removed
+   (in cases where the same message was already generated to another channel).
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2  -------------

Modified: team/group/security_events/apps/app_sms.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/apps/app_sms.c?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/apps/app_sms.c (original)
+++ team/group/security_events/apps/app_sms.c Sat May  2 16:27:48 2009
@@ -815,7 +815,7 @@
 	char line[1000];
 	FILE *s;
 	char dcsset = 0;                        /* if DSC set */
-	ast_log(LOG_EVENT, "Sending %s\n", fn);
+	ast_log(LOG_NOTICE, "Sending %s\n", fn);
 	h->rx = h->udl = *h->oa = *h->da = h->pid = h->srr = h->udhi = h->rp = h->vp = h->udhl = 0;
 	h->mr = -1;
 	h->dcs = 0xF1;                          /* normal messages class 1 */
@@ -1080,7 +1080,7 @@
 	if (rename(fn, fn2)) {
 		unlink(fn);
 	} else {
-		ast_log(LOG_EVENT, "Received to %s\n", fn2);
+		ast_log(LOG_NOTICE, "Received to %s\n", fn2);
 	}
 }
 

Modified: team/group/security_events/apps/app_verbose.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/apps/app_verbose.c?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/apps/app_verbose.c (original)
+++ team/group/security_events/apps/app_verbose.c Sat May  2 16:27:48 2009
@@ -148,8 +148,6 @@
 		lnum = __LOG_DTMF;
 	} else if (!strcasecmp(args.level, "SECURITY")) {
 		lnum = __LOG_SECURITY;
-	} else if (!strcasecmp(args.level, "EVENT")) {
-		lnum = __LOG_EVENT;
 	} else {
 		ast_log(LOG_ERROR, "Unknown log level: '%s'\n", args.level);
 	}

Modified: team/group/security_events/configs/logger.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/configs/logger.conf.sample?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/configs/logger.conf.sample (original)
+++ team/group/security_events/configs/logger.conf.sample Sat May  2 16:27:48 2009
@@ -47,10 +47,6 @@
 ;
 ; exec_after_rotate=gzip -9 ${filename}.2
 ;
-; This determines whether or not we log generic events to a file
-; (defaults to yes).
-;event_log = no
-;
 ;
 ; For each file, specify what to log.
 ;

Modified: team/group/security_events/include/asterisk/logger.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/include/asterisk/logger.h?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/include/asterisk/logger.h (original)
+++ team/group/security_events/include/asterisk/logger.h Sat May  2 16:27:48 2009
@@ -122,17 +122,6 @@
 #undef AST_LOG_DEBUG
 #endif
 #define AST_LOG_DEBUG      __LOG_DEBUG, _A_
-
-#ifdef LOG_EVENT
-#undef LOG_EVENT
-#endif
-#define __LOG_EVENT    1
-#define LOG_EVENT      __LOG_EVENT, _A_
-
-#ifdef AST_LOG_EVENT
-#undef AST_LOG_EVENT
-#endif
-#define AST_LOG_EVENT      __LOG_EVENT, _A_
 
 #ifdef LOG_NOTICE
 #undef LOG_NOTICE

Modified: team/group/security_events/main/event.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/main/event.c?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/main/event.c (original)
+++ team/group/security_events/main/event.c Sat May  2 16:27:48 2009
@@ -339,60 +339,95 @@
 		ie_type = va_arg(ap, enum ast_event_type))
 	{
 		struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+		int insert = 1;
 		memset(ie_value, 0, sizeof(*ie_value));
 		ie_value->ie_type = ie_type;
 		ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
-		if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
+		switch (ie_value->ie_pltype) {
+		case AST_EVENT_IE_PLTYPE_UINT:
 			ie_value->payload.uint = va_arg(ap, uint32_t);
-		else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
-			ie_value->payload.str = ast_strdupa(va_arg(ap, const char *));
-		else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
+			break;
+		case AST_EVENT_IE_PLTYPE_STR:
+			ie_value->payload.str = va_arg(ap, const char *);
+			break;
+		case AST_EVENT_IE_PLTYPE_RAW:
+		{
 			void *data = va_arg(ap, void *);
 			size_t datalen = va_arg(ap, size_t);
 			ie_value->payload.raw = alloca(datalen);
 			memcpy(ie_value->payload.raw, data, datalen);
 			ie_value->raw_datalen = datalen;
-		}
-		AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
+			break;
+		}
+		case AST_EVENT_IE_PLTYPE_UNKNOWN:
+			insert = 0;
+		case AST_EVENT_IE_PLTYPE_EXISTS:
+			break;
+		}
+
+		if (insert) {
+			AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
+		}
 	}
 	va_end(ap);
 
 	AST_RWDLLIST_RDLOCK(&ast_event_subs[type]);
 	AST_RWDLLIST_TRAVERSE(&ast_event_subs[type], sub, entry) {
 		AST_LIST_TRAVERSE(&ie_vals, ie_val, entry) {
+			int break_out = 0;
+
 			AST_LIST_TRAVERSE(&sub->ie_vals, sub_ie_val, entry) {
-				if (sub_ie_val->ie_type == ie_val->ie_type)
+				if (sub_ie_val->ie_type == ie_val->ie_type) {
 					break;
+				}
 			}
+
 			if (!sub_ie_val) {
-				if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_EXISTS)
-					break;
+				/* This subscriber doesn't care about this IE, so consider
+				 * it matched. */
 				continue;
 			}
-			/* The subscriber doesn't actually care what the value is */
-			if (sub_ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_EXISTS)
-				continue;
-			if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT &&
-				ie_val->payload.uint != sub_ie_val->payload.uint)
+
+			switch (ie_val->ie_pltype) {
+			case AST_EVENT_IE_PLTYPE_UINT:
+				break_out = (ie_val->payload.uint != sub_ie_val->payload.uint);
 				break;
-			if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR &&
-				strcmp(ie_val->payload.str, sub_ie_val->payload.str))
+			case AST_EVENT_IE_PLTYPE_STR:
+				break_out = strcmp(ie_val->payload.str, sub_ie_val->payload.str);
 				break;
-			if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW &&
-				memcmp(ie_val->payload.raw, sub_ie_val->payload.raw, ie_val->raw_datalen))
+			case AST_EVENT_IE_PLTYPE_RAW:
+				break_out = memcmp(ie_val->payload.raw,
+						sub_ie_val->payload.raw, ie_val->raw_datalen);
 				break;
-		}
-		if (!ie_val)
-			break;
+			case AST_EVENT_IE_PLTYPE_EXISTS:
+				/* The subscriber doesn't actually care what the value is */
+				break_out = 1;
+				break;
+			case AST_EVENT_IE_PLTYPE_UNKNOWN:
+				break;
+			}
+
+			if (break_out) {
+				break;
+			}
+		}
+
+		if (!ie_val) {
+			/* Everything matched */
+			break;
+		}
 	}
 	AST_RWDLLIST_UNLOCK(&ast_event_subs[type]);
 
-	if (sub) /* All parameters were matched */
+	if (sub) {
+		/* All parameters were matched */
 		return AST_EVENT_SUB_EXISTS;
+	}
 
 	AST_RWDLLIST_RDLOCK(&ast_event_subs[AST_EVENT_ALL]);
-	if (!AST_DLLIST_EMPTY(&ast_event_subs[AST_EVENT_ALL]))
+	if (!AST_DLLIST_EMPTY(&ast_event_subs[AST_EVENT_ALL])) {
 		res = AST_EVENT_SUB_EXISTS;
+	}
 	AST_RWDLLIST_UNLOCK(&ast_event_subs[AST_EVENT_ALL]);
 
 	return res;
@@ -529,13 +564,15 @@
 
 	AST_RWDLLIST_RDLOCK(&ast_event_subs[event_type]);
 	AST_RWDLLIST_TRAVERSE(&ast_event_subs[event_type], sub, entry) {
-		if (event_sub == sub)
+		if (event_sub == sub) {
 			continue;
+		}
 
 		event = gen_sub_event(sub);
 
-		if (!event)
+		if (!event) {
 			continue;
+		}
 
 		event_sub->cb(event, event_sub->userdata);
 
@@ -544,7 +581,7 @@
 	AST_RWDLLIST_UNLOCK(&ast_event_subs[event_type]);
 }
 
-struct ast_event_sub *ast_event_subscribe_new(enum ast_event_type type, 
+struct ast_event_sub *ast_event_subscribe_new(enum ast_event_type type,
 	ast_event_cb_t cb, void *userdata)
 {
 	struct ast_event_sub *sub;
@@ -554,8 +591,9 @@
 		return NULL;
 	}
 
-	if (!(sub = ast_calloc(1, sizeof(*sub))))
+	if (!(sub = ast_calloc(1, sizeof(*sub)))) {
 		return NULL;
+	}
 
 	sub->type = type;
 	sub->cb = cb;
@@ -570,11 +608,13 @@
 {
 	struct ast_event_ie_val *ie_val;
 
-	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
-		return -1;
-
-	if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
-		return -1;
+	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX) {
+		return -1;
+	}
+
+	if (!(ie_val = ast_calloc(1, sizeof(*ie_val)))) {
+		return -1;
+	}
 
 	ie_val->ie_type = ie_type;
 	ie_val->payload.uint = unsigned_int;
@@ -590,11 +630,13 @@
 {
 	struct ast_event_ie_val *ie_val;
 
-	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
-		return -1;
-
-	if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
-		return -1;
+	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX) {
+		return -1;
+	}
+
+	if (!(ie_val = ast_calloc(1, sizeof(*ie_val)))) {
+		return -1;
+	}
 
 	ie_val->ie_type = ie_type;
 	ie_val->ie_pltype = AST_EVENT_IE_PLTYPE_EXISTS;
@@ -604,16 +646,18 @@
 	return 0;
 }
 
-int ast_event_sub_append_ie_str(struct ast_event_sub *sub, 	
+int ast_event_sub_append_ie_str(struct ast_event_sub *sub,
 	enum ast_event_ie_type ie_type, const char *str)
 {
 	struct ast_event_ie_val *ie_val;
 
-	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
-		return -1;
-
-	if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
-		return -1;
+	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX) {
+		return -1;
+	}
+
+	if (!(ie_val = ast_calloc(1, sizeof(*ie_val)))) {
+		return -1;
+	}
 
 	ie_val->ie_type = ie_type;
 	ie_val->ie_pltype = AST_EVENT_IE_PLTYPE_STR;
@@ -630,16 +674,18 @@
 	return 0;
 }
 
-int ast_event_sub_append_ie_raw(struct ast_event_sub *sub, 	
+int ast_event_sub_append_ie_raw(struct ast_event_sub *sub,
 	enum ast_event_ie_type ie_type, void *data, size_t raw_datalen)
 {
 	struct ast_event_ie_val *ie_val;
 
-	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX)
-		return -1;
-
-	if (!(ie_val = ast_calloc(1, sizeof(*ie_val))))
-		return -1;
+	if (ie_type < 0 || ie_type > AST_EVENT_IE_MAX) {
+		return -1;
+	}
+
+	if (!(ie_val = ast_calloc(1, sizeof(*ie_val)))) {
+		return -1;
+	}
 
 	ie_val->ie_type = ie_type;
 	ie_val->ie_pltype = AST_EVENT_IE_PLTYPE_RAW;
@@ -666,8 +712,9 @@
 
 		event = gen_sub_event(sub);
 
-		if (event)
+		if (event) {
 			ast_event_queue(event);
+		}
 	}
 
 	AST_RWDLLIST_WRLOCK(&ast_event_subs[sub->type]);
@@ -677,15 +724,16 @@
 	return 0;
 }
 
-struct ast_event_sub *ast_event_subscribe(enum ast_event_type type, ast_event_cb_t cb, 
+struct ast_event_sub *ast_event_subscribe(enum ast_event_type type, ast_event_cb_t cb,
 	void *userdata, ...)
 {
 	va_list ap;
 	enum ast_event_ie_type ie_type;
 	struct ast_event_sub *sub;
 
-	if (!(sub = ast_event_subscribe_new(type, cb, userdata)))
+	if (!(sub = ast_event_subscribe_new(type, cb, userdata))) {
 		return NULL;
+	}
 
 	va_start(ap, userdata);
 	for (ie_type = va_arg(ap, enum ast_event_type);
@@ -734,8 +782,9 @@
 {
 	struct ast_event_ie_val *ie_val;
 
-	while ((ie_val = AST_LIST_REMOVE_HEAD(&sub->ie_vals, entry)))
+	while ((ie_val = AST_LIST_REMOVE_HEAD(&sub->ie_vals, entry))) {
 		ast_event_ie_val_destroy(ie_val);
+	}
 
 	ast_free(sub);
 }
@@ -751,14 +800,15 @@
 	if (ast_event_check_subscriber(AST_EVENT_UNSUB,
 		AST_EVENT_IE_EVENTTYPE, AST_EVENT_IE_PLTYPE_UINT, sub->type,
 		AST_EVENT_IE_END) != AST_EVENT_SUB_NONE) {
-		
+
 		event = ast_event_new(AST_EVENT_UNSUB,
 			AST_EVENT_IE_UNIQUEID,  AST_EVENT_IE_PLTYPE_UINT, sub->uniqueid,
 			AST_EVENT_IE_EVENTTYPE, AST_EVENT_IE_PLTYPE_UINT, sub->type,
 			AST_EVENT_IE_END);
 
-		if (event)
+		if (event) {
 			ast_event_queue(event);
+		}
 	}
 
 	ast_event_sub_destroy(sub);
@@ -771,7 +821,6 @@
 	iterator->event_len = ntohs(event->event_len);
 	iterator->event = event;
 	iterator->ie = (struct ast_event_ie *) ( ((char *) event) + sizeof(*event) );
-	return;
 }
 
 int ast_event_iterator_next(struct ast_event_iterator *iterator)
@@ -842,8 +891,9 @@
 	int res = 0;
 
 	for (ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
-		if (ast_event_iterator_get_ie_type(&iterator) == ie_type)
+		if (ast_event_iterator_get_ie_type(&iterator) == ie_type) {
 			return ast_event_iterator_get_ie_raw(&iterator);
+		}
 	}
 
 	return NULL;
@@ -881,8 +931,9 @@
 	event_len = ntohs((*event)->event_len);
 	extra_len = sizeof(*ie) + data_len;
 
-	if (!(*event = ast_realloc(*event, event_len + extra_len)))
-		return -1;
+	if (!(*event = ast_realloc(*event, event_len + extra_len))) {
+		return -1;
+	}
 
 	ie = (struct ast_event_ie *) ( ((char *) *event) + event_len );
 	ie->ie_type = htons(ie_type);
@@ -915,40 +966,70 @@
 		ie_type = va_arg(ap, enum ast_event_type))
 	{
 		struct ast_event_ie_val *ie_value = alloca(sizeof(*ie_value));
+		int insert = 1;
 		memset(ie_value, 0, sizeof(*ie_value));
 		ie_value->ie_type = ie_type;
 		ie_value->ie_pltype = va_arg(ap, enum ast_event_ie_pltype);
-		if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
+		switch (ie_value->ie_pltype) {
+		case AST_EVENT_IE_PLTYPE_UINT:
 			ie_value->payload.uint = va_arg(ap, uint32_t);
-		else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
-			ie_value->payload.str = ast_strdupa(va_arg(ap, const char *));
-		else if (ie_value->ie_pltype == AST_EVENT_IE_PLTYPE_RAW) {
+			break;
+		case AST_EVENT_IE_PLTYPE_STR:
+			ie_value->payload.str = va_arg(ap, const char *);
+			break;
+		case AST_EVENT_IE_PLTYPE_RAW:
+		{
 			void *data = va_arg(ap, void *);
 			size_t datalen = va_arg(ap, size_t);
 			ie_value->payload.raw = alloca(datalen);
 			memcpy(ie_value->payload.raw, data, datalen);
 			ie_value->raw_datalen = datalen;
-		}
-		AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
+			break;
+		}
+		case AST_EVENT_IE_PLTYPE_UNKNOWN:
+			insert = 0;
+			break;
+		case AST_EVENT_IE_PLTYPE_EXISTS:
+			break;
+		}
+
+		if (insert) {
+			AST_LIST_INSERT_TAIL(&ie_vals, ie_value, entry);
+		}
 	}
 	va_end(ap);
 
-	if (!(event = ast_calloc(1, sizeof(*event))))
+	if (!(event = ast_calloc(1, sizeof(*event)))) {
 		return NULL;
+	}
 
 	event->type = htons(type);
 	event->event_len = htons(sizeof(*event));
 
 	AST_LIST_TRAVERSE(&ie_vals, ie_val, entry) {
-		if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR)
+		switch (ie_val->ie_pltype) {
+		case AST_EVENT_IE_PLTYPE_STR:
 			ast_event_append_ie_str(&event, ie_val->ie_type, ie_val->payload.str);
-		else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT)
+			break;
+		case AST_EVENT_IE_PLTYPE_UINT:
 			ast_event_append_ie_uint(&event, ie_val->ie_type, ie_val->payload.uint);
-		else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_RAW)
-			ast_event_append_ie_raw(&event, ie_val->ie_type, ie_val->payload.raw, ie_val->raw_datalen);
-
-		if (!event)
-			break;
+			break;
+		case AST_EVENT_IE_PLTYPE_RAW:
+			ast_event_append_ie_raw(&event, ie_val->ie_type,
+					ie_val->payload.raw, ie_val->raw_datalen);
+			break;
+		case AST_EVENT_IE_PLTYPE_EXISTS:
+			ast_log(LOG_WARNING, "PLTYPE_EXISTS unsupported in event_new\n");
+			break;
+		case AST_EVENT_IE_PLTYPE_UNKNOWN:
+			ast_log(LOG_WARNING, "PLTYPE_UNKNOWN passed as an IE type "
+					"for a new event\n");
+			break;
+		}
+
+		if (!event) {
+			break;
+		}
 	}
 
 	if (!ast_event_get_ie_raw(event, AST_EVENT_IE_EID)) {

Modified: team/group/security_events/main/logger.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/main/logger.c?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/main/logger.c (original)
+++ team/group/security_events/main/logger.c Sat May  2 16:27:48 2009
@@ -106,8 +106,7 @@
 
 static struct {
 	unsigned int queue_log:1;
-	unsigned int event_log:1;
-} logfiles = { 1, 1 };
+} logfiles = { 1 };
 
 static char hostname[MAXHOSTNAMELEN];
 
@@ -151,13 +150,12 @@
 static ast_cond_t logcond;
 static int close_logger_thread;
 
-static FILE *eventlog;
 static FILE *qlog;
 
 /*! \brief Logging channels used in the Asterisk logging system */
 static char *levels[] = {
 	"DEBUG",
-	"EVENT",
+	"---EVENT---",		/* no longer used */
 	"NOTICE",
 	"WARNING",
 	"ERROR",
@@ -197,8 +195,6 @@
 			res |= (1 << __LOG_WARNING);
 		else if (!strcasecmp(w, "notice"))
 			res |= (1 << __LOG_NOTICE);
-		else if (!strcasecmp(w, "event"))
-			res |= (1 << __LOG_EVENT);
 		else if (!strcasecmp(w, "debug"))
 			res |= (1 << __LOG_DEBUG);
 		else if (!strcasecmp(w, "verbose"))
@@ -385,8 +381,6 @@
 		ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat));
 	if ((s = ast_variable_retrieve(cfg, "general", "queue_log")))
 		logfiles.queue_log = ast_true(s);
-	if ((s = ast_variable_retrieve(cfg, "general", "event_log")))
-		logfiles.event_log = ast_true(s);
 	if ((s = ast_variable_retrieve(cfg, "general", "queue_log_name")))
 		ast_copy_string(queue_log_name, s, sizeof(queue_log_name));
 	if ((s = ast_variable_retrieve(cfg, "general", "exec_after_rotate")))
@@ -595,28 +589,12 @@
 static int reload_logger(int rotate)
 {
 	char old[PATH_MAX] = "";
-	int event_rotate = rotate, queue_rotate = rotate;
+	int queue_rotate = rotate;
 	struct logchannel *f;
 	int res = 0;
 	struct stat st;
 
 	AST_RWLIST_WRLOCK(&logchannels);
-
-	if (eventlog) {
-		if (rotate < 0) {
-			/* Check filesize - this one typically doesn't need an auto-rotate */
-			snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
-			if (stat(old, &st) != 0 || st.st_size > 0x40000000) { /* Arbitrarily, 1 GB */
-				fclose(eventlog);
-				eventlog = NULL;
-			} else
-				event_rotate = 0;
-		} else {
-			fclose(eventlog);
-			eventlog = NULL;
-		}
-	} else
-		event_rotate = 0;
 
 	if (qlog) {
 		if (rotate < 0) {
@@ -626,14 +604,13 @@
 				fclose(qlog);
 				qlog = NULL;
 			} else
-				event_rotate = 0;
+				queue_rotate = 0;
 		} else {
 			fclose(qlog);
 			qlog = NULL;
 		}
 	} else 
 		queue_rotate = 0;
-	qlog = NULL;
 
 	ast_mkdir(ast_config_AST_LOG_DIR, 0777);
 
@@ -654,21 +631,6 @@
 
 	init_logger_chain(1 /* locked */);
 
-	if (logfiles.event_log) {
-		snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
-		if (event_rotate)
-			rotate_file(old);
-
-		eventlog = fopen(old, "a");
-		if (eventlog) {
-			ast_log(LOG_EVENT, "Restarted Asterisk Event Logger\n");
-			ast_verb(1, "Asterisk Event Logger restarted\n");
-		} else {
-			ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
-			res = -1;
-		}
-	}
-
 	if (logfiles.queue_log) {
 		snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
 		if (queue_rotate)
@@ -679,7 +641,6 @@
 			AST_RWLIST_UNLOCK(&logchannels);
 			ast_queue_log("NONE", "NONE", "NONE", "CONFIGRELOAD", "%s", "");
 			AST_RWLIST_WRLOCK(&logchannels);
-			ast_log(LOG_EVENT, "Restarted Asterisk Queue Logger\n");
 			ast_verb(1, "Asterisk Queue Logger restarted\n");
 		} else {
 			ast_log(LOG_ERROR, "Unable to create queue log: %s\n", strerror(errno));
@@ -815,8 +776,6 @@
 			ast_cli(a->fd, "Notice ");
 		if (chan->logmask & (1 << __LOG_ERROR)) 
 			ast_cli(a->fd, "Error ");
-		if (chan->logmask & (1 << __LOG_EVENT)) 
-			ast_cli(a->fd, "Event ");
 		ast_cli(a->fd, "\n");
 	}
 	AST_RWLIST_UNLOCK(&logchannels);
@@ -878,13 +837,6 @@
 	char buf[BUFSIZ];
 
 	AST_RWLIST_RDLOCK(&logchannels);
-
-	if (logfiles.event_log && logmsg->level == __LOG_EVENT) {
-		fprintf(eventlog, "%s asterisk[%ld]: %s", logmsg->date, (long)getpid(), logmsg->str);
-		fflush(eventlog);
-		AST_RWLIST_UNLOCK(&logchannels);
-		return;
-	}
 
 	if (!AST_RWLIST_EMPTY(&logchannels)) {
 		AST_RWLIST_TRAVERSE(&logchannels, chan, list) {
@@ -949,7 +901,6 @@
 	/* If we need to reload because of the file size, then do so */
 	if (filesize_reload_needed) {
 		reload_logger(-1);
-		ast_log(LOG_EVENT, "Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
 		ast_verb(1, "Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
 	}
 
@@ -1035,19 +986,6 @@
 	/* create log channels */
 	init_logger_chain(0 /* locked */);
 
-	/* create the eventlog */
-	if (logfiles.event_log) {
-		snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
-		eventlog = fopen(tmp, "a");
-		if (eventlog) {
-			ast_log(LOG_EVENT, "Started Asterisk Event Logger\n");
-			ast_verb(1, "Asterisk Event Logger Started %s\n", tmp);
-		} else {
-			ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
-			res = -1;
-		}
-	}
-
 	if (logfiles.queue_log) {
 		snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
 		qlog = fopen(tmp, "a");
@@ -1070,11 +1008,6 @@
 		pthread_join(logthread, NULL);
 
 	AST_RWLIST_WRLOCK(&logchannels);
-
-	if (eventlog) {
-		fclose(eventlog);
-		eventlog = NULL;
-	}
 
 	if (qlog) {
 		fclose(qlog);

Modified: team/group/security_events/main/manager.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/main/manager.c?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/main/manager.c (original)
+++ team/group/security_events/main/manager.c Sat May  2 16:27:48 2009
@@ -1850,7 +1850,6 @@
 	if (manager_displayconnects(s->session)) {
 		ast_verb(2, "%sManager '%s' logged on from %s\n", (s->session->managerid ? "HTTP " : ""), s->session->username, ast_inet_ntoa(s->session->sin.sin_addr));
 	}
-	ast_log(LOG_EVENT, "%sManager '%s' logged on from %s\n", (s->session->managerid ? "HTTP " : ""), s->session->username, ast_inet_ntoa(s->session->sin.sin_addr));
 	astman_send_ack(s, m, "Authentication accepted");
 	return 0;
 }
@@ -3415,12 +3414,10 @@
 		if (manager_displayconnects(session)) {
 			ast_verb(2, "Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 		}
-		ast_log(LOG_EVENT, "Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 	} else {
 		if (displayconnects) {
 			ast_verb(2, "Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(session->sin.sin_addr));
 		}
-		ast_log(LOG_EVENT, "Failed attempt from %s\n", ast_inet_ntoa(session->sin.sin_addr));
 	}
 
 	/* It is possible under certain circumstances for this session thread
@@ -4153,12 +4150,10 @@
 			if (manager_displayconnects(session)) {
 				ast_verb(2, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 			}
-			ast_log(LOG_EVENT, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 		} else {
 			if (displayconnects) {
 				ast_verb(2, "HTTP Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(session->sin.sin_addr));
 			}
-			ast_log(LOG_EVENT, "HTTP Failed attempt from %s\n", ast_inet_ntoa(session->sin.sin_addr));
 		}
 		session->needdestroy = 1;
 	}
@@ -4420,9 +4415,6 @@
 		}
 		session->noncetime = session->sessionstart = time_now;
 		session->authenticated = 1;
-
-		ast_log(LOG_EVENT, "HTTP Manager '%s' logged in from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
-
 	} else if (stale) {
 		/*
 		 * Session found, but nonce is stale.
@@ -4498,7 +4490,6 @@
 		if (u_displayconnects) {
 			ast_verb(2, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 		}
-		ast_log(LOG_EVENT, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 
 		session->needdestroy = 1;
 	}

Modified: team/group/security_events/pbx/pbx_spool.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/security_events/pbx/pbx_spool.c?view=diff&rev=191883&r1=191882&r2=191883
==============================================================================
--- team/group/security_events/pbx/pbx_spool.c (original)
+++ team/group/security_events/pbx/pbx_spool.c Sat May  2 16:27:48 2009
@@ -339,7 +339,7 @@
 		ast_log(LOG_NOTICE, "Call failed to go through, reason (%d) %s\n", reason, ast_channel_reason2str(reason));
 		if (o->retries >= o->maxretries + 1) {
 			/* Max retries exceeded */
-			ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
+			ast_log(LOG_NOTICE, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
 			remove_from_queue(o, "Expired");
 		} else {
 			/* Notate that the call is still active */
@@ -347,7 +347,6 @@
 		}
 	} else {
 		ast_log(LOG_NOTICE, "Call completed to %s/%s\n", o->tech, o->dest);
-		ast_log(LOG_EVENT, "Queued call to %s/%s completed\n", o->tech, o->dest);
 		remove_from_queue(o, "Completed");
 	}
 	free_outgoing(o);
@@ -425,7 +424,7 @@
 		}
 		res = now;
 	} else {
-		ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
+		ast_log(LOG_NOTICE, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
 		remove_from_queue(o, "Expired");
 		free_outgoing(o);
 	}




More information about the asterisk-commits mailing list