Skip to content

Commit d3d6949

Browse files
Merge pull request #298 from paullouisageneau/remove-username-turn-allocate
Remove username from unauthenticated TURN allocate requests
2 parents d585858 + b1583b3 commit d3d6949

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/agent.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,15 +1890,18 @@ int agent_send_turn_allocate_request(juice_agent_t *agent, const agent_stun_entr
18901890
msg.msg_method = method;
18911891
memcpy(msg.transaction_id, entry->transaction_id, STUN_TRANSACTION_ID_SIZE);
18921892

1893-
msg.credentials = entry->turn->credentials;
18941893
msg.lifetime = TURN_LIFETIME / 1000; // seconds
18951894

18961895
// Include allocation attributes in Allocate request only
18971896
if (method == STUN_METHOD_ALLOCATE) {
18981897
msg.requested_transport = true;
18991898
}
19001899

1901-
const char *password = *msg.credentials.nonce != '\0' ? entry->turn->password : NULL;
1900+
const char *password = NULL;
1901+
if(*entry->turn->credentials.nonce != '\0') {
1902+
msg.credentials = entry->turn->credentials;
1903+
password = entry->turn->password;
1904+
}
19021905

19031906
char buffer[BUFFER_SIZE];
19041907
int size = stun_write(buffer, BUFFER_SIZE, &msg, password);

0 commit comments

Comments
 (0)