~ubuntu-branches/ubuntu/precise/python3.2/precise-proposed

« back to all changes in this revision

Viewing changes to Modules/_ssl.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 18:40:39 UTC
  • mfrom: (30.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120309184039-j3yk2emxr1plyo21
Tags: 3.2.3~rc1-1
* Python 3.2.3 release candidate 1.
* Update to 20120309 from the 3.2 branch.
* Fix libpython.a symlink. Closes: #660146.
* Build-depend on xauth.
* Run the gdb tests for the debug build only.

Show diffs side-by-side

added added

removed removed

Lines of Context:
519
519
            goto fail1;
520
520
    }
521
521
    /* now, there's typically a dangling RDN */
522
 
    if ((rdn != NULL) && (PyList_Size(rdn) > 0)) {
523
 
        rdnt = PyList_AsTuple(rdn);
524
 
        Py_DECREF(rdn);
525
 
        if (rdnt == NULL)
526
 
            goto fail0;
527
 
        retcode = PyList_Append(dn, rdnt);
528
 
        Py_DECREF(rdnt);
529
 
        if (retcode < 0)
530
 
            goto fail0;
 
522
    if (rdn != NULL) {
 
523
        if (PyList_GET_SIZE(rdn) > 0) {
 
524
            rdnt = PyList_AsTuple(rdn);
 
525
            Py_DECREF(rdn);
 
526
            if (rdnt == NULL)
 
527
                goto fail0;
 
528
            retcode = PyList_Append(dn, rdnt);
 
529
            Py_DECREF(rdnt);
 
530
            if (retcode < 0)
 
531
                goto fail0;
 
532
        }
 
533
        else {
 
534
            Py_DECREF(rdn);
 
535
        }
531
536
    }
532
537
 
533
538
    /* convert list to tuple */
578
583
    /* get a memory buffer */
579
584
    biobuf = BIO_new(BIO_s_mem());
580
585
 
581
 
    i = 0;
 
586
    i = -1;
582
587
    while ((i = X509_get_ext_by_NID(
583
588
                    certificate, NID_subject_alt_name, i)) >= 0) {
584
589
 
679
684
            }
680
685
            Py_DECREF(t);
681
686
        }
 
687
        sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free);
682
688
    }
683
689
    BIO_free(biobuf);
684
690
    if (peer_alt_names != Py_None) {
1023
1029
#endif
1024
1030
 
1025
1031
    /* Guard against socket too large for select*/
1026
 
#ifndef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
1027
 
    if (s->sock_fd >= FD_SETSIZE)
 
1032
    if (!_PyIsSelectable_fd(s->sock_fd))
1028
1033
        return SOCKET_TOO_LARGE_FOR_SELECT;
1029
 
#endif
1030
1034
 
1031
1035
    /* Construct the arguments to select */
1032
1036
    tv.tv_sec = (int)s->sock_timeout;
1482
1486
    self->ctx = ctx;
1483
1487
    /* Defaults */
1484
1488
    SSL_CTX_set_verify(self->ctx, SSL_VERIFY_NONE, NULL);
1485
 
    SSL_CTX_set_options(self->ctx, SSL_OP_ALL);
 
1489
    SSL_CTX_set_options(self->ctx,
 
1490
                        SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
1486
1491
 
1487
1492
#define SID_CTX "Python"
1488
1493
    SSL_CTX_set_session_id_context(self->ctx, (const unsigned char *) SID_CTX,
2144
2149
                            PY_SSL_VERSION_TLS1);
2145
2150
 
2146
2151
    /* protocol options */
2147
 
    PyModule_AddIntConstant(m, "OP_ALL", SSL_OP_ALL);
 
2152
    PyModule_AddIntConstant(m, "OP_ALL",
 
2153
                            SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
2148
2154
    PyModule_AddIntConstant(m, "OP_NO_SSLv2", SSL_OP_NO_SSLv2);
2149
2155
    PyModule_AddIntConstant(m, "OP_NO_SSLv3", SSL_OP_NO_SSLv3);
2150
2156
    PyModule_AddIntConstant(m, "OP_NO_TLSv1", SSL_OP_NO_TLSv1);