Fixed server crash when setting Access token while connected.
authorfatbob313 <martin@fatbob.nu>
Sun, 7 Mar 2010 20:49:15 +0000 (20:49 +0000)
committerfatbob313 <martin@fatbob.nu>
Sun, 7 Mar 2010 20:49:15 +0000 (20:49 +0000)
src/messagehandler.c

index ae613dafb6d7be3fa30ba4caab9e3efcd57863d2..ba76ed68520befedf1c9e0088055a80e2938b5c4 100644 (file)
@@ -79,9 +79,15 @@ void Mh_handle_message(client_t *client, message_t *msg)
        }       
        switch (msg->messageType) {
        case Authenticate:
-                               
                Log_debug("Authenticate message received");
-               Log_debug("Username: %s", msg->payload.authenticate->username);
+               
+               if (IS_AUTH(client) || !msg->payload.authenticate->username) {
+                       /* Authenticate message might be sent when a token is set by the user.*/
+                       if (msg->payload.authenticate->n_tokens > 0) {
+                               Log_debug("Tokens in auth message from %s", client->username);
+                       }
+                       break;
+               }
                
                client->authenticated = true;