|
@@ -1047,7 +1047,6 @@ static int handle_turn_allocate(turn_turnserver *server,
|
|
|
transport = get_transport_value(value);
|
|
|
if (!transport) {
|
|
|
*err_code = 442;
|
|
|
- *reason = (const u08bits *)"Unsupported Transport Protocol";
|
|
|
}
|
|
|
if((transport == STUN_ATTRIBUTE_TRANSPORT_TCP_VALUE) && *(server->no_tcp_relay)) {
|
|
|
*err_code = 442;
|
|
@@ -1159,7 +1158,6 @@ static int handle_turn_allocate(turn_turnserver *server,
|
|
|
break;
|
|
|
default:
|
|
|
*err_code = 440;
|
|
|
- *reason = (const u08bits *)"Unsupported address family requested";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1182,8 +1180,6 @@ static int handle_turn_allocate(turn_turnserver *server,
|
|
|
} else if (*ua_num > 0) {
|
|
|
|
|
|
*err_code = 420;
|
|
|
- if(!(*reason))
|
|
|
- *reason = (const u08bits *)"Unknown attribute";
|
|
|
|
|
|
} else if (*err_code) {
|
|
|
|
|
@@ -1209,7 +1205,6 @@ static int handle_turn_allocate(turn_turnserver *server,
|
|
|
if(inc_quota(ss, username)<0) {
|
|
|
|
|
|
*err_code = 486;
|
|
|
- *reason = (const u08bits *)"Allocation Quota Reached";
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -1561,7 +1556,6 @@ static int handle_turn_refresh(turn_turnserver *server,
|
|
|
if (*ua_num > 0) {
|
|
|
|
|
|
*err_code = 420;
|
|
|
- *reason = (const u08bits *)"Unknown attribute";
|
|
|
|
|
|
} else if (*err_code) {
|
|
|
|
|
@@ -1980,8 +1974,7 @@ static void tcp_peer_connection_completed_callback(int success, void *arg)
|
|
|
addr_to_string(&(tc->peer_addr),(u08bits*)rs);
|
|
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: failure to connect from %s to %s\n", __FUNCTION__, ls,rs);
|
|
|
}
|
|
|
- const u08bits *reason = (const u08bits *)"Connection Timeout or Failure";
|
|
|
- stun_init_error_response_str(STUN_METHOD_CONNECT, ioa_network_buffer_data(nbh), &len, err_code, reason, &(tc->tid));
|
|
|
+ stun_init_error_response_str(STUN_METHOD_CONNECT, ioa_network_buffer_data(nbh), &len, err_code, NULL, &(tc->tid));
|
|
|
}
|
|
|
|
|
|
ioa_network_buffer_set_size(nbh,len);
|
|
@@ -2051,7 +2044,6 @@ static int tcp_start_connection_to_peer(turn_turnserver *server, ts_ur_super_ses
|
|
|
tcp_connection *tc = get_tcp_connection_by_peer(a, peer_addr);
|
|
|
if(tc) {
|
|
|
*err_code = 446;
|
|
|
- *reason = (const u08bits *)"Connection Already Exists";
|
|
|
FUNCEND;
|
|
|
return -1;
|
|
|
}
|
|
@@ -2219,7 +2211,6 @@ static int handle_turn_connect(turn_turnserver *server,
|
|
|
*reason = (const u08bits *)"Connect cannot be used with UDP relay";
|
|
|
} else if (!is_allocation_valid(a)) {
|
|
|
*err_code = 437;
|
|
|
- *reason = (const u08bits *)"Allocation mismatch";
|
|
|
} else {
|
|
|
|
|
|
stun_attr_ref sar = stun_attr_get_first_str(ioa_network_buffer_data(in_buffer->nbh),
|
|
@@ -2258,7 +2249,6 @@ static int handle_turn_connect(turn_turnserver *server,
|
|
|
if (*ua_num > 0) {
|
|
|
|
|
|
*err_code = 420;
|
|
|
- *reason = (const u08bits *)"Unknown attribute";
|
|
|
|
|
|
} else if (*err_code) {
|
|
|
|
|
@@ -2296,7 +2286,6 @@ static int handle_turn_connection_bind(turn_turnserver *server,
|
|
|
if(ss->to_be_closed) {
|
|
|
|
|
|
*err_code = 400;
|
|
|
- *reason = (const u08bits *)"Bad request";
|
|
|
|
|
|
} else if (is_allocation_valid(a)) {
|
|
|
|
|
@@ -2343,7 +2332,6 @@ static int handle_turn_connection_bind(turn_turnserver *server,
|
|
|
if (*ua_num > 0) {
|
|
|
|
|
|
*err_code = 420;
|
|
|
- *reason = (const u08bits *)"Unknown attribute";
|
|
|
|
|
|
} else if (*err_code) {
|
|
|
|
|
@@ -2584,7 +2572,6 @@ static int handle_turn_channel_bind(turn_turnserver *server,
|
|
|
if (*ua_num > 0) {
|
|
|
|
|
|
*err_code = 420;
|
|
|
- *reason = (const u08bits *)"Unknown attribute";
|
|
|
|
|
|
} else if (*err_code) {
|
|
|
|
|
@@ -2798,7 +2785,6 @@ static int handle_turn_binding(turn_turnserver *server,
|
|
|
if (*ua_num > 0) {
|
|
|
|
|
|
*err_code = 420;
|
|
|
- *reason = (const u08bits *)"Unknown attribute";
|
|
|
|
|
|
} else if (*err_code) {
|
|
|
|
|
@@ -3286,7 +3272,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
|
|
|
if(!sar) {
|
|
|
*err_code = 401;
|
|
|
- *reason = (const u08bits*)"Unauthorised";
|
|
|
return create_challenge_response(ss,tid,resp_constructed,err_code,reason,nbh,method);
|
|
|
}
|
|
|
|
|
@@ -3354,7 +3339,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
|
|
|
if(!sar) {
|
|
|
*err_code = 400;
|
|
|
- *reason = (const u08bits*)"Bad request";
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -3386,7 +3370,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
|
|
|
if(!sar) {
|
|
|
*err_code = 400;
|
|
|
- *reason = (const u08bits*)"Bad request";
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -3405,7 +3388,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
*reason = (const u08bits*)"Allocation mismatch: wrong credentials";
|
|
|
} else {
|
|
|
*err_code = 441;
|
|
|
- *reason = (const u08bits*)"Wrong credentials";
|
|
|
}
|
|
|
return -1;
|
|
|
}
|
|
@@ -3424,7 +3406,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
|
|
|
if(!sar) {
|
|
|
*err_code = 400;
|
|
|
- *reason = (const u08bits*)"Bad request";
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
@@ -3461,7 +3442,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
"%s: Cannot find credentials of user <%s>\n",
|
|
|
__FUNCTION__, (char*)usname);
|
|
|
*err_code = 401;
|
|
|
- *reason = (const u08bits*)"Unauthorised";
|
|
|
return create_challenge_response(ss,tid,resp_constructed,err_code,reason,nbh,method);
|
|
|
}
|
|
|
|
|
@@ -3480,7 +3460,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
__FUNCTION__, (char*)usname);
|
|
|
*err_code = SHA_TOO_WEAK_ERROR_CODE;
|
|
|
*reason = SHA_TOO_WEAK_ERROR_REASON;
|
|
|
- *reason = (const u08bits*)"Unauthorised: weak SHA function is used";
|
|
|
return create_challenge_response(ss,tid,resp_constructed,err_code,reason,nbh,method);
|
|
|
}
|
|
|
|
|
@@ -3495,7 +3474,6 @@ static int check_stun_auth(turn_turnserver *server,
|
|
|
"%s: user %s credentials are incorrect\n",
|
|
|
__FUNCTION__, (char*)usname);
|
|
|
*err_code = 401;
|
|
|
- *reason = (const u08bits*)"Unauthorised";
|
|
|
return create_challenge_response(ss,tid,resp_constructed,err_code,reason,nbh,method);
|
|
|
}
|
|
|
|
|
@@ -3528,7 +3506,6 @@ static void set_alternate_server(turn_server_addrs_list_t *asl, const ioa_addr *
|
|
|
if(addr->ss.sa_family == local_addr->ss.sa_family) {
|
|
|
|
|
|
*err_code = 300;
|
|
|
- *reason = (const u08bits *)"Redirect";
|
|
|
|
|
|
size_t len = ioa_network_buffer_get_size(nbh);
|
|
|
stun_init_error_response_str(method, ioa_network_buffer_data(nbh), &len, *err_code, *reason, tid);
|
|
@@ -4329,7 +4306,7 @@ static int create_relay_connection(turn_turnserver* server,
|
|
|
ioa_socket_tobeclosed(s)) {
|
|
|
|
|
|
IOA_CLOSE_SOCKET(s);
|
|
|
- *err_code = 508;
|
|
|
+ *err_code = 404;
|
|
|
*reason = (const u08bits *)"Cannot find reserved socket";
|
|
|
return -1;
|
|
|
}
|
|
@@ -4389,7 +4366,7 @@ static int create_relay_connection(turn_turnserver* server,
|
|
|
} else {
|
|
|
IOA_CLOSE_SOCKET(newelem->s);
|
|
|
IOA_CLOSE_SOCKET(rtcp_s);
|
|
|
- *err_code = 508;
|
|
|
+ *err_code = 500;
|
|
|
*reason = (const u08bits *)"Wrong reservation tokens (internal error)";
|
|
|
return -1;
|
|
|
}
|