Package: python-pyopenssl
Version: 0.6-2
Severity: grave
Tags: patch
Justification: renders package unusable
When I want to create x509 extensions, I get segmentation fault.
The python code which do this is the following:
from OpenSSL import crypto
crypto.X509Extension("basicConstraints", True, "CA:TRUE")
There is a patch on this URL:
http://sourceforge.net/tracker/index.php?func=detail&aid=1166109&group_id=31249&atid=401760
I attached the patch to this email.
This patch is _not_ made by me. I applied this patch to the original package
and it seems to work fine.
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.30
Locale: LANG=C, LC_CTYPE=hu_HU (charmap=ISO-8859-2)
Versions of packages python-pyopenssl depends on:
ii python 2.3.5-2 An interactive high-level object-o
ii python2.3-pyopenssl 0.6-2 Python wrapper around the OpenSSL
-- no debconf information
diff -Naur pyOpenSSL-0.6.orig/src/crypto/x509ext.c pyOpenSSL-0.6/src/crypto/x509ext.c
--- pyOpenSSL-0.6.orig/src/crypto/x509ext.c 2002-07-09 15:34:46.000000000 +0200
+++ pyOpenSSL-0.6/src/crypto/x509ext.c 2005-03-14 17:25:42.000000000 +0100
@@ -57,7 +57,7 @@
{
crypto_X509ExtensionObj *self;
int ext_len, ext_nid;
- unsigned char *ext_der, *p;
+ unsigned char *ext_der;
X509V3_EXT_METHOD *ext_method = NULL;
ASN1_OCTET_STRING *ext_oct;
STACK_OF(CONF_VALUE) *nval;
@@ -110,17 +110,29 @@
sk_CONF_VALUE_pop_free(nval, X509V3_conf_free);
/* Find out how much memory we need */
- ext_len = ext_method->i2d(ext_struct, NULL);
-
- /* Allocate */
- if(!(ext_der = malloc(ext_len))) {
- PyErr_SetString(PyExc_MemoryError, "Could not allocate memory");
- return NULL;
+
+
+ /* Convert internal representation to DER */
+ /* and Allocate */
+ if (ext_method->it) {
+ ext_der = NULL;
+ ext_len = ASN1_item_i2d(ext_struct, &ext_der, ASN1_ITEM_ptr(ext_method->it));
+ if (ext_len < 0) {
+ PyErr_SetString(PyExc_MemoryError, "Could not allocate memory");
+ return NULL;
+ }
+ } else {
+ unsigned char *p;
+ ext_len = ext_method->i2d(ext_struct, NULL);
+ if(!(ext_der = malloc(ext_len))) {
+ PyErr_SetString(PyExc_MemoryError, "Could not allocate memory");
+ return NULL;
+ }
+ p = ext_der;
+ ext_method->i2d(ext_struct, &p);
}
/* And create the ASN1_OCTET_STRING */
- p = ext_der;
- ext_method->i2d(ext_struct, &p);
if(!(ext_oct = M_ASN1_OCTET_STRING_new())) {
exception_from_error_queue();
return NULL;
@@ -140,7 +152,7 @@
}
M_ASN1_OCTET_STRING_free(ext_oct);
- ext_method->ext_free(ext_struct);
+ //ext_method->ext_free(ext_struct);
self->x509_extension = extension;
self->dealloc = 1;