[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Pull bugfix in tls.c into main branch.



Update of /home/minion/cvsroot/src/minion/src
In directory moria.mit.edu:/tmp/cvs-serv1109

Modified Files:
	crypt.c tls.c 
Log Message:
Pull bugfix in tls.c into main branch.

Index: crypt.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/crypt.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- crypt.c	9 Oct 2003 03:56:30 -0000	1.32
+++ crypt.c	13 Oct 2003 17:11:09 -0000	1.33
@@ -1243,7 +1243,7 @@
         X509_NAME *name_issuer = NULL;
         int nid;
         PyObject *retval;
-        time_t time;
+        time_t _time;
 
         if (!PyArg_ParseTupleAndKeywords(args, kwargs,
                                          "sO!O!ssdd:generate_cert",
@@ -1275,8 +1275,10 @@
                 goto error;
         if (!(X509_set_version(x509, 2)))
                 goto error;
-        /* XXXX006 This is not correct, and probably needs to change. */
-        if (!(ASN1_INTEGER_set(X509_get_serialNumber(x509),0L)))
+
+        /* Seconds since jan 1 2003. */
+        _time = time(NULL) - 1041397200;
+        if (!(ASN1_INTEGER_set(X509_get_serialNumber(x509),(long)_time)))
                 goto error;
 
 #define SET_PART(n, part, val)                                   \
@@ -1299,11 +1301,11 @@
         if (!(X509_set_subject_name(x509, name)))
                 goto error;
 
-        time = (time_t) start_time;
-        if (!X509_time_adj(X509_get_notBefore(x509),0,&time))
+        _time = (time_t) start_time;
+        if (!X509_time_adj(X509_get_notBefore(x509),0,&_time))
                 goto error;
-        time = (time_t) end_time;
-        if (!X509_time_adj(X509_get_notAfter(x509),0,&time))
+        _time = (time_t) end_time;
+        if (!X509_time_adj(X509_get_notAfter(x509),0,&_time))
                 goto error;
         if (!(X509_set_pubkey(x509, pkey)))
                 goto error;

Index: tls.c
===================================================================
RCS file: /home/minion/cvsroot/src/minion/src/tls.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- tls.c	9 Oct 2003 03:56:30 -0000	1.27
+++ tls.c	13 Oct 2003 17:11:09 -0000	1.28
@@ -354,7 +354,7 @@
 mm_TLSSock_connect(PyObject *self, PyObject *args, PyObject *kwargs)
 {
         SSL *ssl;
-        int r, err;
+        int r;
 
         assert(mm_TLSSock_Check(self));
         FAIL_IF_ARGS();
@@ -365,7 +365,6 @@
         r = SSL_connect(ssl);
         Py_END_ALLOW_THREADS
         if (r <= 0) {
-                err = SSL_get_error(ssl,r);
                 tls_error(ssl, r, 0);
                 return NULL;
         }