~paulliu/ubuntu/precise/freerdp/fixext

« back to all changes in this revision

Viewing changes to libfreerdp-core/nego.c

  • Committer: Package Import Robot
  • Author(s): Otavio Salvador
  • Date: 2012-02-11 10:34:05 UTC
  • mfrom: (1.2.2)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: package-import@ubuntu.com-20120211103405-x2wgdb6x8plb7cdk
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
521
521
boolean nego_send_negotiation_response(rdpNego* nego)
522
522
{
523
523
        STREAM* s;
 
524
        rdpSettings* settings;
524
525
        int length;
525
526
        uint8 *bm, *em;
 
527
        boolean ret;
 
528
 
 
529
        ret = true;
 
530
        settings = nego->transport->settings;
526
531
 
527
532
        s = transport_send_stream_init(nego->transport, 256);
528
533
        length = TPDU_CONNECTION_CONFIRM_LENGTH;
538
543
                stream_write_uint32(s, nego->selected_protocol); /* selectedProtocol */
539
544
                length += 8;
540
545
        }
 
546
        else if (!settings->rdp_security)
 
547
        {
 
548
                stream_write_uint8(s, TYPE_RDP_NEG_FAILURE);
 
549
                stream_write_uint8(s, 0); /* flags */
 
550
                stream_write_uint16(s, 8); /* RDP_NEG_DATA length (8) */
 
551
                /*
 
552
                 * TODO: Check for other possibilities,
 
553
                 *       like SSL_NOT_ALLOWED_BY_SERVER.
 
554
                 */
 
555
                printf("nego_send_negotiation_response: client supports only Standard RDP Security\n");
 
556
                stream_write_uint32(s, SSL_REQUIRED_BY_SERVER);
 
557
                length += 8;
 
558
                ret = false;
 
559
        }
541
560
 
542
561
        stream_get_mark(s, em);
543
562
        stream_set_mark(s, bm);
548
567
        if (transport_write(nego->transport, s) < 0)
549
568
                return false;
550
569
 
551
 
        /* update settings with negotiated protocol security */
552
 
        nego->transport->settings->requested_protocols = nego->requested_protocols;
553
 
        nego->transport->settings->selected_protocol = nego->selected_protocol;
554
 
 
555
 
        return true;
 
570
        if (ret)
 
571
        {
 
572
                /* update settings with negotiated protocol security */
 
573
                settings->requested_protocols = nego->requested_protocols;
 
574
                settings->selected_protocol = nego->selected_protocol;
 
575
 
 
576
                if (settings->selected_protocol == PROTOCOL_RDP)
 
577
                {
 
578
                        settings->tls_security = false;
 
579
                        settings->nla_security = false;
 
580
                        settings->rdp_security = true;
 
581
                        settings->encryption = true;
 
582
                        settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
 
583
                        settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
 
584
                }
 
585
                else if (settings->selected_protocol == PROTOCOL_TLS)
 
586
                {
 
587
                        settings->tls_security = true;
 
588
                        settings->nla_security = false;
 
589
                        settings->rdp_security = false;
 
590
                        settings->encryption = false;
 
591
                        settings->encryption_method = ENCRYPTION_METHOD_NONE;
 
592
                        settings->encryption_level = ENCRYPTION_LEVEL_NONE;
 
593
                }
 
594
                else if (settings->selected_protocol == PROTOCOL_NLA)
 
595
                {
 
596
                        settings->tls_security = true;
 
597
                        settings->nla_security = true;
 
598
                        settings->rdp_security = false;
 
599
                        settings->encryption = false;
 
600
                        settings->encryption_method = ENCRYPTION_METHOD_NONE;
 
601
                        settings->encryption_level = ENCRYPTION_LEVEL_NONE;
 
602
                }
 
603
        }
 
604
 
 
605
        return ret;
556
606
}
557
607
 
558
608
/**