[svn-commits] crichter: branch 1.2 r58850 - /branches/1.2/channels/chan_misdn.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Mar 13 05:58:32 MST 2007


Author: crichter
Date: Tue Mar 13 07:58:32 2007
New Revision: 58850

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58850
Log:
fixed the crypt_keys stuff

Modified:
    branches/1.2/channels/chan_misdn.c

Modified: branches/1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_misdn.c?view=diff&rev=58850&r1=58849&r2=58850
==============================================================================
--- branches/1.2/channels/chan_misdn.c (original)
+++ branches/1.2/channels/chan_misdn.c Tue Mar 13 07:58:32 2007
@@ -4531,16 +4531,22 @@
 		case 'c':
 			keyidx=atoi(++tok);
       
-			if (keyidx > misdn_key_vector_size  || keyidx < 0 ) {
-				ast_log(LOG_WARNING, "You entered the keyidx: %d but we have only %d keys\n",keyidx, misdn_key_vector_size );
-				continue; 
+			char keys[4096];
+			char *key=NULL, *tmp;
+			int i;
+			misdn_cfg_get( 0, MISDN_GEN_CRYPT_KEYS, keys, sizeof(keys));
+
+			tmp=keys;
+
+			for (i=0; i<keyidx; i++) {
+				key=strsep(&tmp,",");
 			}
-      
-			{
-				ast_copy_string(ch->bc->crypt_key,  misdn_key_vector[keyidx], sizeof(ch->bc->crypt_key));
+
+			if (key) {
+				ast_copy_string(ch->bc->crypt_key, key, sizeof(ch->bc->crypt_key));
 			}
 			
-			chan_misdn_log(0, ch->bc->port, "SETOPT: crypt with key:%s\n",misdn_key_vector[keyidx]);
+			chan_misdn_log(0, ch->bc->port, "SETOPT: crypt with key:%s\n",ch->bc->crypt_key);
 			break;
 
 		case 'e':



More information about the svn-commits mailing list