Ticket #764: pyOpenSSL.diff

File pyOpenSSL.diff, 2.1 KB (added by jknight, 12 years ago)
  • ssl.c

    old new  
    180180    PyModule_AddIntConstant(module, "OP_NETSCAPE_CA_DN_BUG", SSL_OP_NETSCAPE_CA_DN_BUG);
    181181    PyModule_AddIntConstant(module, "OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG", SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
    182182
     183        /* For SSL_set_shutdown */
     184    PyModule_AddIntConstant(module, "SENT_SHUTDOWN", SSL_SENT_SHUTDOWN);
     185    PyModule_AddIntConstant(module, "RECEIVED_SHUTDOWN", SSL_RECEIVED_SHUTDOWN);
     186
    183187    dict = PyModule_GetDict(module);
    184188    if (!init_ssl_context(dict))
    185189        goto error;
  • connection.c

    old new  
    756756    return Py_None;
    757757}
    758758
     759static char ssl_Connection_get_shutdown_doc[] = "\n\
     760Get shutdown state\n\
     761\n\
     762Arguments: self - The Connection object\n\
     763           args - The Python argument tuple, should be empty\n\
     764Returns:   The shutdown state, a bitmask of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n\
     765";
     766static PyObject *
     767ssl_Connection_get_shutdown(ssl_ConnectionObj *self, PyObject *args)
     768{
     769    if (!PyArg_ParseTuple(args, ":get_shutdown"))
     770        return NULL;
     771
     772        return PyInt_FromLong((long)SSL_get_shutdown(self->ssl));
     773}
     774
     775static char ssl_Connection_set_shutdown_doc[] = "\n\
     776Set shutdown state\n\
     777\n\
     778Arguments: self - The Connection object\n\
     779           args - The Python argument tuple, should be\n\
     780             shutdown state - bitmask of SENT_SHUTDOWN, RECEIVED_SHUTDOWN.\n\
     781Returns:   None\n\
     782";
     783static PyObject *
     784ssl_Connection_set_shutdown(ssl_ConnectionObj *self, PyObject *args)
     785{
     786    int shutdown;
     787       
     788    if (!PyArg_ParseTuple(args, "i:set_shutdown", &shutdown))
     789        return NULL;
     790       
     791        SSL_set_shutdown(self->ssl, shutdown);
     792    Py_INCREF(Py_None);
     793    return Py_None;
     794}
     795
    759796static char ssl_Connection_state_string_doc[] = "\n\
    760797Get a verbose state description\n\
    761798\n\
     
    888925    ADD_METHOD(makefile),
    889926    ADD_METHOD(get_app_data),
    890927    ADD_METHOD(set_app_data),
     928    ADD_METHOD(get_shutdown),
     929    ADD_METHOD(set_shutdown),
    891930    ADD_METHOD(state_string),
    892931    ADD_METHOD(sock_shutdown),
    893932    ADD_METHOD(get_peer_certificate),