~ubuntu-branches/ubuntu/wily/zeromq3/wily-proposed

« back to all changes in this revision

Viewing changes to src/stream_engine.cpp

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2015-05-05 21:06:02 UTC
  • Revision ID: package-import@ubuntu.com-20150505210602-7nmw5z31bei3puj6
Tags: 4.0.5+dfsg-3
V3 protocol handler vulnerable to downgrade attacks, use upstream
backported fix for this issue (closes: #784366).

Show diffs side-by-side

added added

removed removed

Lines of Context:
464
464
    //  Is the peer using ZMTP/1.0 with no revision number?
465
465
    //  If so, we send and receive rest of identity message
466
466
    if (greeting_recv [0] != 0xff || !(greeting_recv [9] & 0x01)) {
 
467
        if (session->zap_enabled ()) {
 
468
            //  Reject ZMTP 1.0 connections if ZAP is enabled
 
469
            error ();
 
470
            return false;
 
471
        }
467
472
        encoder = new (std::nothrow) v1_encoder_t (out_batch_size);
468
473
        alloc_assert (encoder);
469
474
 
505
510
    }
506
511
    else
507
512
    if (greeting_recv [revision_pos] == ZMTP_1_0) {
 
513
        if (session->zap_enabled ()) {
 
514
            //  Reject ZMTP 1.0 connections if ZAP is enabled
 
515
            error ();
 
516
            return false;
 
517
        }
508
518
        encoder = new (std::nothrow) v1_encoder_t (
509
519
            out_batch_size);
510
520
        alloc_assert (encoder);
515
525
    }
516
526
    else
517
527
    if (greeting_recv [revision_pos] == ZMTP_2_0) {
 
528
        if (session->zap_enabled ()) {
 
529
            //  Reject ZMTP 1.0 connections if ZAP is enabled
 
530
            error ();
 
531
            return false;
 
532
        }
518
533
        encoder = new (std::nothrow) v2_encoder_t (out_batch_size);
519
534
        alloc_assert (encoder);
520
535