diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2009-06-02 19:19:33 -0400 |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2009-06-02 19:19:33 -0400 |
commit | 6ff32569a6420a5c7df3d33529ddde84e9dabee2 (patch) | |
tree | 70163df674f05714b88be8a4b24f92bcc27f3197 | |
parent | bde24e05557e962037710137a1cf1148b0822e61 (diff) | |
download | libnice-6ff32569a6420a5c7df3d33529ddde84e9dabee2.tar.gz |
should avoid a race condition where a remote candidate is taken as a peer reflexive and we loose its user/pass settings
-rw-r--r-- | agent/agent.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/agent/agent.c b/agent/agent.c index e8ebc4e..905cd79 100644 --- a/agent/agent.c +++ b/agent/agent.c @@ -1545,6 +1545,22 @@ static gboolean priv_add_remote_candidate ( strncpy(candidate->foundation, foundation, NICE_CANDIDATE_MAX_FOUNDATION); /* note: username and password must remain the same during * a session; see sect 9.1.2 in ICE ID-19 */ + + /* note: however, the user/pass in ID-19 is global, if the user/pass + * are set in the candidate here, it means they need to be updated... + * this is essential to overcome a race condition where we might receive + * a valid binding request from a valid candidate that wasn't yet added to + * our list of candidates.. this 'update' will make the peer-rflx a + * server-rflx/host candidate again and restore that user/pass it needed + * to have in the first place */ + if (username) { + g_free (candidate->username); + candidate->username = g_strdup (username); + } + if (password) { + g_free (candidate->password); + candidate->password = g_strdup (password); + } if (conn_check_add_for_candidate (agent, stream_id, component, candidate) < 0) error_flag = TRUE; } |