stunagent: Only declare the long term key valid if the username/realm coudl be read
authorOlivier Crête <olivier.crete@collabora.com>
Fri, 25 Apr 2014 01:32:40 +0000 (21:32 -0400)
committerOlivier Crête <olivier.crete@collabora.com>
Fri, 25 Apr 2014 01:34:50 +0000 (21:34 -0400)
stun/stunagent.c

index 40e4d15..72cc231 100644 (file)
@@ -554,9 +554,9 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg,
         stun_hash_creds (realm, realm_len,
             username,  username_len,
             key, key_len, md5);
+        memcpy (msg->long_term_key, md5, sizeof(msg->long_term_key));
+        msg->long_term_valid = TRUE;
       }
-      memcpy (msg->long_term_key, md5, sizeof(msg->long_term_key));
-      msg->long_term_valid = TRUE;
     }
 
     /* If no realm/username and long term credentials,