Commit 949754b1 authored by Youness Alaoui's avatar Youness Alaoui

Fix gtalk compat (partially) by not sending non-username attributes

parent 1e2acd57
...@@ -1590,7 +1590,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo ...@@ -1590,7 +1590,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo
stun_conncheck_use_candidate ((const uint8_t*)buf); stun_conncheck_use_candidate ((const uint8_t*)buf);
uint32_t priority = stun_conncheck_priority ((const uint8_t*)buf); uint32_t priority = stun_conncheck_priority ((const uint8_t*)buf);
if (agent->controlling_mode) if (agent->controlling_mode ||
agent->compatibility == NICE_COMPATIBILITY_GOOGLE)
use_candidate = TRUE; use_candidate = TRUE;
if (stream->initial_binding_request_received != TRUE) if (stream->initial_binding_request_received != TRUE)
......
...@@ -287,6 +287,7 @@ stun_conncheck_start (stun_bind_t **restrict context, int fd, ...@@ -287,6 +287,7 @@ stun_conncheck_start (stun_bind_t **restrict context, int fd,
memcpy (ctx->trans.key.value, password, ctx->trans.key.length); memcpy (ctx->trans.key.value, password, ctx->trans.key.length);
} }
if (compat != 1) {
if (cand_use) if (cand_use)
{ {
val = stun_append_flag (ctx->trans.msg.buf, val = stun_append_flag (ctx->trans.msg.buf,
...@@ -306,9 +307,10 @@ stun_conncheck_start (stun_bind_t **restrict context, int fd, ...@@ -306,9 +307,10 @@ stun_conncheck_start (stun_bind_t **restrict context, int fd,
: STUN_ICE_CONTROLLED, tie); : STUN_ICE_CONTROLLED, tie);
if (val) if (val)
goto error; goto error;
}
val = stun_finish_short (ctx->trans.msg.buf, &ctx->trans.msg.length, val = stun_finish_short (ctx->trans.msg.buf, &ctx->trans.msg.length,
username, password, NULL); username, compat == 1 ? NULL : password, NULL);
if (val) if (val)
goto error; goto error;
......
...@@ -490,8 +490,10 @@ stun_finish_long (uint8_t *msg, size_t *restrict plen, ...@@ -490,8 +490,10 @@ stun_finish_long (uint8_t *msg, size_t *restrict plen,
DBG ("\n sent : "); DBG ("\n sent : ");
DBG_bytes (ptr, 20); DBG_bytes (ptr, 20);
DBG ("\n"); DBG ("\n");
} }
if (0) {
/* /*
* NOTE: we always add a FINGERPRINT, even when it's not needed. * NOTE: we always add a FINGERPRINT, even when it's not needed.
* This is OK, as it is an optional attribute. It also makes my * This is OK, as it is an optional attribute. It also makes my
...@@ -501,11 +503,11 @@ stun_finish_long (uint8_t *msg, size_t *restrict plen, ...@@ -501,11 +503,11 @@ stun_finish_long (uint8_t *msg, size_t *restrict plen,
if (ptr == NULL) if (ptr == NULL)
return ENOBUFS; return ENOBUFS;
*plen = ptr + 4 -msg;
fpr = htonl (stun_fingerprint (msg, *plen)); fpr = htonl (stun_fingerprint (msg, *plen));
memcpy (ptr, &fpr, sizeof (fpr)); memcpy (ptr, &fpr, sizeof (fpr));
}
*plen = stun_length (msg) + 20;
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