[asterisk-commits] branch russell/autoconf_and_menuselect - r8453 in /team/russell/autoconf_and_...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Jan 22 18:13:48 MST 2006


Author: russell
Date: Sun Jan 22 19:13:18 2006
New Revision: 8453

URL: http://svn.digium.com/view/asterisk?rev=8453&view=rev
Log:
Merged revisions 8401-8404,8407-8411,8413,8420-8422,8426,8428,8432,8436,8438,8443,8446-8447 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r8401 | russell | 2006-01-21 15:20:06 -0500 (Sat, 21 Jan 2006) | 3 lines

finish reverting my pass through the tree to remove checks of the result of
ast_strdupa, this one is revision 8362

................
r8402 | tilghman | 2006-01-21 15:32:17 -0500 (Sat, 21 Jan 2006) | 2 lines

Bug 5936 - Cannot AddQueueMember on realtime queue, if queue not yet loaded (different fix than 1.2)

................
r8403 | russell | 2006-01-21 15:57:06 -0500 (Sat, 21 Jan 2006) | 2 lines

on this pass, only remove duplicate log messages

................
r8404 | russell | 2006-01-21 15:58:57 -0500 (Sat, 21 Jan 2006) | 1 line


................
r8407 | russell | 2006-01-21 16:29:06 -0500 (Sat, 21 Jan 2006) | 2 lines

