[asterisk-commits] dvossel: branch dvossel/iax2encryption_trunk r174984 - /team/dvossel/iax2encr...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 11 17:48:06 CST 2009


Author: dvossel
Date: Wed Feb 11 17:48:06 2009
New Revision: 174984

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174984
Log:
Keeping it real

Modified:
    team/dvossel/iax2encryption_trunk/channels/chan_iax2.c

Modified: team/dvossel/iax2encryption_trunk/channels/chan_iax2.c
URL: http://svn.digium.com/svn-view/asterisk/team/dvossel/iax2encryption_trunk/channels/chan_iax2.c?view=diff&rev=174984&r1=174983&r2=174984
==============================================================================
--- team/dvossel/iax2encryption_trunk/channels/chan_iax2.c (original)
+++ team/dvossel/iax2encryption_trunk/channels/chan_iax2.c Wed Feb 11 17:48:06 2009
@@ -6221,13 +6221,8 @@
 		if (user->maxauthreq > 0)
 			ast_set_flag(iaxs[callno], IAX_MAXAUTHREQ);
 		iaxs[callno]->prefs = user->prefs;
-		ast_copy_flags(iaxs[callno], user, IAX_CODEC_USER_FIRST);
-		ast_copy_flags(iaxs[callno], user, IAX_IMMEDIATE);
-		ast_copy_flags(iaxs[callno], user, IAX_CODEC_NOPREFS);
-		ast_copy_flags(iaxs[callno], user, IAX_CODEC_NOCAP);
+		ast_copy_flags(iaxs[callno], user, IAX_CODEC_USER_FIRST | IAX_IMMEDIATE | IAX_CODEC_NOPREFS | IAX_CODEC_NOCAP | IAX_NOKEYROTATE | IAX_FORCE_ENCRYPT);
 		iaxs[callno]->encmethods = user->encmethods;
-		ast_copy_flags(iaxs[callno], user, IAX_NOKEYROTATE);
-		ast_copy_flags(iaxs[callno], user, IAX_FORCE_ENCRYPT);
 		/* Store the requested username if not specified */
 		if (ast_strlen_zero(iaxs[callno]->username))
 			ast_string_field_set(iaxs[callno], username, user->name);
@@ -10718,15 +10713,17 @@
 				peer->authmethods = get_auth_methods(v->value);
 			} else if (!strcasecmp(v->name, "encryption")) {
 				peer->encmethods = get_encrypt_methods(v->value);
-				if (!ast_true(v->value)) {
+				if (!peer->encmethods) {
 					ast_clear_flag(peer, IAX_FORCE_ENCRYPT);
 				}
 			} else if (!strcasecmp(v->name, "forceencryption")) {
-				if (ast_true(v->value)) {
-					ast_set_flag(peer, IAX_FORCE_ENCRYPT);
+				if (ast_false(v->value)) {
+					ast_clear_flag(peer, IAX_FORCE_ENCRYPT);
+				} else {
 					peer->encmethods = get_encrypt_methods(v->value);
-				} else {
-					ast_clear_flag(peer, IAX_FORCE_ENCRYPT);
+					if (peer->encmethods) {
+						ast_set_flag(peer, IAX_FORCE_ENCRYPT);
+					}
 				}
 			} else if (!strcasecmp(v->name, "keyrotate")) {
 				if (ast_false(v->value))
@@ -10988,15 +10985,17 @@
 				user->authmethods = get_auth_methods(v->value);
 			} else if (!strcasecmp(v->name, "encryption")) {
 				user->encmethods = get_encrypt_methods(v->value);
-				if (!ast_true(v->value)) {
+				if (!user->encmethods) {
 					ast_clear_flag(user, IAX_FORCE_ENCRYPT);
 				}
 			} else if (!strcasecmp(v->name, "forceencryption")) {
-				if (ast_true(v->value)) {
-					ast_set_flag(user, IAX_FORCE_ENCRYPT);
+				if (ast_false(v->value)) {
+					ast_clear_flag(user, IAX_FORCE_ENCRYPT);
+				} else {
 					user->encmethods = get_encrypt_methods(v->value);
-				} else {
-					ast_clear_flag(user, IAX_FORCE_ENCRYPT);
+					if (user->encmethods) {
+						ast_set_flag(user, IAX_FORCE_ENCRYPT);
+					}
 				}
 			} else if (!strcasecmp(v->name, "keyrotate")) {
 				if (ast_false(v->value))
@@ -11377,13 +11376,17 @@
 			authdebug = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "encryption")) {
 				iax2_encryption = get_encrypt_methods(v->value);
-				if (!ast_true(v->value)) {
+				if (!iax2_encryption) {
 					ast_clear_flag((&globalflags), IAX_FORCE_ENCRYPT);
-				}	
+				}
 		} else if (!strcasecmp(v->name, "forceencryption")) {
-			if (ast_true(v->value)) {
-				ast_set_flag((&globalflags), IAX_FORCE_ENCRYPT);
+			if (ast_false(v->value)) {
+				ast_clear_flag((&globalflags), IAX_FORCE_ENCRYPT);
+			} else {
 				iax2_encryption = get_encrypt_methods(v->value);
+				if (iax2_encryption) {
+					ast_set_flag((&globalflags), IAX_FORCE_ENCRYPT);
+				}
 			}
 		} else if (!strcasecmp(v->name, "keyrotate")) {
 			if (ast_false(v->value))




More information about the asterisk-commits mailing list