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

Modified Files:
        manager.c 
Log Message:
tell the user about invalid/unknown commands before sending queued events
s->challenge does not need to be protected by the lock, since only 
process_message() (and functions it calls) ever use it, and process_message() 
is a blocking operation by definition


Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- manager.c   30 Sep 2005 16:27:14 -0000      1.116
+++ manager.c   30 Sep 2005 23:44:12 -0000      1.117
@@ -1223,11 +1223,8 @@
                        char *authtype;
                        authtype = astman_get_header(m, "AuthType");
                        if (!strcasecmp(authtype, "MD5")) {
-                               if (!s->challenge || 
ast_strlen_zero(s->challenge)) {
-                                       ast_mutex_lock(&s->__lock);
+                               if (!s->challenge || 
ast_strlen_zero(s->challenge))
                                        snprintf(s->challenge, 
sizeof(s->challenge), "%d", rand());
-                                       ast_mutex_unlock(&s->__lock);
-                               }
                                ast_mutex_lock(&s->__lock);
                                ast_cli(s->fd, "Response: Success\r\n"
                                                "%s"
@@ -1277,6 +1274,10 @@
                        }
                        tmp = tmp->next;
                }
+               if (!ret)
+                       astman_send_error(s, m, "Invalid/unknown command");
+               else
+                       ret = 0;
                ast_mutex_lock(&s->__lock);
                s->busy = 0;
                while(s->eventq) {
@@ -1289,10 +1290,6 @@
                        free(eqe);
                }
                ast_mutex_unlock(&s->__lock);
-               if (!ret)
-                       astman_send_error(s, m, "Invalid/unknown command");
-               else
-                       ret = 0;
                return ret;
        }
        return 0;

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

Reply via email to