[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Resolve XXXXs and FFFFs for 004
Update of /home/minion/cvsroot/src/minion/src
In directory moria.mit.edu:/tmp/cvs-serv8971/src
Modified Files:
crypt.c tls.c
Log Message:
Resolve XXXXs and FFFFs for 004
Index: crypt.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/crypt.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- crypt.c 17 May 2003 00:08:45 -0000 1.23
+++ crypt.c 5 Jun 2003 18:41:41 -0000 1.24
@@ -493,7 +493,6 @@
PyObject *
mm_RSA_PEM_write_key(PyObject *self, PyObject *args, PyObject *kwdict)
{
- /* XXXX make this threadsafe. */
static char* kwlist[] = { "file", "public", "password", NULL };
PyObject *pyfile;
int public, passwordlen=0;
@@ -502,6 +501,7 @@
RSA *rsa = NULL;
EVP_PKEY *pkey = NULL;
FILE *file;
+ int ok = 0;
assert(mm_RSA_Check(self));
if (!PyArg_ParseTupleAndKeywords(args, kwdict, "O!i|s#:PEM_write_key",
@@ -514,6 +514,7 @@
return NULL;
}
+ Py_BEGIN_ALLOW_THREADS
if (public) {
rsa = ((mm_RSA*)self)->rsa;
if (!PEM_write_RSAPublicKey(file, rsa))
@@ -540,18 +541,23 @@
NULL, NULL))
goto error;
}
- EVP_PKEY_free(pkey);
}
- Py_INCREF(Py_None);
- return Py_None;
+ ok = 1;
+ goto done;
error:
+ mm_SSL_ERR(1);
+ done:
if (rsa && !public)
RSA_free(rsa);
if (pkey)
EVP_PKEY_free(pkey);
- mm_SSL_ERR(1);
+ Py_END_ALLOW_THREADS
+ if (ok) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
return NULL;
}
@@ -965,7 +971,6 @@
PyObject *
mm_generate_cert(PyObject *self, PyObject *args, PyObject *kwargs)
{
- /* ???? should be threadified? */
static char *kwlist[] = { "filename", "rsa", "rsa_sign",
"cn", "cn_issuer",
"start_time", "end_time", NULL };
@@ -1001,6 +1006,7 @@
&start_time, &end_time))
return NULL;
+ Py_BEGIN_ALLOW_THREADS
if (!(rsa = RSAPrivateKey_dup(((mm_RSA*)_rsa)->rsa)))
goto error;
if (!(pkey = EVP_PKEY_new()))
@@ -1085,6 +1091,7 @@
if (pkey_sign)
EVP_PKEY_free(pkey_sign);
+ Py_END_ALLOW_THREADS
return retval;
}
Index: tls.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/tls.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- tls.c 3 Jun 2003 17:28:12 -0000 1.24
+++ tls.c 5 Jun 2003 18:41:41 -0000 1.25
@@ -2,8 +2,6 @@
/* $Id$ */
#include "_minionlib.h"
-/* XXXX REMOVE*/
-#include <stdio.h>
#include <time.h>
#ifndef TRUNCATED_OPENSSL_INCLUDES
@@ -572,6 +570,7 @@
static PyObject*
mm_TLSSock_check_cert_alive(PyObject *self, PyObject *args, PyObject *kwargs)
{
+ /* ???? Should be threadified? */
time_t now;
X509 *cert = NULL;
SSL *ssl = NULL;