Skip to content

Commit 61a419e

Browse files
Respond with error 400 on missing attribute for CreatePermission and ChannelBind
1 parent 6fd8bce commit 61a419e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/server.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,9 @@ int server_process_turn_create_permission(juice_server_t *server, const stun_mes
985985
// are invalid, then a 400 (Bad Request) error is returned.
986986
if (!msg->peers_size) {
987987
JLOG_WARN("Missing peer address in TURN CreatePermission request");
988-
return -1;
988+
return server_answer_stun_error(server, msg->transaction_id, src, msg->msg_method,
989+
400, // Bad request
990+
credentials);
989991
}
990992

991993
server_turn_alloc_t *alloc = find_allocation(server->allocs, server->allocs_count, src, false);
@@ -1030,11 +1032,15 @@ int server_process_turn_channel_bind(juice_server_t *server, const stun_message_
10301032

10311033
if (!msg->peers_size) {
10321034
JLOG_WARN("Missing peer address in TURN ChannelBind request");
1033-
return -1;
1035+
return server_answer_stun_error(server, msg->transaction_id, src, msg->msg_method,
1036+
400, // Bad request
1037+
credentials);
10341038
}
10351039
if (!msg->channel_number) {
10361040
JLOG_WARN("Missing channel number in TURN ChannelBind request");
1037-
return -1;
1041+
return server_answer_stun_error(server, msg->transaction_id, src, msg->msg_method,
1042+
400, // Bad request
1043+
credentials);
10381044
}
10391045

10401046
server_turn_alloc_t *alloc = find_allocation(server->allocs, server->allocs_count, src, false);

0 commit comments

Comments
 (0)