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

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
priv_add_new_candidate_discovery_turn (NiceAgent *agent,
NiceCandidate *host_candidate, NiceAddress server,
Stream *stream, guint component_id,
NiceAddress *addr, gboolean long_term)
NiceAddress *addr)
{
CandidateDiscovery *cdisco;
GSList *modified_list;
......@@ -708,12 +708,10 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
if (agent->compatibility == NICE_COMPATIBILITY_DRAFT19) {
stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_3489BIS,
long_term ? STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS :
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS);
} else {
stun_agent_init (&cdisco->turn_agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_RFC3489,
long_term ? STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS :
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
}
......@@ -782,8 +780,7 @@ nice_agent_add_stream (
NICEAPI_EXPORT void nice_agent_set_relay_info(NiceAgent *agent,
guint stream_id, guint component_id,
const gchar *server_ip, guint server_port,
const gchar *username, const gchar *password,
gboolean long_term_credentials)
const gchar *username, const gchar *password)
{
Component *component = NULL;
......@@ -804,8 +801,6 @@ NICEAPI_EXPORT void nice_agent_set_relay_info(NiceAgent *agent,
g_free (component->turn_password);
component->turn_password = g_strdup (password);
component->turn_long_term = long_term_credentials;
}
g_static_rec_mutex_unlock (&agent->mutex);
}
......@@ -882,8 +877,7 @@ nice_agent_gather_candidates (
component->turn_server,
stream,
n + 1 /* component-id */,
addr,
component->turn_long_term);
addr);
if (res != TRUE) {
/* note: memory allocation failure, return error */
......
......@@ -147,8 +147,7 @@ void nice_agent_set_relay_info(
const gchar *server_ip,
guint server_port,
const gchar *username,
const gchar *password,
gboolean long_term_credentials);
const gchar *password);
void
nice_agent_gather_candidates (
......
......@@ -85,7 +85,6 @@ struct _Component
NiceAddress turn_server; /**< TURN server address */
gchar *turn_username; /**< TURN username */
gchar *turn_password; /**< TURN password */
gboolean turn_long_term; /**< TURN long term credentials */
CandidatePair selected_pair; /**< independent from checklists,
see ICE 11.1. "Sending Media" (ID-19) */
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 *
STUN_ATTRIBUTE_NONCE, &recv_nonce_len);
/* 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_find_error (resp, &code) == 0 &&
code == 401 && recv_nonce != NULL &&
......
......@@ -440,8 +440,7 @@ discovery_add_relay_candidate (
if (nice_udp_turn_create_socket_full (&agent->relay_socket_factory,
relay_socket, address, base_socket, &component->turn_server,
component->turn_username, component->turn_password,
priv_agent_to_udp_turn_compatibility (agent),
component->turn_long_term)) {
priv_agent_to_udp_turn_compatibility (agent))) {
candidate->sockptr = relay_socket;
candidate->base_addr = base_socket->addr;
......
......@@ -482,16 +482,14 @@ nice_udp_turn_create_socket_full (
NiceAddress *server_addr,
gchar *username,
gchar *password,
NiceUdpTurnSocketCompatibility compatibility,
gboolean long_term)
NiceUdpTurnSocketCompatibility compatibility)
{
turn_priv *priv = g_new0 (turn_priv, 1);
if (compatibility == NICE_UDP_TURN_SOCKET_COMPATIBILITY_DRAFT9) {
stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_3489BIS,
long_term ? STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS :
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS);
STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS);
} else if (compatibility == NICE_UDP_TURN_SOCKET_COMPATIBILITY_MSN) {
stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_RFC3489,
......
......@@ -70,8 +70,7 @@ nice_udp_turn_create_socket_full (
NiceAddress *server_addr,
gchar *username,
gchar *password,
NiceUdpTurnSocketCompatibility compatibility,
gboolean long_term);
NiceUdpTurnSocketCompatibility compatibility);
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