Commit 77ff1d20 authored by Youness Alaoui's avatar Youness Alaoui

Adding a 'force validater' usage flag for the stun agent and made libnice use it for msn support

parent db3cb4f0
...@@ -535,7 +535,8 @@ nice_agent_set_property ( ...@@ -535,7 +535,8 @@ nice_agent_set_property (
} else if (agent->compatibility == NICE_COMPATIBILITY_MSN) { } else if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
stun_agent_init (&agent->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES, stun_agent_init (&agent->stun_agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_RFC3489, STUN_COMPATIBILITY_RFC3489,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS); STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
STUN_AGENT_USAGE_FORCE_VALIDATER);
} }
break; break;
......
...@@ -192,9 +192,10 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg, ...@@ -192,9 +192,10 @@ StunValidationStatus stun_agent_validate (StunAgent *agent, StunMessage *msg,
return STUN_VALIDATION_UNAUTHORIZED_BAD_REQUEST; return STUN_VALIDATION_UNAUTHORIZED_BAD_REQUEST;
} }
if (key == NULL && if (stun_message_has_attribute (msg, STUN_ATTRIBUTE_MESSAGE_INTEGRITY) &&
(agent->usage_flags & STUN_AGENT_USAGE_IGNORE_CREDENTIALS) == 0 && ((key == NULL &&
stun_message_has_attribute (msg, STUN_ATTRIBUTE_MESSAGE_INTEGRITY)) { (agent->usage_flags & STUN_AGENT_USAGE_IGNORE_CREDENTIALS) == 0) ||
(agent->usage_flags & STUN_AGENT_USAGE_FORCE_VALIDATER))) {
username_len = 0; username_len = 0;
username = (uint8_t *) stun_message_find (msg, STUN_ATTRIBUTE_USERNAME, username = (uint8_t *) stun_message_find (msg, STUN_ATTRIBUTE_USERNAME,
&username_len); &username_len);
......
...@@ -84,6 +84,7 @@ typedef enum { ...@@ -84,6 +84,7 @@ typedef enum {
#define STUN_AGENT_USAGE_USE_FINGERPRINT 0x0004 #define STUN_AGENT_USAGE_USE_FINGERPRINT 0x0004
#define STUN_AGENT_USAGE_ADD_SERVER 0x0008 #define STUN_AGENT_USAGE_ADD_SERVER 0x0008
#define STUN_AGENT_USAGE_IGNORE_CREDENTIALS 0x0010 #define STUN_AGENT_USAGE_IGNORE_CREDENTIALS 0x0010
#define STUN_AGENT_USAGE_FORCE_VALIDATER 0x0020
typedef struct { typedef struct {
......
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