diff options
-rw-r--r-- | pow/POW-0.7/POW.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pow/POW-0.7/POW.c b/pow/POW-0.7/POW.c index f71d9d05..474eb37e 100644 --- a/pow/POW-0.7/POW.c +++ b/pow/POW-0.7/POW.c @@ -3720,6 +3720,7 @@ static PyObject * ssl_object_add_certificate(ssl_object *self, PyObject *args) { x509_object *x509 = NULL; + X509 *x = NULL; if (!PyArg_ParseTuple(args, "O!", &x509type, &x509)) goto error; @@ -3727,13 +3728,21 @@ ssl_object_add_certificate(ssl_object *self, PyObject *args) if (self->ctxset) { PyErr_SetString( SSLErrorObject, "cannot be called after setFd()" ); goto error; } - if ( !SSL_CTX_add_extra_chain_cert(self->ctx, x509->x509) ) + if ( !(x = X509_dup(x509->x509)) ) + { PyErr_SetString( SSLErrorObject, "could not duplicate X509 object" ); goto error; } + + if ( !SSL_CTX_add_extra_chain_cert(self->ctx, x) ) { set_openssl_pyerror( "could not add certificate" ); goto error; } + x = NULL; + return Py_BuildValue(""); error: + if (x) + X509_free(x); + return NULL; } |