Commit 46d158e1 authored by Youness Alaoui's avatar Youness Alaoui

TURN specs says it must be long term credentials. So the short term/long term...

TURN specs says it must be long term credentials. So the short term/long term credentials can be removed from the API, and we'll only use the compatibility to decide what method of authentication to use
parent 675d1d20
...@@ -683,7 +683,7 @@ static gboolean ...@@ -683,7 +683,7 @@ static gboolean
priv_add_new_candidate_discovery_turn (NiceAgent *agent, priv_add_new_candidate_discovery_turn (NiceAgent *agent,
NiceCandidate *host_candidate, NiceAddress server, NiceCandidate *host_candidate, NiceAddress server,
Stream *stream, guint component_id, Stream *stream, guint component_id,
NiceAddress *addr, gboolean long_term) NiceAddress *addr)
{ {
CandidateDiscovery *cdisco; CandidateDiscovery *cdisco;
GSList *modified_list; GSList *modified_list;
...@@ -708,12 +708,10 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent, ...@@ -708,12 +708,10 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19) { if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19) {
stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES, stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_3489BIS, STUN_COMPATIBILITY_3489BIS,
long_term ? STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS : STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS);
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
} else { } else {
stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES, stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_RFC3489, STUN_COMPATIBILITY_RFC3489,
long_term ? STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS :
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS); STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
} }
...@@ -782,8 +780,7 @@ nice_agent_add_stream ( ...@@ -782,8 +780,7 @@ nice_agent_add_stream (
NICEAPI_EXPORT void nice_agent_set_relay_info(NiceAgent *agent, NICEAPI_EXPORT void nice_agent_set_relay_info(NiceAgent *agent,
guint stream_id, guint component_id, guint stream_id, guint component_id,
const gchar *server_ip, guint server_port, const gchar *server_ip, guint server_port,
const gchar *username, const gchar *password, const gchar *username, const gchar *password)
gboolean long_term_credentials)
{ {
Component *component = NULL; Component *component = NULL;
...@@ -804,8 +801,6 @@ NICEAPI_EXPORT void nice_agent_set_relay_info(NiceAgent *agent, ...@@ -804,8 +801,6 @@ NICEAPI_EXPORT void nice_agent_set_relay_info(NiceAgent *agent,
g_free (component->turn_password); g_free (component->turn_password);
component->turn_password = g_strdup (password); component->turn_password = g_strdup (password);
component->turn_long_term = long_term_credentials;
} }
g_static_rec_mutex_unlock (&agent->mutex); g_static_rec_mutex_unlock (&agent->mutex);
} }
...@@ -882,8 +877,7 @@ nice_agent_gather_candidates ( ...@@ -882,8 +877,7 @@ nice_agent_gather_candidates (
component->turn_server, component->turn_server,
stream, stream,
n + 1 /* component-id */, n + 1 /* component-id */,
addr, addr);
component->turn_long_term);
if (res != TRUE) { if (res != TRUE) {
/* note: memory allocation failure, return error */ /* note: memory allocation failure, return error */
......
...@@ -147,8 +147,7 @@ void nice_agent_set_relay_info( ...@@ -147,8 +147,7 @@ void nice_agent_set_relay_info(
const gchar *server_ip, const gchar *server_ip,
guint server_port, guint server_port,
const gchar *username, const gchar *username,
const gchar *password, const gchar *password);
gboolean long_term_credentials);
void void
nice_agent_gather_candidates ( nice_agent_gather_candidates (
......
...@@ -85,7 +85,6 @@ struct _Component ...@@ -85,7 +85,6 @@ struct _Component
NiceAddress turn_server; /**< TURN server address */ NiceAddress turn_server; /**< TURN server address */
gchar *turn_username; /**< TURN username */ gchar *turn_username; /**< TURN username */
gchar *turn_password; /**< TURN password */ gchar *turn_password; /**< TURN password */
gboolean turn_long_term; /**< TURN long term credentials */
CandidatePair selected_pair; /**< independent from checklists, CandidatePair selected_pair; /**< independent from checklists,
see ICE 11.1. "Sending Media" (ID-19) */ see ICE 11.1. "Sending Media" (ID-19) */
gboolean media_after_tick; /**< true if media received since last gboolean media_after_tick; /**< true if media received since last
......
...@@ -1809,7 +1809,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage * ...@@ -1809,7 +1809,7 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
STUN_ATTRIBUTE_NONCE, &recv_nonce_len); STUN_ATTRIBUTE_NONCE, &recv_nonce_len);
/* check for unauthorized error response */ /* check for unauthorized error response */
if (d->component->turn_long_term && if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19 &&
stun_message_get_class (resp) == STUN_ERROR && stun_message_get_class (resp) == STUN_ERROR &&
stun_message_find_error (resp, &code) == 0 && stun_message_find_error (resp, &code) == 0 &&
code == 401 && recv_nonce != NULL && code == 401 && recv_nonce != NULL &&
......
...@@ -440,8 +440,7 @@ discovery_add_relay_candidate ( ...@@ -440,8 +440,7 @@ discovery_add_relay_candidate (
if (nice_udp_turn_create_socket_full (&agent->relay_socket_factory, if (nice_udp_turn_create_socket_full (&agent->relay_socket_factory,
relay_socket, address, base_socket, &component->turn_server, relay_socket, address, base_socket, &component->turn_server,
component->turn_username, component->turn_password, component->turn_username, component->turn_password,
priv_agent_to_udp_turn_compatibility (agent), priv_agent_to_udp_turn_compatibility (agent))) {
component->turn_long_term)) {
candidate->sockptr = relay_socket; candidate->sockptr = relay_socket;
candidate->base_addr = base_socket->addr; candidate->base_addr = base_socket->addr;
......
...@@ -482,16 +482,14 @@ nice_udp_turn_create_socket_full ( ...@@ -482,16 +482,14 @@ nice_udp_turn_create_socket_full (
NiceAddress *server_addr, NiceAddress *server_addr,
gchar *username, gchar *username,
gchar *password, gchar *password,
NiceUdpTurnSocketCompatibility compatibility, NiceUdpTurnSocketCompatibility compatibility)
gboolean long_term)
{ {
turn_priv *priv = g_new0 (turn_priv, 1); turn_priv *priv = g_new0 (turn_priv, 1);
if (compatibility == NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9) { if (compatibility == NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9) {
stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES, stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_3489BIS, STUN_COMPATIBILITY_3489BIS,
long_term ? STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS : STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS);
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
} else if (compatibility == NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN) { } else if (compatibility == NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN) {
stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES, stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_RFC3489, STUN_COMPATIBILITY_RFC3489,
......
...@@ -70,8 +70,7 @@ nice_udp_turn_create_socket_full ( ...@@ -70,8 +70,7 @@ nice_udp_turn_create_socket_full (
NiceAddress *server_addr, NiceAddress *server_addr,
gchar *username, gchar *username,
gchar *password, gchar *password,
NiceUdpTurnSocketCompatibility compatibility, NiceUdpTurnSocketCompatibility compatibility);
gboolean long_term);
void void
......
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