Commit d2333c67 authored by Youness Alaoui's avatar Youness Alaoui

A bit cleaner code

parent 7c714c52
...@@ -189,19 +189,18 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg, ...@@ -189,19 +189,18 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
return STUN_VALIDATION_UNAUTHORIZED_BAD_REQUEST; return STUN_VALIDATION_UNAUTHORIZED_BAD_REQUEST;
} }
if ((agent->usage_flags & STUN_AGENT_USAGE_IGNORE_CREDENTIALS) == 0 && if (key == NULL &&
(agent->usage_flags & STUN_AGENT_USAGE_IGNORE_CREDENTIALS) == 0 &&
stun_message_has_attribute (msg, STUN_ATTRIBUTE_MESSAGE_INTEGRITY)) { stun_message_has_attribute (msg, STUN_ATTRIBUTE_MESSAGE_INTEGRITY)) {
username_len = 0; username_len = 0;
username = (uint8_t *) stun_message_find (msg, STUN_ATTRIBUTE_USERNAME, username = (uint8_t *) stun_message_find (msg, STUN_ATTRIBUTE_USERNAME,
&username_len); &username_len);
if (key == NULL) {
if (validater == NULL || if (validater == NULL ||
validater (agent, msg, username, username_len, validater (agent, msg, username, username_len,
&key, &key_len, validater_data) == FALSE) { &key, &key_len, validater_data) == FALSE) {
return STUN_VALIDATION_UNAUTHORIZED; return STUN_VALIDATION_UNAUTHORIZED;
} }
} }
}
if (key != NULL && key_len > 0) { if (key != NULL && key_len > 0) {
hash = (uint8_t *) stun_message_find (msg, hash = (uint8_t *) stun_message_find (msg,
......
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