[asterisk-commits] branch oej/metermaids r9281 - in /team/oej/metermaids: ./ apps/ cdr/ channels...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 9 06:58:24 MST 2006


Author: oej
Date: Thu Feb  9 07:58:18 2006
New Revision: 9281

URL: http://svn.digium.com/view/asterisk?rev=9281&view=rev
Log:
Merged revisions 9073,9086,9156,9232-9233,9246,9262 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r9073 | mattf | 2006-02-02 17:12:13 +0100 (Thu, 02 Feb 2006) | 2 lines

Fix for (#6309), potential (highly unlikely) memory leak in res_odbc

........
r9086 | kpfleming | 2006-02-02 19:37:04 +0100 (Thu, 02 Feb 2006) | 2 lines

don't override ASTERISKVERSIONNUM to 000000 for non-svn builds

........
r9156 | tilghman | 2006-02-05 18:10:19 +0100 (Sun, 05 Feb 2006) | 2 lines

Bug 6176 - Fix race condition

........
r9232 | mogorman | 2006-02-08 23:12:34 +0100 (Wed, 08 Feb 2006) | 4 lines

Make logger report error,warning,notice if logger.conf
not found, also updated chan_oss to give correct
error message if its config file is not found.

........
r9233 | tilghman | 2006-02-08 23:34:38 +0100 (Wed, 08 Feb 2006) | 2 lines

Leave it to RH/CentOS to put the freetds headers in a completely nonstandard location.

........
r9246 | russell | 2006-02-09 02:24:55 +0100 (Thu, 09 Feb 2006) | 2 lines

reload peercontext on iax2 reload (issue #6442)

........
r9262 | russell | 2006-02-09 03:31:21 +0100 (Thu, 09 Feb 2006) | 2 lines

add another location for postgresql headers (issue #6419)

........

Modified:
    team/oej/metermaids/   (props changed)
    team/oej/metermaids/Makefile
    team/oej/metermaids/apps/Makefile
    team/oej/metermaids/apps/app_macro.c
    team/oej/metermaids/cdr/Makefile
    team/oej/metermaids/channels/chan_iax2.c
    team/oej/metermaids/channels/chan_oss.c
    team/oej/metermaids/logger.c
    team/oej/metermaids/res/res_odbc.c

Propchange: team/oej/metermaids/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Feb  9 07:58:18 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-7496,7498-8984
+/branches/1.2:1-7496,7498-9280

Modified: team/oej/metermaids/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/Makefile?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/Makefile (original)
+++ team/oej/metermaids/Makefile Thu Feb  9 07:58:18 2006
@@ -327,8 +327,6 @@
   ifneq ($(wildcard .svn),)
     ASTERISKVERSIONNUM=999999
     ASTERISKVERSION=SVN-$(shell build_tools/make_svn_branch_name)
-  else
-    ASTERISKVERSIONNUM=000000
   endif
 endif
 

Modified: team/oej/metermaids/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/apps/Makefile?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/apps/Makefile (original)
+++ team/oej/metermaids/apps/Makefile Thu Feb  9 07:58:18 2006
@@ -99,7 +99,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/oej/metermaids/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/apps/app_macro.c?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/apps/app_macro.c (original)
+++ team/oej/metermaids/apps/app_macro.c Thu Feb  9 07:58:18 2006
@@ -112,7 +112,7 @@
 	char oldcontext[AST_MAX_CONTEXT] = "";
 	int offset, depth = 0;
 	int setmacrocontext=0;
-	int autoloopflag;
+	int autoloopflag, dead = 0;
   
 	char *save_macro_exten;
 	char *save_macro_context;
@@ -213,8 +213,8 @@
 				break;
 			}
 			switch(res) {
-	        	case MACRO_EXIT_RESULT:
-                        	res = 0;
+			case MACRO_EXIT_RESULT:
+				res = 0;
 				goto out;
 			case AST_PBX_KEEPALIVE:
 				if (option_debug)
@@ -228,6 +228,7 @@
 					ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
 				else if (option_verbose > 1)
 					ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
+				dead = 1;
 				goto out;
 			}
 		}
@@ -247,37 +248,44 @@
 	out:
 	/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
 	snprintf(depthc, sizeof(depthc), "%d", depth);
-	pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
-
-	ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
-  	for (x=1; x<argc; x++) {
+	if (!dead) {
+		pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
+
+		ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
+	}
+
+  	for (x = 1; x < argc; x++) {
   		/* Restore old arguments and delete ours */
 		snprintf(varname, sizeof(varname), "ARG%d", x);
   		if (oldargs[x]) {
-			pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
+			if (!dead)
+				pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
 			free(oldargs[x]);
-		} else {
+		} else if (!dead) {
 			pbx_builtin_setvar_helper(chan, varname, NULL);
 		}
   	}
 
 	/* Restore macro variables */
-	pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
+	if (!dead) {
+		pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
+		pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
+		pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
+	}
 	if (save_macro_exten)
 		free(save_macro_exten);
-	pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
 	if (save_macro_context)
 		free(save_macro_context);
-	pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
 	if (save_macro_priority)
 		free(save_macro_priority);
-	if (setmacrocontext) {
+
+	if (!dead && setmacrocontext) {
 		chan->macrocontext[0] = '\0';
 		chan->macroexten[0] = '\0';
 		chan->macropriority = 0;
 	}
 
-	if (!strcasecmp(chan->context, fullmacro)) {
+	if (!dead && !strcasecmp(chan->context, fullmacro)) {
   		/* If we're leaving the macro normally, restore original information */
 		chan->priority = oldpriority;
 		ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
@@ -297,7 +305,8 @@
 		}
 	}
 
-	pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
+	if (!dead)
+		pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
 	if (save_macro_offset)
 		free(save_macro_offset);
 	LOCAL_USER_REMOVE(u);

Modified: team/oej/metermaids/cdr/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/cdr/Makefile?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/cdr/Makefile (original)
+++ team/oej/metermaids/cdr/Makefile Thu Feb  9 07:58:18 2006
@@ -45,11 +45,11 @@
 #
 # FreeTDS stuff...
 #
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h),)
-  ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.63),1)
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/tds.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/freetds/tds.h),)
+  ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/include/freetds/tdsver.h | grep -c 0.63),1)
     CFLAGS += -DFREETDS_0_63
   else
-	ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h | grep -c 0.62),1)
+	ifeq ($(shell grep -s TDS_VERSION_NO $(CROSS_COMPILE_TARGET)/usr/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/local/include/tdsver.h $(CROSS_COMPILE_TARGET)/usr/include/freetds/tdsver.h | grep -c 0.62),1)
       CFLAGS += -DFREETDS_0_62
     else
       CFLAGS += -DFREETDS_PRE_0_62

Modified: team/oej/metermaids/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/channels/chan_iax2.c?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/channels/chan_iax2.c (original)
+++ team/oej/metermaids/channels/chan_iax2.c Thu Feb  9 07:58:18 2006
@@ -8154,6 +8154,7 @@
 		peer->pokefreqok = DEFAULT_FREQ_OK;
 		peer->pokefreqnotok = DEFAULT_FREQ_NOTOK;
 		peer->context[0] = '\0';
+		peer->peercontext[0] = '\0';
 		while(v) {
 			if (!strcasecmp(v->name, "secret")) {
 				if (!ast_strlen_zero(peer->secret)) {

Modified: team/oej/metermaids/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/channels/chan_oss.c?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/channels/chan_oss.c (original)
+++ team/oej/metermaids/channels/chan_oss.c Thu Feb  9 07:58:18 2006
@@ -1395,6 +1395,9 @@
 			store_config(cfg, ctg);
 		} while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
 		ast_config_destroy(cfg);
+	} else {
+		 ast_log(LOG_NOTICE, "Unable to load config oss.conf\n");
+		 return -1;
 	}
 	if (find_desc(oss_active) == NULL) {
 		ast_log(LOG_NOTICE, "Device %s not found\n", oss_active);

Modified: team/oej/metermaids/logger.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/logger.c?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/logger.c (original)
+++ team/oej/metermaids/logger.c Thu Feb  9 07:58:18 2006
@@ -314,9 +314,18 @@
 	
 	cfg = ast_config_load("logger.conf");
 	
-	/* If no config file, we're fine */
-	if (!cfg)
+	/* If no config file, we're fine, set default options. */
+	if (!cfg) {
+		fprintf(stderr, "Unable to open logger.conf: %s\n", strerror(errno));
+		chan = malloc(sizeof(struct logchannel));
+		memset(chan, 0, sizeof(struct logchannel));
+		chan->type = LOGTYPE_CONSOLE;
+		chan->logmask = 28; /*warning,notice,error */
+		chan->next = logchannels;
+		logchannels = chan;
+		global_logmask |= chan->logmask;
 		return;
+	}
 	
 	ast_mutex_lock(&loglock);
 	if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) {

Modified: team/oej/metermaids/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/res/res_odbc.c?rev=9281&r1=9280&r2=9281&view=diff
==============================================================================
--- team/oej/metermaids/res/res_odbc.c (original)
+++ team/oej/metermaids/res/res_odbc.c Thu Feb  9 07:58:18 2006
@@ -430,39 +430,41 @@
 {
 	static odbc_obj *new;
 
-	new = malloc(sizeof(odbc_obj));
-	if (!new)
-		return NULL;
-	memset(new, 0, sizeof(odbc_obj));
-	new->env = SQL_NULL_HANDLE;
-
-	new->name = malloc(strlen(name) + 1);
-	if (new->name == NULL)
-		return NULL;
-
-	new->dsn = malloc(strlen(dsn) + 1);
-	if (new->dsn == NULL)
-		return NULL;
+	if (!(new = calloc(1, sizeof(*new))) || 
+	    !(new->name = malloc(strlen(name) + 1)) || 
+	    !(new->dsn = malloc(strlen(dsn) + 1)))
+	    	goto cleanup;
 
 	if (username) {
-		new->username = malloc(strlen(username) + 1);
-		if (new->username == NULL)
-			return NULL;
+		if (!(new->username = malloc(strlen(username) + 1)))
+			goto cleanup;
 		strcpy(new->username, username);
 	}
 
 	if (password) {
-		new->password = malloc(strlen(password) + 1);
-		if (new->password == NULL)
-			return NULL;
+		if (!(new->password = malloc(strlen(password) + 1)))
+			goto cleanup;
 		strcpy(new->password, password);
 	}
 
 	strcpy(new->name, name);
 	strcpy(new->dsn, dsn);
+	new->env = SQL_NULL_HANDLE;
 	new->up = 0;
 	ast_mutex_init(&new->lock);
 	return new;
+
+cleanup:
+	if (new) {
+		free(new->name);
+		free(new->dsn);
+		free(new->username);
+		free(new->password);
+
+		free(new);	
+	}
+
+	return NULL;
 }
 
 void destroy_odbc_obj(odbc_obj **obj)



More information about the asterisk-commits mailing list