clean up formatting to conform to coding guidelines and fix some typos (issue #6260)

................
r8408 | russell | 2006-01-21 16:50:09 -0500 (Sat, 21 Jan 2006) | 5 lines

- conversion to allocation wrappers
- get rid of some compiler warnings due to usused variables and const-ification
- remove some unnecessary uses of malloc/strncpy/free and replace with ast_strdupa
(based on the patch from issue #6275)

................
r8409 | russell | 2006-01-21 16:57:01 -0500 (Sat, 21 Jan 2006) | 2 lines

oops, don't build app_sql_postgres by default ...

................
r8410 | russell | 2006-01-21 17:09:06 -0500 (Sat, 21 Jan 2006) | 5 lines

- conversions to allocation wrappers
- replace malloc/memset with ast_calloc
- replace malloc/ast_copy_string with ast_strdup
(based on patch from issue #6299)

................
r8411 | russell | 2006-01-21 18:05:19 -0500 (Sat, 21 Jan 2006) | 2 lines

const-ify some fields in the ast_exten and ast_include structures (issue #6270)

................
r8413 | russell | 2006-01-21 18:17:52 -0500 (Sat, 21 Jan 2006) | 1 line


................
r8420 | russell | 2006-01-21 21:06:33 -0500 (Sat, 21 Jan 2006) | 1 line


................
r8421 | russell | 2006-01-21 21:10:19 -0500 (Sat, 21 Jan 2006) | 3 lines

prevent writing outside of the provided workspace when calculating a
substring (issue #6271)

................
r8422 | russell | 2006-01-21 21:23:38 -0500 (Sat, 21 Jan 2006) | 2 lines

add 'show channeltype' CLI command (issue #6149, with small modifications)

................
r8426 | tilghman | 2006-01-22 02:18:02 -0500 (Sun, 22 Jan 2006) | 2 lines

Bug 6148 - Add PARKEDAT variable; also cleaned up application help to fit 80-column screen.

................
r8428 | tilghman | 2006-01-22 03:09:02 -0500 (Sun, 22 Jan 2006) | 2 lines

Bug 6262 - New function STRPTIME

................
r8432 | bweschke | 2006-01-22 10:08:51 -0500 (Sun, 22 Jan 2006) | 2 lines

 Correct some scenarios where CALL_LIMIT could not be getting adjusted properly allowing chan_sip to send calls when it really shouldn't. Bug #6111

................
r8436 | tilghman | 2006-01-22 12:28:42 -0500 (Sun, 22 Jan 2006) | 2 lines

Bug 6312 - Macro janitor

................
r8438 | russell | 2006-01-22 12:53:14 -0500 (Sun, 22 Jan 2006) | 10 lines

Merged revisions 8437 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r8437 | russell | 2006-01-22 12:47:13 -0500 (Sun, 22 Jan 2006) | 2 lines

fix MixMonitor crash (issue #6321, probably others)

........

................
r8443 | russell | 2006-01-22 13:42:06 -0500 (Sun, 22 Jan 2006) | 2 lines

eliminate some compiler warnings

................
r8446 | russell | 2006-01-22 14:04:37 -0500 (Sun, 22 Jan 2006) | 1 line


................
r8447 | russell | 2006-01-22 14:09:50 -0500 (Sun, 22 Jan 2006) | 2 lines

fix memory leak from not freeing the list of queue members when freeing a queue

................

Modified:
    team/russell/autoconf_and_menuselect/   (props changed)
    team/russell/autoconf_and_menuselect/app.c
    team/russell/autoconf_and_menuselect/apps/Makefile
    team/russell/autoconf_and_menuselect/apps/app_authenticate.c
    team/russell/autoconf_and_menuselect/apps/app_chanspy.c
    team/russell/autoconf_and_menuselect/apps/app_curl.c
    team/russell/autoconf_and_menuselect/apps/app_db.c
    team/russell/autoconf_and_menuselect/apps/app_dial.c
    team/russell/autoconf_and_menuselect/apps/app_dictate.c
    team/russell/autoconf_and_menuselect/apps/app_directory.c
    team/russell/autoconf_and_menuselect/apps/app_disa.c
    team/russell/autoconf_and_menuselect/apps/app_exec.c
    team/russell/autoconf_and_menuselect/apps/app_externalivr.c
    team/russell/autoconf_and_menuselect/apps/app_festival.c
    team/russell/autoconf_and_menuselect/apps/app_hasnewvoicemail.c
    team/russell/autoconf_and_menuselect/apps/app_image.c
    team/russell/autoconf_and_menuselect/apps/app_macro.c
    team/russell/autoconf_and_menuselect/apps/app_meetme.c
    team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c
    team/russell/autoconf_and_menuselect/apps/app_osplookup.c
    team/russell/autoconf_and_menuselect/apps/app_page.c
    team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c
    team/russell/autoconf_and_menuselect/apps/app_playback.c
    team/russell/autoconf_and_menuselect/apps/app_privacy.c
    team/russell/autoconf_and_menuselect/apps/app_queue.c
    team/russell/autoconf_and_menuselect/apps/app_random.c
    team/russell/autoconf_and_menuselect/apps/app_read.c
    team/russell/autoconf_and_menuselect/apps/app_readfile.c
    team/russell/autoconf_and_menuselect/apps/app_record.c
    team/russell/autoconf_and_menuselect/apps/app_sayunixtime.c
    team/russell/autoconf_and_menuselect/apps/app_senddtmf.c
    team/russell/autoconf_and_menuselect/apps/app_sendtext.c
    team/russell/autoconf_and_menuselect/apps/app_setcallerid.c
    team/russell/autoconf_and_menuselect/apps/app_skel.c
    team/russell/autoconf_and_menuselect/apps/app_sql_postgres.c
    team/russell/autoconf_and_menuselect/apps/app_stack.c
    team/russell/autoconf_and_menuselect/apps/app_talkdetect.c
    team/russell/autoconf_and_menuselect/apps/app_transfer.c
    team/russell/autoconf_and_menuselect/apps/app_url.c
    team/russell/autoconf_and_menuselect/apps/app_userevent.c
    team/russell/autoconf_and_menuselect/apps/app_verbose.c
    team/russell/autoconf_and_menuselect/apps/app_voicemail.c
    team/russell/autoconf_and_menuselect/apps/app_while.c
    team/russell/autoconf_and_menuselect/apps/app_zapras.c
    team/russell/autoconf_and_menuselect/callerid.c
    team/russell/autoconf_and_menuselect/channel.c
    team/russell/autoconf_and_menuselect/channels/chan_agent.c
    team/russell/autoconf_and_menuselect/channels/chan_iax2.c
    team/russell/autoconf_and_menuselect/channels/chan_sip.c
    team/russell/autoconf_and_menuselect/doc/README.variables
    team/russell/autoconf_and_menuselect/funcs/func_cdr.c
    team/russell/autoconf_and_menuselect/funcs/func_cut.c
    team/russell/autoconf_and_menuselect/funcs/func_logic.c
    team/russell/autoconf_and_menuselect/funcs/func_math.c
    team/russell/autoconf_and_menuselect/funcs/func_md5.c
    team/russell/autoconf_and_menuselect/funcs/func_strings.c
    team/russell/autoconf_and_menuselect/include/asterisk/astosp.h
    team/russell/autoconf_and_menuselect/pbx.c
    team/russell/autoconf_and_menuselect/res/res_crypto.c
    team/russell/autoconf_and_menuselect/res/res_features.c
    team/russell/autoconf_and_menuselect/res/res_indications.c
    team/russell/autoconf_and_menuselect/res/res_monitor.c
    team/russell/autoconf_and_menuselect/res/res_musiconhold.c
    team/russell/autoconf_and_menuselect/res/res_osp.c

Propchange: team/russell/autoconf_and_menuselect/
------------------------------------------------------------------------------
--- svnmerge-blocked (original)
+++ svnmerge-blocked Sun Jan 22 19:13:18 2006
@@ -1,1 +1,1 @@
-/branches/1.2:7490,7497,7517,7529,7546,7550,7552,7557,7580,7586,7595,7605,7641,7663,7706,7738,7771,7792,7812,7870-7871,7898-7900,7915,7960,7965,7970,7976,8047,8112
+/branches/1.2:7490,7497,7517,7529,7546,7550,7552,7557,7580,7586,7595,7605,7641,7663,7706,7738,7771,7792,7812,7870-7871,7898-7900,7915,7960,7965,7970,7976,8047,8112,8394,8412,8418,8445

Propchange: team/russell/autoconf_and_menuselect/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Jan 22 19:13:18 2006
@@ -1,1 +1,1 @@
-/trunk:1-8398
+/trunk:1-8452

Modified: team/russell/autoconf_and_menuselect/app.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/app.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/app.c (original)
+++ team/russell/autoconf_and_menuselect/app.c Sun Jan 22 19:13:18 2006
@@ -1358,11 +1358,12 @@
 	case AST_ACTION_BACKLIST:
 		res = 0;
 		c = ast_strdupa(option->adata);
-		while ((n = strsep(&c, ";"))) {
-			if ((res = ast_streamfile(chan, n, chan->language)) || (res = ast_waitstream(chan, (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
-				break;
-		}
-		ast_stopstream(chan);
+		if (c) {
+			while((n = strsep(&c, ";")))
+				if ((res = ast_streamfile(chan, n, chan->language)) || (res = ast_waitstream(chan, (option->action == AST_ACTION_BACKLIST) ? AST_DIGIT_ANY : "")))
+					break;
+			ast_stopstream(chan);
+		}
 		return res;
 	default:
 		ast_log(LOG_NOTICE, "Unknown dispatch function %d, ignoring!\n", option->action);

Modified: team/russell/autoconf_and_menuselect/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/Makefile?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/Makefile (original)
+++ team/russell/autoconf_and_menuselect/apps/Makefile Sun Jan 22 19:13:18 2006
@@ -103,7 +103,7 @@
 	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} $(CURLLIBS)
 
 app_sql_postgres.o: app_sql_postgres.c
-	$(CC) -pipe -I/usr/local/pgsql/include $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
+	$(CC) -pipe -I$(CROSS_COMPILE_TARGET)/usr/local/pgsql/include -I$(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CFLAGS) -c -o app_sql_postgres.o app_sql_postgres.c
 
 app_sql_postgres.so: app_sql_postgres.o
 	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -L/usr/local/pgsql/lib -lpq

Modified: team/russell/autoconf_and_menuselect/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_authenticate.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_authenticate.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_authenticate.c Sun Jan 22 19:13:18 2006
@@ -128,7 +128,10 @@
 		}
 	}
 	
-	argcopy = ast_strdupa(data);
+	if (!(argcopy = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(arglist,argcopy);
 	

Modified: team/russell/autoconf_and_menuselect/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_chanspy.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_chanspy.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_chanspy.c Sun Jan 22 19:13:18 2006
@@ -383,7 +383,8 @@
 	struct ast_flags flags;
 	signed char zero_volume = 0;
 
-	args = ast_strdupa(data);
+	if (!(args = ast_strdupa(data)))
+		return -1;
 
 	LOCAL_USER_ADD(u);
 

Modified: team/russell/autoconf_and_menuselect/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_curl.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_curl.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_curl.c Sun Jan 22 19:13:18 2006
@@ -128,7 +128,10 @@
 
 	LOCAL_USER_ACF_ADD(u);
 
-	info = ast_strdupa(data);
+	if (!(info = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return buf;
+	}
 
 	AST_STANDARD_APP_ARGS(args, info);	
 	

Modified: team/russell/autoconf_and_menuselect/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_db.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_db.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_db.c Sun Jan 22 19:13:18 2006
@@ -75,7 +75,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	argv = ast_strdupa(data);
+	if (!(argv = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return 0;
+	}
 
 	if (strchr(argv, '/')) {
 		family = strsep(&argv, "/");
@@ -116,7 +119,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	argv = ast_strdupa(data);
+	if (!(argv = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return 0;
+	}
 
 	if (strchr(argv, '/')) {
 		family = strsep(&argv, "/");

Modified: team/russell/autoconf_and_menuselect/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_dial.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_dial.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_dial.c Sun Jan 22 19:13:18 2006
@@ -786,7 +786,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -1623,7 +1626,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	announce = ast_strdupa(data);	
+	if (!(announce = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	memset(&peerflags, 0, sizeof(peerflags));
 

Modified: team/russell/autoconf_and_menuselect/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_dictate.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_dictate.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_dictate.c Sun Jan 22 19:13:18 2006
@@ -110,7 +110,8 @@
 	
 	snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
 	if (!ast_strlen_zero(data)) {
-		parse = ast_strdupa(data);
+		if (!(parse = ast_strdupa(data)))
+			return -1;
 		AST_STANDARD_APP_ARGS(args, parse);
 	} else
 		args.argc = 0;

Modified: team/russell/autoconf_and_menuselect/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_directory.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_directory.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_directory.c Sun Jan 22 19:13:18 2006
@@ -431,7 +431,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1; 
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 		

Modified: team/russell/autoconf_and_menuselect/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_disa.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_disa.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_disa.c Sun Jan 22 19:13:18 2006
@@ -161,7 +161,10 @@
 	ast_log(LOG_DEBUG, "Digittimeout: %d\n", digittimeout);
 	ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
 
-	tmp = ast_strdupa(data);
+	if (!(tmp = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}	
 
 	AST_STANDARD_APP_ARGS(args, tmp);
 

Modified: team/russell/autoconf_and_menuselect/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_exec.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_exec.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_exec.c Sun Jan 22 19:13:18 2006
@@ -73,9 +73,7 @@
 
 	/* Check and parse arguments */
 	if (data) {
-		s = ast_strdupa(data);
-		appname = strsep(&s, "(");
-		if (s) {
+		if ((s = ast_strdupa(data))) {
 			endargs = strrchr(s, ')');
 			if (endargs)
 				*endargs = '\0';
@@ -89,7 +87,17 @@
 				ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
 				res = -1;
 			}
-		}
+			if (appname) {
+				app = pbx_findapp(appname);
+				if (app) {
+					res = pbx_exec(chan, app, args, 1);
+				} else {
+					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+					res = -1;
+				}
+			}
+		} else
+			res = -1;
 	}
 
 	LOCAL_USER_REMOVE(u);

Modified: team/russell/autoconf_and_menuselect/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_externalivr.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_externalivr.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_externalivr.c Sun Jan 22 19:13:18 2006
@@ -271,7 +271,10 @@
 		goto exit;
 	}
 
-	buf = ast_strdupa(data);
+	if (!(buf = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
 

Modified: team/russell/autoconf_and_menuselect/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_festival.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_festival.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_festival.c Sun Jan 22 19:13:18 2006
@@ -339,7 +339,11 @@
 		festivalcommand = "(tts_textasterisk \"%s\" 'file)(quit)\n";
 	}
 	
-	data = ast_strdupa(vdata);
+	if (!(data = ast_strdupa(vdata))) {
+		ast_config_destroy(cfg);
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	intstr = strchr(data, '|');
 	if (intstr) {	

Modified: team/russell/autoconf_and_menuselect/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_hasnewvoicemail.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_hasnewvoicemail.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_hasnewvoicemail.c Sun Jan 22 19:13:18 2006
@@ -129,7 +129,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	input = ast_strdupa((char *)data);
+	if (!(input = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, input);
 
@@ -188,7 +191,10 @@
 
 	buf[0] = '\0';
 
-	argsstr = ast_strdupa(data);
+	if (!(argsstr = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return buf;
+	}
 
 	AST_STANDARD_APP_ARGS(args, argsstr);
 

Modified: team/russell/autoconf_and_menuselect/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_image.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_image.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_image.c Sun Jan 22 19:13:18 2006
@@ -78,7 +78,10 @@
 	
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: team/russell/autoconf_and_menuselect/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_macro.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_macro.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_macro.c Sun Jan 22 19:13:18 2006
@@ -307,7 +307,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	expr = ast_strdupa(data);
+	if (!(expr = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	if ((label_a = strchr(expr, '?'))) {
 		*label_a = '\0';

Modified: team/russell/autoconf_and_menuselect/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_meetme.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_meetme.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_meetme.c Sun Jan 22 19:13:18 2006
@@ -1778,7 +1778,8 @@
 				if (strcasecmp(var->name, "conf"))
 					continue;
 				
-				parse = ast_strdupa(var->value);
+				if (!(parse = ast_strdupa(var->value)))
+					return NULL;
 				
 				AST_STANDARD_APP_ARGS(args, parse);
 				if (!strcasecmp(args.confno, confno)) {
@@ -1834,9 +1835,10 @@
 
 	LOCAL_USER_ADD(u);
 	
-	localdata = ast_strdupa(data);
-
-	AST_STANDARD_APP_ARGS(args, localdata);
+	if (!(localdata = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	conf = find_conf(chan, args.confno, 0, 0, NULL);
 	if (conf)
@@ -1978,8 +1980,6 @@
 										}
 									}
 								}
-							} else {
-								ast_log(LOG_ERROR, "Out of memory\n");
 							}
 						}
 						var = var->next;

Modified: team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c Sun Jan 22 19:13:18 2006
@@ -333,7 +333,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 	

Modified: team/russell/autoconf_and_menuselect/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_osplookup.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_osplookup.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_osplookup.c Sun Jan 22 19:13:18 2006
@@ -138,7 +138,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	temp = ast_strdupa(data);
+	if (!(temp = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 
@@ -196,7 +199,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	temp = ast_strdupa(data);
+	if (!(temp = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 
@@ -265,7 +271,10 @@
 
 	LOCAL_USER_ADD(u);
 
-	temp = ast_strdupa(data);
+	if (!(temp = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 

Modified: team/russell/autoconf_and_menuselect/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_page.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_page.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_page.c Sun Jan 22 19:13:18 2006
@@ -163,7 +163,10 @@
 		return -1;
 	};
 
-	options = ast_strdupa(data);
+	if (!(options = ast_strdupa(data))) {
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	tmp = strsep(&options, "|");
 	if (options)

Modified: team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c Sun Jan 22 19:13:18 2006
@@ -59,12 +59,21 @@
 
 static char *descrip =
 "  ParkAndAnnounce(announce:template|timeout|dial|[return_context]):\n"
-"Park a call into the parkinglot and announce the call over the console.\n"
-"announce template: colon separated list of files to announce, the word PARKED\n"
-"                   will be replaced by a say_digits of the ext the call is parked in\n"
-"timeout: time in seconds before the call returns into the return context.\n"
-"dial: The app_dial style resource to call to make the announcement. Console/dsp calls the console.\n"
-"return_context: the goto style label to jump the call back into after timeout. default=prio+1\n";
+"Park a call into the parkinglot and announce the call to another channel.\n"
+"\n"
+"announce template: Colon-separated list of files to announce.  The word PARKED\n"
+"                   will be replaced by a say_digits of the extension in which\n"
+"                   the call is parked.\n"
+"timeout:           Time in seconds before the call returns into the return\n"
+"                   context.\n"
+"dial:              The app_dial style resource to call to make the\n"
+"                   announcement.  Console/dsp calls the console.\n"
+"return_context:    The goto-style label to jump the call back into after\n"
+"                   timeout.  Default <priority+1>.\n"
+"\n"
+"The variable ${PARKEDAT} will contain the parking extension into which the\n"
+"call was placed.  Use with the Local channel to allow the dialplan to make\n"
+"use of this information.\n";
 
 
 STANDARD_LOCAL_USER;
@@ -79,6 +88,7 @@
 	char *working, *context, *exten, *priority, *dial, *dialtech, *dialstr;
 	char *template, *tpl_working, *tpl_current;
 	char *tmp[100];
+	char buf[13];
 	int looptemp=0,i=0;
 	char *s,*orig_s;
 
@@ -183,8 +193,10 @@
 
 	/* Now place the call to the extention */
 
+	snprintf(buf, sizeof(buf), "%d", lot);
 	memset(&oh, 0, sizeof(oh));
 	oh.parent_channel = chan;
+	oh.vars = ast_variable_new("_PARKEDAT", buf);
 	dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR, dialstr,30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
 
 	if(dchan) {

Modified: team/russell/autoconf_and_menuselect/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_playback.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_playback.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_playback.c Sun Jan 22 19:13:18 2006
@@ -89,7 +89,8 @@
 		return -1;
 	}
 
-	tmp = ast_strdupa(data);
+	if (!(tmp = ast_strdupa(data)))
+		return -1;	
 
 	LOCAL_USER_ADD(u);
 	AST_STANDARD_APP_ARGS(args, tmp);

Modified: team/russell/autoconf_and_menuselect/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_privacy.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_privacy.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_privacy.c Sun Jan 22 19:13:18 2006
@@ -117,7 +117,10 @@
 
 		if (!ast_strlen_zero((char *)data))
 		{
-			parse = ast_strdupa(data);
+			if (!(parse = ast_strdupa(data))) {
+				LOCAL_USER_REMOVE(u);
+				return -1;
+			}
 			
 			AST_STANDARD_APP_ARGS(args, parse);
 

Modified: team/russell/autoconf_and_menuselect/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_queue.c?rev=8453&r1=8452&r2=8453&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_queue.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_queue.c Sun Jan 22 19:13:18 2006
@@ -367,11 +367,10 @@
 	
 	struct member *members;		/*!< Head of the list of members */
 	struct queue_ent *head;		/*!< Head of the list of callers */
-	struct ast_call_queue *next;	/*!< Next call queue */
+	AST_LIST_ENTRY(ast_call_queue) list;	/*!< Next call queue */
 };
 
-static struct ast_call_queue *queues = NULL;
-AST_MUTEX_DEFINE_STATIC(qlock);
+static AST_LIST_HEAD_STATIC(queues, ast_call_queue);
 
 static int set_member_paused(char *queuename, char *interface, int paused);
 
@@ -481,8 +480,8 @@
 	}
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Device '%s/%s' changed to state '%d' (%s)\n", technology, loc, sc->state, devstate2str(sc->state));
-	ast_mutex_lock(&qlock);
-	for (q = queues; q; q = q->next) {
+	AST_LIST_LOCK(&queues);
+	AST_LIST_TRAVERSE(&queues, q, list) {
 		ast_mutex_lock(&q->lock);
 		cur = q->members;
 		while(cur) {
@@ -508,7 +507,7 @@
 		}
 		ast_mutex_unlock(&q->lock);
 	}
-	ast_mutex_unlock(&qlock);
+	AST_LIST_UNLOCK(&queues);
 	free(sc);
 	return NULL;
 }
@@ -788,26 +787,48 @@
 	}
 }
 
+static void free_members(struct ast_call_queue *q, int all)
+{
+	/* Free non-dynamic members */
+	struct member *curm, *next, *prev = NULL;
+
+	for (curm = q->members; curm; curm = next) {
+		next = curm->next;
+		if (all || !curm->dynamic) {
+			if (prev)
+				prev->next = next;
+			else
+				q->members = next;
+			free(curm);
+		} else 
+			prev = curm;
+	}
+}
+
+static void destroy_queue(struct ast_call_queue *q)
+{
+	free_members(q, 1);
+	ast_mutex_destroy(&q->lock);
+	free(q);
+}
 
 /*!\brief Reload a single queue via realtime.
    \return Return the queue, or NULL if it doesn't exist.
-   \note Should be called with the global qlock locked.
-   When found, the queue is returned with q->lock locked. */
+   \note Should be called with the global qlock locked. */
 static struct ast_call_queue *find_queue_by_name_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
 {
 	struct ast_variable *v;
-	struct ast_call_queue *q, *prev_q = NULL;
+	struct ast_call_queue *q;
 	struct member *m, *prev_m, *next_m;
 	char *interface;
 	char *tmp, *tmp_name;
 	char tmpbuf[64];	/* Must be longer than the longest queue param name. */
 
 	/* Find the queue in the in-core list (we will create a new one if not found). */
-	for (q = queues; q; q = q->next) {
+	AST_LIST_TRAVERSE(&queues, q, list) {
 		if (!strcasecmp(q->name, queuename)) {
 			break;
 		}
-		prev_q = q;
 	}
 
 	/* Static queues override realtime. */
@@ -818,6 +839,7 @@
 				ast_mutex_unlock(&q->lock);
 				return NULL;
 			} else {
+				ast_mutex_unlock(&q->lock);
 				return q;
 			}
 		}
@@ -838,13 +860,9 @@
 			/* Delete if unused (else will be deleted when last caller leaves). */
 			if (!q->count) {
 				/* Delete. */
-				if (!prev_q) {
-					queues = q->next;
-				} else {
-					prev_q->next = q->next;
-				}
+				AST_LIST_REMOVE(&queues, q, list);
 				ast_mutex_unlock(&q->lock);
-				free(q);
+				destroy_queue(q);
 			} else
 				ast_mutex_unlock(&q->lock);
 		}
@@ -858,8 +876,7 @@
 		ast_mutex_lock(&q->lock);
 		clear_queue(q);
 		q->realtime = 1;
-		q->next = queues;
-		queues = q;
+		AST_LIST_INSERT_HEAD(&queues, q, list);
 	}
 	init_queue(q);		/* Ensure defaults for all parameters not set explicitly. */
 
@@ -911,13 +928,60 @@
 		m = next_m;
 	}
 
+	ast_mutex_unlock(&q->lock);
+
 	return q;
 }
 
-static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+static struct ast_call_queue *load_realtime_queue(char *queuename)
 {
 	struct ast_variable *queue_vars = NULL;
 	struct ast_config *member_config = NULL;
+	struct ast_call_queue *q;
+
+	/* Find the queue in the in-core list first. */
+	AST_LIST_LOCK(&queues);
+	AST_LIST_TRAVERSE(&queues, q, list) {
+		if (!strcasecmp(q->name, queuename)) {
+			break;
+		}
+	}
+	AST_LIST_UNLOCK(&queues);
+
+	if (!q) {
+		/*! \note Load from realtime before taking the global qlock, to avoid blocking all
+		   queue operations while waiting for the DB.
+
+		   This will be two separate database transactions, so we might
+		   see queue parameters as they were before another process
+		   changed the queue and member list as it was after the change.
+		   Thus we might see an empty member list when a queue is
+		   deleted. In practise, this is unlikely to cause a problem. */
+
+		queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
+		if (queue_vars) {
+			member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
+			if (!member_config) {
+				ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
+				return NULL;
+			}
+		}
+
+		AST_LIST_LOCK(&queues);
+
+		q = find_queue_by_name_rt(queuename, queue_vars, member_config);
+		if (member_config)
+			ast_config_destroy(member_config);
+		if (queue_vars)
+			ast_variables_destroy(queue_vars);
+
+		AST_LIST_UNLOCK(&queues);
+	}
+	return q;
+}
+
+static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
+{
 	struct ast_call_queue *q;
 	struct queue_ent *cur, *prev = NULL;
 	int res = -1;
@@ -925,35 +989,12 @@
 	int inserted = 0;
 	enum queue_member_status stat;
 
-	/*! \note Load from realtime before taking the global qlock, to avoid blocking all
-	   queue operations while waiting for the DB.
-
-	   This will be two separate database transactions, so we might
-	   see queue parameters as they were before another process
-	   changed the queue and member list as it was after the change.
-	   Thus we might see an empty member list when a queue is
-	   deleted. In practise, this is unlikely to cause a problem. */
-	queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
-	if (queue_vars) {
-		member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
-		if (!member_config) {
-			ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
-			return res;
-		}
-	}
-
-	ast_mutex_lock(&qlock);
-	q = find_queue_by_name_rt(queuename, queue_vars, member_config);
-	/* Note: If found, find_queue_by_name_rt() returns with q->lock locked. */
-	if(member_config)
-		ast_config_destroy(member_config);
-	if(queue_vars)
-		ast_variables_destroy(queue_vars);
-
-	if (!q) {
-		ast_mutex_unlock(&qlock);
+	q = load_realtime_queue(queuename);
+	if (!q)
 		return res;
-	}
+
+	AST_LIST_LOCK(&queues);
+	ast_mutex_lock(&q->lock);
 
 	/* This is our one */
 	stat = get_member_status(q, qe->max_penalty);
@@ -1001,50 +1042,8 @@
 #endif
 	}
 	ast_mutex_unlock(&q->lock);
-	ast_mutex_unlock(&qlock);
+	AST_LIST_UNLOCK(&queues);
 	return res;
-}
-
-static void free_members(struct ast_call_queue *q, int all)
-{
-	/* Free non-dynamic members */
-	struct member *curm, *next, *prev;
-
-	curm = q->members;
-	prev = NULL;
-	while(curm) {
-		next = curm->next;
-		if (all || !curm->dynamic) {
-			if (prev)
-				prev->next = next;
-			else
-				q->members = next;
-			free(curm);
-		} else 
-			prev = curm;
-		curm = next;
-	}
-}
-
-static void destroy_queue(struct ast_call_queue *q)
-{
-	struct ast_call_queue *cur, *prev = NULL;
-
-	ast_mutex_lock(&qlock);
-	for (cur = queues; cur; cur = cur->next) {
-		if (cur == q) {
-			if (prev)
-				prev->next = cur->next;
-			else
-				queues = cur->next;
-		} else {
-			prev = cur;
-		}
-	}
-	ast_mutex_unlock(&qlock);
-	free_members(q, 1);
-        ast_mutex_destroy(&q->lock);
-	free(q);
 }
 
 static int play_file(struct ast_channel *chan, char *filename)
@@ -1254,6 +1253,9 @@
 	ast_mutex_unlock(&q->lock);
 	if (q->dead && !q->count) {	
 		/* It's dead and nobody is in it, so kill it */
+		AST_LIST_LOCK(&queues);
+		AST_LIST_REMOVE(&queues, q, list);
+		AST_LIST_UNLOCK(&queues);
 		destroy_queue(q);
 	}
 }
@@ -1328,7 +1330,7 @@
 	
 	/* &qlock and &rq->lock already set by try_calling()
 	 * to solve deadlock */
-	for (q = queues; q; q = q->next) {
+	AST_LIST_TRAVERSE(&queues, q, list) {
 		if (q == rq) /* don't check myself, could deadlock */
 			continue; 
 		ast_mutex_lock(&q->lock);
@@ -2089,7 +2091,7 @@
 
 	/* Hold the lock while we setup the outgoing calls */
 	if (use_weight) 
-		ast_mutex_lock(&qlock);
+		AST_LIST_LOCK(&queues);
 	ast_mutex_lock(&qe->parent->lock);
 	if (option_debug)
 		ast_log(LOG_DEBUG, "%s is trying to call a queue member.\n", 
@@ -2105,7 +2107,7 @@
 		if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
 			ast_mutex_unlock(&qe->parent->lock);
 			if (use_weight) 
-				ast_mutex_unlock(&qlock);
+				AST_LIST_UNLOCK(&queues);
 			goto out;
 		}
 		tmp->stillgoing = -1;
@@ -2152,7 +2154,7 @@
 	ring_one(qe, outgoing, &numbusies);
 	ast_mutex_unlock(&qe->parent->lock);
 	if (use_weight) 
-		ast_mutex_unlock(&qlock);
+		AST_LIST_UNLOCK(&queues);
 	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT));
 	ast_mutex_lock(&qe->parent->lock);
 	if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) {
@@ -2407,8 +2409,8 @@
 	struct member *last_member, *look;
 	int res = RES_NOSUCHQUEUE;
 
-	ast_mutex_lock(&qlock);
-	for (q = queues ; q ; q = q->next) {
+	AST_LIST_LOCK(&queues);
+	AST_LIST_TRAVERSE(&queues, q, list) {
 		ast_mutex_lock(&q->lock);
 		if (!strcmp(q->name, queuename)) {
 			if ((last_member = interface_exists(q, interface))) {
@@ -2442,7 +2444,7 @@
 		}
 		ast_mutex_unlock(&q->lock);
 	}
-	ast_mutex_unlock(&qlock);
+	AST_LIST_UNLOCK(&queues);
 	return res;
 }
 
@@ -2452,45 +2454,46 @@
 	struct member *new_member;
 	int res = RES_NOSUCHQUEUE;
 
-	ast_mutex_lock(&qlock);
-	for (q = queues ; q ; q = q->next) {
+	/* \note Ensure the appropriate realtime queue is loaded.  Note that this
+	 * short-circuits if the queue is already in memory. */
+	q = load_realtime_queue(queuename);
+
+	AST_LIST_LOCK(&queues);
+
+	if (q) {
 		ast_mutex_lock(&q->lock);
-		if (!strcmp(q->name, queuename)) {
-			if (interface_exists(q, interface) == NULL) {
-				new_member = create_queue_member(interface, penalty, paused);
-
-				if (new_member != NULL) {
-					new_member->dynamic = 1;
-					new_member->next = q->members;
-					q->members = new_member;
-					manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
-						"Queue: %s\r\n"
-						"Location: %s\r\n"
-						"Membership: %s\r\n"
-						"Penalty: %d\r\n"
-						"CallsTaken: %d\r\n"
-						"LastCall: %d\r\n"
-						"Status: %d\r\n"
-						"Paused: %d\r\n",
-					q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
-					new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
+		if (interface_exists(q, interface) == NULL) {
+			new_member = create_queue_member(interface, penalty, paused);
+
+			if (new_member != NULL) {
+				new_member->dynamic = 1;
+				new_member->next = q->members;
+				q->members = new_member;
+				manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
+					"Queue: %s\r\n"
+					"Location: %s\r\n"
+					"Membership: %s\r\n"
+					"Penalty: %d\r\n"
+					"CallsTaken: %d\r\n"
+					"LastCall: %d\r\n"
+					"Status: %d\r\n"
+					"Paused: %d\r\n",
+				q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
+				new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
 					
-					if (dump)
-						dump_queue_members(q);
-
-					res = RES_OKAY;
-				} else {
-					res = RES_OUTOFMEMORY;
-				}

[... 2971 lines stripped ...]


More information about the asterisk-commits mailing list