[svn-commits] twilson: branch group/srtp_reboot r268814 - in /team/group/srtp_reboot: chann...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 7 16:27:00 CDT 2010


Author: twilson
Date: Mon Jun  7 16:26:55 2010
New Revision: 268814

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=268814
Log:
Address dvossel's review

Modified:
    team/group/srtp_reboot/channels/chan_sip.c
    team/group/srtp_reboot/channels/sip/sdp_crypto.c
    team/group/srtp_reboot/main/channel.c
    team/group/srtp_reboot/res/res_srtp.c

Modified: team/group/srtp_reboot/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/channels/chan_sip.c?view=diff&rev=268814&r1=268813&r2=268814
==============================================================================
--- team/group/srtp_reboot/channels/chan_sip.c (original)
+++ team/group/srtp_reboot/channels/chan_sip.c Mon Jun  7 16:26:55 2010
@@ -7885,7 +7885,7 @@
 			}
 		/* Search for video media definition */
 		} else if ((sscanf(m, "video %30u/%30u RTP/%4s %n", &x, &numberofports, protocol, &len) == 3 && len > 0) ||
-			   (sscanf(m, "video %30d RTP/%4s %n", &x, protocol, &len) == 2 && len >= 0)) {
+			   (sscanf(m, "video %30u RTP/%4s %n", &x, protocol, &len) == 2 && len >= 0)) {
 			if (!strcmp(protocol, "SAVP")) {
 				secure_video = 1;
 			} else if (strcmp(protocol, "AVP")) {
@@ -26799,7 +26799,11 @@
 		}
 	} else if (ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA_NAT)) {
 		res = AST_RTP_GLUE_RESULT_REMOTE;
-	} else if (ast_test_flag(&global_jbconf, AST_JB_FORCED) || p->srtp) {
+	} else if (ast_test_flag(&global_jbconf, AST_JB_FORCED)) {
+		res = AST_RTP_GLUE_RESULT_FORBID;
+	}
+
+	if (p->srtp) {
 		res = AST_RTP_GLUE_RESULT_FORBID;
 	}
 

Modified: team/group/srtp_reboot/channels/sip/sdp_crypto.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/channels/sip/sdp_crypto.c?view=diff&rev=268814&r1=268813&r2=268814
==============================================================================
--- team/group/srtp_reboot/channels/sip/sdp_crypto.c (original)
+++ team/group/srtp_reboot/channels/sip/sdp_crypto.c Mon Jun  7 16:26:55 2010
@@ -293,8 +293,13 @@
 		ast_free(p->a_crypto);
 	}
 
-	snprintf(crypto_buf, sizeof(crypto_buf), "a=crypto:1 %s inline:%s\r\n",  crypto_suite, p->local_key64);
-	p->a_crypto = ast_strdup(crypto_buf);
+	if (snprintf(crypto_buf, sizeof(crypto_buf), "a=crypto:1 %s inline:%s\r\n",  crypto_suite, p->local_key64) < 1) {
+		return -1;
+	}
+
+	if (!(p->a_crypto = ast_strdup(crypto_buf))) {
+		return -1;
+	}
 
 	return 0;
 }

Modified: team/group/srtp_reboot/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/main/channel.c?view=diff&rev=268814&r1=268813&r2=268814
==============================================================================
--- team/group/srtp_reboot/main/channel.c (original)
+++ team/group/srtp_reboot/main/channel.c Mon Jun  7 16:26:55 2010
@@ -4818,13 +4818,16 @@
 		return 0;
 	}
 
+	ast_channel_lock(r);
 	if ((ds = ast_channel_datastore_find(r, &secure_call_info, NULL))) {
 		struct ast_secure_call_store *encrypt = ds->data;
 		ops[0][1] = encrypt->signaling;
 		ops[1][1] = encrypt->media;
 	} else {
+		ast_channel_unlock(r);
 		return 0;
 	}
+	ast_channel_unlock(r);
 
 	for (i = 0; i < 2; i++) {
 		if (ops[i][1]) {

Modified: team/group/srtp_reboot/res/res_srtp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/srtp_reboot/res/res_srtp.c?view=diff&rev=268814&r1=268813&r2=268814
==============================================================================
--- team/group/srtp_reboot/res/res_srtp.c (original)
+++ team/group/srtp_reboot/res/res_srtp.c Mon Jun  7 16:26:55 2010
@@ -178,7 +178,7 @@
 }
 
 static void ast_srtp_policy_set_ssrc(struct ast_srtp_policy *policy,
-				     unsigned long ssrc, int inbound)
+		unsigned long ssrc, int inbound)
 {
 	if (ssrc) {
 		policy->sp.ssrc.type = ssrc_specific;
@@ -292,7 +292,7 @@
 
 		if (srtp->cb && srtp->cb->no_ctx) {
 			if (ast_rtp_instance_get_stats(srtp->rtp, &stats, AST_RTP_INSTANCE_STAT_REMOTE_SSRC)) {
-			   break;
+				break;
 			}
 			if (srtp->cb->no_ctx(srtp->rtp, stats.remote_ssrc, srtp->data) < 0) {
 				break;
@@ -388,13 +388,13 @@
 
 static int load_module(void)
 {
-	return  res_srtp_init();
+	return res_srtp_init();
 }
 
 static int unload_module(void)
 {
 	ast_rtp_engine_unregister_srtp();
-	return AST_MODULE_LOAD_SUCCESS;
+	return 0;
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Secure RTP (SRTP)",




More information about the svn-commits mailing list