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:
Nils Ohlmeier [:drno] 2016-09-22 17:56:29 -07:00
Родитель c09374be30
Коммит 9ddb815b69
3 изменённых файлов: 42 добавлений и 42 удалений

Просмотреть файл

@ -285,51 +285,50 @@ static int nr_socket_buffered_stun_recvfrom(void *obj,void * restrict buf,
ABORT(R_FAILED);
}
reread:
/* Read all the expected bytes */
assert(sock->bytes_needed <= sock->buffer_size - sock->bytes_read);
while (sock->bytes_needed) {
/* Read all the expected bytes */
assert(sock->bytes_needed <= sock->buffer_size - sock->bytes_read);
if(r=nr_socket_read(sock->inner,
sock->buffer + sock->bytes_read,
sock->bytes_needed, &bytes_read, 0))
ABORT(r);
if(r=nr_socket_read(sock->inner,
sock->buffer + sock->bytes_read,
sock->bytes_needed, &bytes_read, 0))
ABORT(r);
assert(bytes_read <= sock->bytes_needed);
sock->bytes_needed -= bytes_read;
sock->bytes_read += bytes_read;
assert(bytes_read <= sock->bytes_needed);
sock->bytes_needed -= bytes_read;
sock->bytes_read += bytes_read;
/* Unfinished */
if (sock->bytes_needed)
ABORT(R_WOULDBLOCK);
/* Unfinished */
if (sock->bytes_needed)
ABORT(R_WOULDBLOCK);
/* No more bytes expected */
if (sock->read_state == NR_ICE_SOCKET_READ_NONE) {
size_t remaining_length;
if (sock->framing_type == ICE_TCP_FRAMING) {
if (sock->bytes_read < sizeof(nr_frame_header))
/* No more bytes expected */
if (sock->read_state == NR_ICE_SOCKET_READ_NONE) {
size_t remaining_length;
if (sock->framing_type == ICE_TCP_FRAMING) {
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);
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);

Просмотреть файл

@ -75,11 +75,11 @@ nr_stun_form_request_or_indication(int mode, int msg_type, nr_stun_message **msg
switch (mode) {
default:
req->header.magic_cookie = NR_STUN_MAGIC_COOKIE;
if ((r=nr_stun_message_add_fingerprint_attribute(req)))
ABORT(r);
/* fall through */
case NR_STUN_MODE_STUN_NO_AUTH:
req->header.magic_cookie = NR_STUN_MAGIC_COOKIE;
break;
#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;
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);
*msg = req;

Просмотреть файл

@ -40,6 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef USE_STUND_0_96
#define NR_STUN_MODE_STUND_0_96 2 /* backwards compatibility mode */
#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);
typedef struct nr_stun_client_stun_binding_request_params_ {