Commit 1c7a8efd authored by Youness Alaoui's avatar Youness Alaoui

verify the username outside libstun only if we are in google compatibility mode

parent 0e0354b2
...@@ -1831,7 +1831,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1831,7 +1831,7 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
return TRUE; return TRUE;
} }
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
/* If we receive a response, then the username is local:remote */ /* If we receive a response, then the username is local:remote */
if (stun_message_get_class (&req) == STUN_REQUEST || if (stun_message_get_class (&req) == STUN_REQUEST ||
stun_message_get_class (&req) == STUN_INDICATION) { stun_message_get_class (&req) == STUN_INDICATION) {
...@@ -1843,14 +1843,10 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1843,14 +1843,10 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
component->id, remote_candidate, local_candidate, component->id, remote_candidate, local_candidate,
uname, sizeof (uname), FALSE); uname, sizeof (uname), FALSE);
} }
username = (uint8_t *) stun_message_find (&req, STUN_ATTRIBUTE_USERNAME, username = (uint8_t *) stun_message_find (&req, STUN_ATTRIBUTE_USERNAME,
&username_len); &username_len);
g_debug ("Comparing usernames : '%s' (%d) to '%s' (%d)", username, username_len, uname, uname_len); /* Check the username in case the stun agent has IGNORE_CREDENTIALS flag.
/* Check again the username in case the stun agent has IGNORE_CREDENTIALS flag.
We only need to check the username and not care about the password */ We only need to check the username and not care about the password */
if (username && if (username &&
(uname_len != username_len || (uname_len != username_len ||
...@@ -1859,11 +1855,12 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1859,11 +1855,12 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if (stun_agent_init_error (&agent->stun_agent, &msg, rbuf, rbuf_len, if (stun_agent_init_error (&agent->stun_agent, &msg, rbuf, rbuf_len,
&req, STUN_ERROR_UNAUTHORIZED)) { &req, STUN_ERROR_UNAUTHORIZED)) {
rbuf_len = stun_agent_finish_message (&agent->stun_agent, &msg, NULL, 0); rbuf_len = stun_agent_finish_message (&agent->stun_agent, &msg, NULL, 0);
if (rbuf_len > 0) if (rbuf_len > 0&& agent->compatibility != NICE_COMPATIBILITY_MSN)
nice_udp_socket_send (udp_socket, from, rbuf_len, (const gchar*)rbuf); nice_udp_socket_send (udp_socket, from, rbuf_len, (const gchar*)rbuf);
} }
return TRUE; return TRUE;
} }
}
if (valid != STUN_VALIDATION_SUCCESS) { if (valid != STUN_VALIDATION_SUCCESS) {
g_debug ("Agent %p : STUN message is unsuccessfull, ignoring", agent); g_debug ("Agent %p : STUN message is unsuccessfull, ignoring", agent);
......
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