зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1304920: remove fingerprint attribute from plain binding requests. r=bwc
MozReview-Commit-ID: KpqQfHzv7zn --HG-- extra : rebase_source : 976af858b54a6ddda23b19310352359659260b71
This commit is contained in:
Родитель
c09374be30
Коммит
9ddb815b69
|
@ -285,51 +285,50 @@ static int nr_socket_buffered_stun_recvfrom(void *obj,void * restrict buf,
|
||||||
ABORT(R_FAILED);
|
ABORT(R_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
reread:
|
while (sock->bytes_needed) {
|
||||||
/* Read all the expected bytes */
|
/* Read all the expected bytes */
|
||||||
assert(sock->bytes_needed <= sock->buffer_size - sock->bytes_read);
|
assert(sock->bytes_needed <= sock->buffer_size - sock->bytes_read);
|
||||||
|
|
||||||
if(r=nr_socket_read(sock->inner,
|
if(r=nr_socket_read(sock->inner,
|
||||||
sock->buffer + sock->bytes_read,
|
sock->buffer + sock->bytes_read,
|
||||||
sock->bytes_needed, &bytes_read, 0))
|
sock->bytes_needed, &bytes_read, 0))
|
||||||
ABORT(r);
|
ABORT(r);
|
||||||
|
|
||||||
assert(bytes_read <= sock->bytes_needed);
|
assert(bytes_read <= sock->bytes_needed);
|
||||||
sock->bytes_needed -= bytes_read;
|
sock->bytes_needed -= bytes_read;
|
||||||
sock->bytes_read += bytes_read;
|
sock->bytes_read += bytes_read;
|
||||||
|
|
||||||
/* Unfinished */
|
/* Unfinished */
|
||||||
if (sock->bytes_needed)
|
if (sock->bytes_needed)
|
||||||
ABORT(R_WOULDBLOCK);
|
ABORT(R_WOULDBLOCK);
|
||||||
|
|
||||||
/* No more bytes expected */
|
/* No more bytes expected */
|
||||||
if (sock->read_state == NR_ICE_SOCKET_READ_NONE) {
|
if (sock->read_state == NR_ICE_SOCKET_READ_NONE) {
|
||||||
size_t remaining_length;
|
size_t remaining_length;
|
||||||
if (sock->framing_type == ICE_TCP_FRAMING) {
|
if (sock->framing_type == ICE_TCP_FRAMING) {
|
||||||
if (sock->bytes_read < sizeof(nr_frame_header))
|
if (sock->bytes_read < sizeof(nr_frame_header))
|
||||||
|
ABORT(R_BAD_DATA);
|
||||||
|
remaining_length = ntohs(frame->frame_length);
|
||||||
|
} else {
|
||||||
|
int tmp_length;
|
||||||
|
|
||||||
|
/* Parse the header */
|
||||||
|
if (r = nr_stun_message_length(sock->buffer, sock->bytes_read, &tmp_length))
|
||||||
|
ABORT(r);
|
||||||
|
assert(tmp_length >= 0);
|
||||||
|
if (tmp_length < 0)
|
||||||
|
ABORT(R_BAD_DATA);
|
||||||
|
remaining_length = tmp_length;
|
||||||
|
|
||||||
|
}
|
||||||
|
/* Check to see if we have enough room */
|
||||||
|
if ((sock->buffer_size - sock->bytes_read) < remaining_length)
|
||||||
ABORT(R_BAD_DATA);
|
ABORT(R_BAD_DATA);
|
||||||
remaining_length = ntohs(frame->frame_length);
|
|
||||||
} else {
|
|
||||||
int tmp_length;
|
|
||||||
|
|
||||||
/* Parse the header */
|
|
||||||
if (r = nr_stun_message_length(sock->buffer, sock->bytes_read, &tmp_length))
|
|
||||||
ABORT(r);
|
|
||||||
assert(tmp_length >= 0);
|
|
||||||
if (tmp_length < 0)
|
|
||||||
ABORT(R_BAD_DATA);
|
|
||||||
remaining_length = tmp_length;
|
|
||||||
|
|
||||||
|
sock->read_state = NR_ICE_SOCKET_READ_HDR;
|
||||||
|
/* Set ourselves up to read the rest of the data */
|
||||||
|
sock->bytes_needed = remaining_length;
|
||||||
}
|
}
|
||||||
/* Check to see if we have enough room */
|
|
||||||
if ((sock->buffer_size - sock->bytes_read) < remaining_length)
|
|
||||||
ABORT(R_BAD_DATA);
|
|
||||||
|
|
||||||
/* Set ourselves up to read the rest of the data */
|
|
||||||
sock->bytes_needed = remaining_length;
|
|
||||||
|
|
||||||
sock->read_state = NR_ICE_SOCKET_READ_HDR;
|
|
||||||
goto reread;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(skip_hdr_size <= sock->bytes_read);
|
assert(skip_hdr_size <= sock->bytes_read);
|
||||||
|
|
|
@ -75,11 +75,11 @@ nr_stun_form_request_or_indication(int mode, int msg_type, nr_stun_message **msg
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
default:
|
default:
|
||||||
req->header.magic_cookie = NR_STUN_MAGIC_COOKIE;
|
|
||||||
|
|
||||||
if ((r=nr_stun_message_add_fingerprint_attribute(req)))
|
if ((r=nr_stun_message_add_fingerprint_attribute(req)))
|
||||||
ABORT(r);
|
ABORT(r);
|
||||||
|
/* fall through */
|
||||||
|
case NR_STUN_MODE_STUN_NO_AUTH:
|
||||||
|
req->header.magic_cookie = NR_STUN_MAGIC_COOKIE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef USE_STUND_0_96
|
#ifdef USE_STUND_0_96
|
||||||
|
@ -164,7 +164,7 @@ nr_stun_build_req_no_auth(nr_stun_client_stun_binding_request_params *params, nr
|
||||||
int r,_status;
|
int r,_status;
|
||||||
nr_stun_message *req = 0;
|
nr_stun_message *req = 0;
|
||||||
|
|
||||||
if ((r=nr_stun_form_request_or_indication(NR_STUN_MODE_STUN, NR_STUN_MSG_BINDING_REQUEST, &req)))
|
if ((r=nr_stun_form_request_or_indication(NR_STUN_MODE_STUN_NO_AUTH, NR_STUN_MSG_BINDING_REQUEST, &req)))
|
||||||
ABORT(r);
|
ABORT(r);
|
||||||
|
|
||||||
*msg = req;
|
*msg = req;
|
||||||
|
|
|
@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#ifdef USE_STUND_0_96
|
#ifdef USE_STUND_0_96
|
||||||
#define NR_STUN_MODE_STUND_0_96 2 /* backwards compatibility mode */
|
#define NR_STUN_MODE_STUND_0_96 2 /* backwards compatibility mode */
|
||||||
#endif /* USE_STUND_0_96 */
|
#endif /* USE_STUND_0_96 */
|
||||||
|
#define NR_STUN_MODE_STUN_NO_AUTH 3
|
||||||
int nr_stun_form_request_or_indication(int mode, int msg_type, nr_stun_message **msg);
|
int nr_stun_form_request_or_indication(int mode, int msg_type, nr_stun_message **msg);
|
||||||
|
|
||||||
typedef struct nr_stun_client_stun_binding_request_params_ {
|
typedef struct nr_stun_client_stun_binding_request_params_ {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче