[asterisk-commits] russell: branch russell/chan_console r72627 - in /team/russell/chan_console: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 29 10:21:19 CDT 2007


Author: russell
Date: Fri Jun 29 10:21:19 2007
New Revision: 72627

URL: http://svn.digium.com/view/asterisk?view=rev&rev=72627
Log:
Merged revisions 72539,72555,72557,72598,72600 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r72539 | qwell | 2007-06-28 16:31:00 -0500 (Thu, 28 Jun 2007) | 5 lines

Apparently some builds of gcc don't have declaration-after-statement.
This checks for it in configure, and only uses it if it's available.

If it's wrong, somebody please yell at me and tell me why.

................
r72555 | tilghman | 2007-06-28 23:45:13 -0500 (Thu, 28 Jun 2007) | 9 lines

Blocked revisions 72554 via svnmerge

........
r72554 | tilghman | 2007-06-28 23:43:15 -0500 (Thu, 28 Jun 2007) | 2 lines

Fix 1.4 breakage

........

................
r72557 | tilghman | 2007-06-28 23:56:08 -0500 (Thu, 28 Jun 2007) | 10 lines

Merged revisions 72556 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r72556 | tilghman | 2007-06-28 23:47:11 -0500 (Thu, 28 Jun 2007) | 2 lines

Issue 10055 - Change memory allocation to use the heap for a command, since the output has the potential to overflow the stack (as it did here)

........

................
r72598 | file | 2007-06-29 09:20:15 -0500 (Fri, 29 Jun 2007) | 9 lines

Blocked revisions 72597 via svnmerge

........
r72597 | file | 2007-06-29 11:18:36 -0300 (Fri, 29 Jun 2007) | 2 lines

Backport fix for GCC versions without support for declaration-after-statement.

........

................
r72600 | file | 2007-06-29 09:27:24 -0500 (Fri, 29 Jun 2007) | 9 lines

Blocked revisions 72599 via svnmerge

........
r72599 | file | 2007-06-29 11:26:32 -0300 (Fri, 29 Jun 2007) | 2 lines

Minor change for older GCC versions.

........

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

Modified:
    team/russell/chan_console/   (props changed)
    team/russell/chan_console/Makefile
    team/russell/chan_console/configure
    team/russell/chan_console/configure.ac
    team/russell/chan_console/main/manager.c
    team/russell/chan_console/makeopts.in

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/chan_console/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Jun 29 10:21:19 2007
@@ -1,1 +1,1 @@
-/trunk:1-72535
+/trunk:1-72626

Modified: team/russell/chan_console/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/Makefile?view=diff&rev=72627&r1=72626&r2=72627
==============================================================================
--- team/russell/chan_console/Makefile (original)
+++ team/russell/chan_console/Makefile Fri Jun 29 10:21:19 2007
@@ -193,7 +193,7 @@
 ASTCFLAGS+=-include $(ASTTOPDIR)/include/asterisk/autoconfig.h
 
 ifeq ($(AST_DEVMODE),yes)
-  ASTCFLAGS+=-Werror -Wunused -Wundef -Wdeclaration-after-statement
+  ASTCFLAGS+=-Werror -Wunused -Wundef $(AST_DECLARATION_AFTER_STATEMENT)
 endif
 
 ifneq ($(findstring BSD,$(OSARCH)),)

Modified: team/russell/chan_console/configure
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/configure?view=diff&rev=72627&r1=72626&r2=72627
==============================================================================
--- team/russell/chan_console/configure (original)
+++ team/russell/chan_console/configure Fri Jun 29 10:21:19 2007
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 67059 .
+# From configure.ac Revision: 72246 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61.
 #
@@ -906,6 +906,7 @@
 POW_LIB
 GC_CFLAGS
 GC_LDFLAGS
+AST_DECLARATION_AFTER_STATEMENT
 GSM_INTERNAL
 KDEINIT
 KDEDIR
@@ -15705,6 +15706,20 @@
 
 
 
