Commit 309138fe authored by Youness Alaoui's avatar Youness Alaoui

correctly handle the IGNORE_CREDENTIALS usage flag. And add the optionial...

correctly handle the IGNORE_CREDENTIALS usage flag. And add the optionial fingerprint whenever we're in 3489bis mode. The USE_FINGERPRINT usage flag is only used to discard received messages without that flag
parent 3c9d0050
...@@ -171,6 +171,7 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg, ...@@ -171,6 +171,7 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
if (key == NULL && if (key == NULL &&
(agent->usage_flags & STUN_AGENT_USAGE_IGNORE_CREDENTIALS) == 0 &&
(stun_message_get_class (msg) == STUN_REQUEST || (stun_message_get_class (msg) == STUN_REQUEST ||
stun_message_get_class (msg) == STUN_INDICATION) && stun_message_get_class (msg) == STUN_INDICATION) &&
!(stun_message_get_class (msg) == STUN_ERROR && !(stun_message_get_class (msg) == STUN_ERROR &&
...@@ -204,7 +205,8 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg, ...@@ -204,7 +205,8 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
} }
} }
if (key != NULL && key_len > 0) { if ((agent->usage_flags & STUN_AGENT_USAGE_IGNORE_CREDENTIALS) == 0 &&
key != NULL && key_len > 0) {
hash = (uint8_t *) stun_message_find (msg, hash = (uint8_t *) stun_message_find (msg,
STUN_ATTRIBUTE_MESSAGE_INTEGRITY, &hlen); STUN_ATTRIBUTE_MESSAGE_INTEGRITY, &hlen);
...@@ -424,8 +426,7 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg, ...@@ -424,8 +426,7 @@ size_t stun_agent_finish_message (StunAgent *agent, StunMessage *msg,
} }
if (agent->compatibility == STUN_COMPATIBILITY_3489BIS && if (agent->compatibility == STUN_COMPATIBILITY_3489BIS) {
agent->usage_flags & STUN_AGENT_USAGE_USE_FINGERPRINT) {
ptr = stun_message_append (msg, STUN_ATTRIBUTE_FINGERPRINT, 4); ptr = stun_message_append (msg, STUN_ATTRIBUTE_FINGERPRINT, 4);
if (ptr == NULL) { if (ptr == NULL) {
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment