[svn-commits] jdixon: branch jdixon/chan_usbradio-1.4 r115603 - /team/jdixon/chan_usbradio-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun May 11 17:22:14 CDT 2008


Author: jdixon
Date: Sun May 11 17:22:13 2008
New Revision: 115603

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115603
Log:
Fixed timing race for new IAX2 protocol security issues regarding 
setup of newkey mode

Modified:
    team/jdixon/chan_usbradio-1.4/apps/app_rpt.c

Modified: team/jdixon/chan_usbradio-1.4/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/apps/app_rpt.c?view=diff&rev=115603&r1=115602&r2=115603
==============================================================================
--- team/jdixon/chan_usbradio-1.4/apps/app_rpt.c (original)
+++ team/jdixon/chan_usbradio-1.4/apps/app_rpt.c Sun May 11 17:22:13 2008
@@ -20,7 +20,7 @@
 /*! \file
  *
  * \brief Radio Repeater / Remote Base program 
- *  version 0.112 4/13/08 2055 EDT
+ *  version 0.113 5/11/08 
  * 
  * \author Jim Dixon, WB6NIL <jim at lambdatel.com>
  *
@@ -368,7 +368,7 @@
 /*! Stop the tones from playing */
 void ast_playtones_stop(struct ast_channel *chan);
 
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.112  4/13/2008";
+static  char *tdesc = "Radio Repeater / Remote Base  version 0.113  5/11/2008";
 
 static char *app = "Rpt";
 
@@ -5419,6 +5419,16 @@
 	return;
 }
 
+/* send newkey message */
+
+static void send_newkey(struct ast_channel *chan)
+{
+
+        ast_safe_sleep(chan,10);
+        ast_sendtext(chan,newkeystr);
+        return;
+}
+
 /* 
  * Connect a link 
  *
@@ -5612,7 +5622,7 @@
 	insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
 	__kickshort(myrpt);
 	rpt_mutex_unlock(&myrpt->lock);
-	if (!l->phonemode) ast_sendtext(l->chan,newkeystr);
+	if (!l->phonemode) send_newkey(l->chan);
 	return 0;
 }
 
@@ -10033,7 +10043,7 @@
 	insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
 	rpt_mutex_unlock(&myrpt->lock);
 	ast_log(LOG_WARNING,"Reconnect Attempt to %s in process\n",l->name);
-	if (!l->phonemode) ast_sendtext(l->chan,newkeystr);
+	if (!l->phonemode) send_newkey(l->chan);
 	return 0;
 }
 
@@ -12222,7 +12232,7 @@
 						l->hasconnected = 1;
 						l->thisconnected = 1;
 						l->elaptime = -1;
-						if (!l->phonemode) ast_sendtext(l->chan,newkeystr);
+						if (!l->phonemode) send_newkey(l->chan);
 						if (!l->isremote) l->retries = 0;
 						if (!lconnected) 
 						{
@@ -12960,7 +12970,7 @@
 		if (chan->_state != AST_STATE_UP)
 		{
 			ast_answer(chan);
-			if (!phone_mode) ast_sendtext(chan,newkeystr);
+			if (!phone_mode) send_newkey(chan);
 		}
 
 		l=strlen(options)+2;
@@ -13274,7 +13284,7 @@
 		rpt_mutex_unlock(&myrpt->lock);
 		if (chan->_state != AST_STATE_UP) {
 			ast_answer(chan);
-			if (!phone_mode) ast_sendtext(chan,newkeystr);
+			if (!phone_mode) send_newkey(chan);
 		}
 		if (myrpt->p.archivedir)
 		{
@@ -13286,7 +13296,7 @@
 				sprintf(str,"LINK,%s",l->name);
 			donodelog(myrpt,str);
 		}
-		if (!phone_mode) ast_sendtext(chan,newkeystr);
+		if (!phone_mode) send_newkey(chan);
 		return AST_PBX_KEEPALIVE;
 	}
 	/* well, then it is a remote */
@@ -13601,7 +13611,7 @@
 	}
 	if (chan->_state != AST_STATE_UP) {
 		ast_answer(chan);
-		if (!phone_mode) ast_sendtext(chan,newkeystr);
+		if (!phone_mode) send_newkey(chan);
 	}
 
 	if (myrpt->rxchannel == myrpt->zaprxchannel)
@@ -13668,7 +13678,7 @@
 	cs[n++] = myrpt->pchannel;
 	if (myrpt->rxchannel != myrpt->txchannel)
 		cs[n++] = myrpt->txchannel;
-	if (!phone_mode) ast_sendtext(chan,newkeystr);
+	if (!phone_mode) send_newkey(chan);
 	/* start un-locked */
 	for(;;) 
 	{




More information about the svn-commits mailing list