+{ echo "$as_me:$LINENO: checking for -Wdeclaration-after-statement support" >&5
+echo $ECHO_N "checking for -Wdeclaration-after-statement support... $ECHO_C" >&6; }
+if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+	{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
+else
+	{ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+	AST_DECLARATION_AFTER_STATEMENT=
+fi
+
+
+
 { echo "$as_me:$LINENO: checking for sysinfo" >&5
 echo $ECHO_N "checking for sysinfo... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
@@ -19135,7 +19150,10 @@
 fi
 
 if test "${USE_IMAP_TK}" != "no"; then
-   if test "${IMAP_TK_DIR}" = ""; then
+   if test "${IMAP_TK_DIR}" = "system" ; then
+      { echo "$as_me:$LINENO: Checking for system c-client library..." >&5
+echo "$as_me: Checking for system c-client library..." >&6;}
+   elif test "${IMAP_TK_DIR}" = ""; then
       IMAP_TK_DIR=`pwd`"/../imap-2004g"
       if test  -n "${IMAP_TK_MANDATORY}"; then
 	 { echo "$as_me:$LINENO: The --with-imap option does not search your system for installed" >&5
@@ -19148,22 +19166,34 @@
 echo "$as_me: files at ${IMAP_TK_DIR}, as outlined in the doc/imapstorage.txt file." >&6;}
       fi
    fi
-   { echo "$as_me:$LINENO: checking for UW IMAP Toolkit c-client library" >&5
+   if test "${IMAP_TK_DIR}" != "system" ; then
+      { echo "$as_me:$LINENO: checking for UW IMAP Toolkit c-client library" >&5
 echo $ECHO_N "checking for UW IMAP Toolkit c-client library... $ECHO_C" >&6; }
+   fi
    saved_cppflags="${CPPFLAGS}"
    saved_libs="${LIBS}"
-   if test -f ${IMAP_TK_DIR}/c-client/LDFLAGS ; then
+   if test "${IMAP_TK_DIR}" = "system" ; then
+      imap_ldflags=""
+      imap_libs="-lc-client"
+      imap_include="-DUSE_SYSTEM_IMAP"
+   elif test -f ${IMAP_TK_DIR}/c-client/LDFLAGS ; then
       imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
+      imap_libs="${IMAP_TK_DIR}/c-client/c-client.a"
+      imap_include="-I${IMAP_TK_DIR}/c-client"
    fi
-   CPPFLAGS="${CPPFLAGS} -I${IMAP_TK_DIR}/c-client"
-   LIBS="${LIBS} ${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
+   CPPFLAGS="${CPPFLAGS} ${imap_include}"
+   LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include "c-client.h"
+#ifdef USE_SYSTEM_IMAP
+		#include <imap/c-client.h>
+		#else
+		#include "c-client.h"
+		#endif
 		void mm_searched (MAILSTREAM *stream,unsigned long number)
 		{
 		}
@@ -19256,7 +19286,11 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include "c-client.h"
+#ifdef USE_SYSTEM_IMAP
+	 #include <imap/c-client.h>
+	 #else
+	 #include "c-client.h"
+	 #endif
          void mm_searched (MAILSTREAM *stream,unsigned long number)
          {
          }
@@ -19348,8 +19382,8 @@
    if test "${ac_cv_imap_tk}" = "yes"; then
       { echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6; }
-      IMAP_TK_LIB="${IMAP_TK_DIR}/c-client/c-client.a "`echo ${imap_ldflags}`
-      IMAP_TK_INCLUDE="-I${IMAP_TK_DIR}/c-client"
+      IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
+      IMAP_TK_INCLUDE="${imap_include}"
       PBX_IMAP_TK=1
 
 cat >>confdefs.h <<\_ACEOF
@@ -37240,10 +37274,10 @@
 POW_LIB!$POW_LIB$ac_delim
 GC_CFLAGS!$GC_CFLAGS$ac_delim
 GC_LDFLAGS!$GC_LDFLAGS$ac_delim
+AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim
 GSM_INTERNAL!$GSM_INTERNAL$ac_delim
 KDEINIT!$KDEINIT$ac_delim
 KDEDIR!$KDEDIR$ac_delim
-NETSNMP_CONFIG!$NETSNMP_CONFIG$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -37285,6 +37319,7 @@
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+NETSNMP_CONFIG!$NETSNMP_CONFIG$ac_delim
 PG_CONFIG!$PG_CONFIG$ac_delim
 PTLIB_CONFIG!$PTLIB_CONFIG$ac_delim
 PWLIBDIR!$PWLIBDIR$ac_delim
@@ -37312,7 +37347,7 @@
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 25; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 26; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

Modified: team/russell/chan_console/configure.ac
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/configure.ac?view=diff&rev=72627&r1=72626&r2=72627
==============================================================================
--- team/russell/chan_console/configure.ac (original)
+++ team/russell/chan_console/configure.ac Fri Jun 29 10:21:19 2007
@@ -326,6 +326,17 @@
 CFLAGS="${saved_CFLAGS}"
 AC_SUBST(GC_CFLAGS)
 AC_SUBST(GC_LDFLAGS)
+
+AC_MSG_CHECKING(for -Wdeclaration-after-statement support)
+if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+	AC_MSG_RESULT(yes)
+	AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
+else
+	AC_MSG_RESULT(no)
+	AST_DECLARATION_AFTER_STATEMENT=
+fi
+AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
+
 
 AC_MSG_CHECKING(for sysinfo)
 AC_LINK_IFELSE(

Modified: team/russell/chan_console/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/main/manager.c?view=diff&rev=72627&r1=72626&r2=72627
==============================================================================
--- team/russell/chan_console/main/manager.c (original)
+++ team/russell/chan_console/main/manager.c Fri Jun 29 10:21:19 2007
@@ -1847,17 +1847,26 @@
 	/* FIXME: Wedge a ActionID response in here, waiting for later changes */
 	ast_cli_command(fd, cmd);	/* XXX need to change this to use a FILE * */
 	l = lseek(fd, 0, SEEK_END);	/* how many chars available */
-	buf = alloca(l + 1);
-	final_buf = alloca(l + 1);
-	lseek(fd, 0, SEEK_SET);
-	read(fd, buf, l);
-	buf[l] = '\0';
+
+	/* This has a potential to overflow the stack.  Hence, use the heap. */
+	buf = ast_calloc(1, l + 1);
+	final_buf = ast_calloc(1, l + 1);
+	if (buf) {
+		lseek(fd, 0, SEEK_SET);
+		read(fd, buf, l);
+		buf[l] = '\0';
+		if (final_buf) {
+			term_strip(final_buf, buf, l);
+			final_buf[l] = '\0';
+		}
+		astman_append(s, S_OR(final_buf, buf));
+		ast_free(buf);
+	}
 	close(fd);
 	unlink(template);
-	term_strip(final_buf, buf, l);
-	final_buf[l] = '\0';
-	astman_append(s, final_buf);
 	astman_append(s, "--END COMMAND--\r\n\r\n");
+	if (final_buf)
+		ast_free(final_buf);
 	return 0;
 }
 

Modified: team/russell/chan_console/makeopts.in
URL: http://svn.digium.com/view/asterisk/team/russell/chan_console/makeopts.in?view=diff&rev=72627&r1=72626&r2=72627
==============================================================================
--- team/russell/chan_console/makeopts.in (original)
+++ team/russell/chan_console/makeopts.in Fri Jun 29 10:21:19 2007
@@ -62,6 +62,8 @@
 
 AST_DEVMODE=@AST_DEVMODE@
 
+AST_DECLARATION_AFTER_STATEMENT=@AST_DECLARATION_AFTER_STATEMENT@
+
 ASOUND_INCLUDE=@ALSA_INCLUDE@
 ASOUND_LIB=@ALSA_LIB@
 




More information about the asterisk-commits mailing list