Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv6495/apps

Modified Files:
      Tag: v1-0
        app_disa.c 
Log Message:
fix timeout with no password (bug #3589)


Index: app_disa.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_disa.c,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -d -r1.17 -r1.17.2.1
--- app_disa.c  15 Sep 2004 22:06:30 -0000      1.17
+++ app_disa.c  5 Apr 2005 09:31:11 -0000       1.17.2.1
@@ -161,7 +161,7 @@
 
        if (!strcasecmp(tmp, "no-password"))
        {;
-               k = 1;
+               k |= 1; /* We have the password */
                ast_log(LOG_DEBUG, "DISA no-password login success\n");
        }
        gettimeofday(&lastdigittime,NULL);
@@ -173,10 +173,10 @@
                gettimeofday(&now,NULL);
                  /* if outa time, give em reorder */
                if (ms_diff(&now,&lastdigittime) > 
-                   ((k) ? digittimeout : firstdigittimeout))
+                   ((k&2) ? digittimeout : firstdigittimeout))
                {
                        ast_log(LOG_DEBUG,"DISA %s entry timeout on chan %s\n",
-                               ((k) ? "extension" : "password"),chan->name);
+                               ((k&1) ? "extension" : "password"),chan->name);
                        break;
                }
                if ((res = ast_waitfor(chan, -1) < 0)) {
@@ -211,13 +211,15 @@
                j = f->subclass;  /* save digit */
                ast_frfree(f);
                if (i == 0) 
+               {
+                       k|=2; /* We have the first digit */ 
                        ast_playtones_stop(chan);
-
+               }
                gettimeofday(&lastdigittime,NULL);
                  /* got a DTMF tone */
                if (i < AST_MAX_EXTENSION) /* if still valid number of digits */
                {
-                       if (!k) /* if in password state */
+                       if (!(k&1)) /* if in password state */
                        {
                                if (j == '#') /* end of password */
                                {
@@ -268,7 +270,7 @@
                                        ast_log(LOG_DEBUG,"DISA on chan %s 
password is good\n",chan->name);
                                        play_dialtone(chan);
 
-                                       k = 1;
+                                       k|=1; /* In number mode */
                                        i = 0;  /* re-set buffer pointer */
                                        exten[sizeof(acctcode)] = 0;
                                        strncpy(acctcode,exten, 
sizeof(acctcode) - 1);
@@ -280,7 +282,7 @@
 
                        exten[i++] = j;  /* save digit */
                        exten[i] = 0;
-                       if (!k) continue; /* if getting password, continue 
doing it */
+                       if (!(k&1)) continue; /* if getting password, continue 
doing it */
                          /* if this exists */
 
                        if (ast_ignore_pattern(ourcontext, exten)) {
@@ -299,7 +301,7 @@
                }
        }
 
-       if (k && ast_exists_extension(chan,ourcontext,exten,1, chan->callerid))
+       if ((k==3) && (ast_exists_extension(chan,ourcontext,exten,1, 
chan->callerid)))
        {
                ast_playtones_stop(chan);
                /* We're authenticated and have a valid extension */

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to