Commit dae09b56 authored by Youness Alaoui's avatar Youness Alaoui

Clean files a little

parent 2ecff0b2
...@@ -1755,11 +1755,12 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1755,11 +1755,12 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
} }
} }
validater_data = g_new0(stun_validater_data, g_slist_length(component->local_candidates) + 1); validater_data = g_new0(stun_validater_data,
g_slist_length(component->local_candidates) + 1);
/* We have to check all the local candidates into our validater_data because a /* We have to check all the local candidates into our validater_data because a
server reflexive candidate shares the same socket as the host candidate, so we server reflexive candidate shares the same socket as the host candidate,
have no idea the user/pass is coming from which candidate */ so we have no idea the user/pass is coming from which candidate */
j = 0; j = 0;
for (i = component->local_candidates; i; i = i->next) { for (i = component->local_candidates; i; i = i->next) {
NiceCandidate *cand = i->data; NiceCandidate *cand = i->data;
...@@ -1780,7 +1781,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1780,7 +1781,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
} }
if (agent->compatibility == NICE_COMPATIBILITY_MSN) { if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
validater_data[j].password = g_base64_decode ((gchar *) validater_data[j].password, validater_data[j].password =
g_base64_decode ((gchar *) validater_data[j].password,
&validater_data[j].password_len); &validater_data[j].password_len);
} }
j++; j++;
...@@ -1877,8 +1879,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1877,8 +1879,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE && if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE &&
local_candidate == NULL) { local_candidate == NULL) {
/* if we couldn't match the username and the stun agent has IGNORE_CREDENTIALS, /* if we couldn't match the username and the stun agent has
then we have an integrity check failing */ IGNORE_CREDENTIALS then we have an integrity check failing */
g_debug ("Agent %p : Username check failed.", agent); g_debug ("Agent %p : Username check failed.", agent);
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)) {
...@@ -1903,7 +1905,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1903,7 +1905,8 @@ 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);
memcpy (username, uname, username_len); memcpy (username, uname, username_len);
req.key = g_base64_decode ((gchar *) remote_candidate->password, &req.key_len); req.key = g_base64_decode ((gchar *) remote_candidate->password,
&req.key_len);
} }
rbuf_len = sizeof (rbuf); rbuf_len = sizeof (rbuf);
...@@ -1975,7 +1978,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, ...@@ -1975,7 +1978,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
trans_found = priv_map_reply_to_discovery_request (agent, &req); trans_found = priv_map_reply_to_discovery_request (agent, &req);
if (trans_found != TRUE) if (trans_found != TRUE)
g_debug ("Agent %p : Unable to match to an existing transaction, probably a keepalive.", agent); g_debug ("Agent %p : Unable to match to an existing transaction, "
"probably a keepalive.", agent);
} }
return TRUE; return TRUE;
......
...@@ -82,7 +82,7 @@ stun_usage_ice_conncheck_create (StunAgent *agent, StunMessage *msg, ...@@ -82,7 +82,7 @@ stun_usage_ice_conncheck_create (StunAgent *agent, StunMessage *msg,
return 0; return 0;
} }
if (username) { if (username && username_len > 0) {
val = stun_message_append_bytes (msg, STUN_ATTRIBUTE_USERNAME, val = stun_message_append_bytes (msg, STUN_ATTRIBUTE_USERNAME,
username, username_len); username, username_len);
if (val) if (val)
......
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