Commit 7257198b authored by Mike Hibler's avatar Mike Hibler

Introduce a full port of m2crypto rather than a wrapper.

The full port is fixed at version 0.29.1. The latest version that was
wraped, version 0.30.1 has problems with unicode to "string" conversions.
This explicitly caused an exception from the m2crypto SWIG stubs for libssl.
Even after fixing that, we still could not verify a certificate due to apparent
missing chars in strings.
parent c2387c9b
# New ports collection makefile for: emulab-py-m2crypto
# Date created: 06 January 2010
# Whom: mike@cs.utah.edu
#
# $FreeBSD: ports/security/py-m2crypto/Makefile,v 1.21 2009/01/27 10:20:52 mnag Exp $
#
# Make sure we pick up all the standard port patches too
PATCHDIR= $(PORTSDIR)/security/py-m2crypto/files
PKGORIGIN= misc/emulab-py-m2crypto
.include "../../security/py-m2crypto/Makefile"
# Our extra patch
.if ${PORTVERSION} == "0.30.1"
EXTRA_PATCHES= $(FILESDIR)/emulab-patch-SSL-Connection-30
.else
.if (${PORTVERSION} == "0.29.0" || ${PORTVERSION} == "0.30.1")
EXTRA_PATCHES= $(FILESDIR)/emulab-patch-SSL-Connection-29
.else
EXTRA_PATCHES= $(FILESDIR)/emulab-patch-SSL-Connection
.endif
.endif
.if ${PORTVERSION} == "0.25.1"
# Missing dependency for 0.25
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}typing>0:${PORTSDIR}/devel/py-typing
.endif
.if !(${PORTVERSION} == "0.22.3" || ${PORTVERSION} == "0.22.5" || ${PORTVERSION} == "0.24.0")
# Fix bug in 0.25.1 and above
EXTRA_PATCHES+= $(FILESDIR)/emulab-patch-httpslib
.endif
SHA256 (M2Crypto-0.22.3.tar.gz) = 6071bfc817d94723e9b458a010d565365104f84aa73f7fe11919871f7562ff72
SIZE (M2Crypto-0.22.3.tar.gz) = 74795
SHA256 (M2Crypto-0.22.5.tar.gz) = b5ce9b09062a2c453e9d9c28dde96b7f90834313e60f419b143d751eb4109fdc
SIZE (M2Crypto-0.22.5.tar.gz) = 80986
SHA256 (M2Crypto-0.24.0.tar.gz) = 80a56441a1d2c0cf27e725be7554c92598b938fc8767ee2c71fdbc2fdc055ee8
SIZE (M2Crypto-0.24.0.tar.gz) = 184457
SHA256 (M2Crypto-0.25.1.tar.gz) = ac303a1881307a51c85ee8b1d87844d9866ee823b4fdbc52f7e79187c2d9acef
SIZE (M2Crypto-0.25.1.tar.gz) = 300904
SHA256 (M2Crypto-0.26.0.tar.gz) = 05d94fd9b2dae2fb8e072819a795f0e05d3611b09ea185f68e1630530ec09ae8
SIZE (M2Crypto-0.26.0.tar.gz) = 305914
SHA256 (M2Crypto-0.26.4.tar.gz) = 5cae7acc0b34821f8c0ddf6665e482893fe1f198ad6379e61ffa9d8e65f5c199
SIZE (M2Crypto-0.26.4.tar.gz) = 1116587
SHA256 (M2Crypto-0.29.0.tar.gz) = a0fea2c5ab913e42864d1ccbaee5878c23886368b606e923609fda4ce37d26c0
SIZE (M2Crypto-0.29.0.tar.gz) = 1269694
SHA256 (M2Crypto-0.30.1.tar.gz) = a1b2751cdadc6afac3df8a5799676b7b7c67a6ad144bb62d38563062e7cd3fc6
SIZE (M2Crypto-0.30.1.tar.gz) = 1272599
--- M2Crypto/SSL/Connection.py.orig 2018-02-22 15:43:29.000000000 -0700
+++ M2Crypto/SSL/Connection.py 2018-04-04 15:57:44.341502000 -0600
@@ -32,11 +32,15 @@
# type: (*Any, **Any) -> int
return 1
+def _clientPostConnectionCheck(*args, **kw):
+ # type: (*Any, **Any) -> int
+ return 1
+
class Connection:
"""An SSL connection."""
- clientPostConnectionCheck = Checker.Checker()
+ clientPostConnectionCheck = _clientPostConnectionCheck
serverPostConnectionCheck = _serverPostConnectionCheck
m2_bio_free = m2.bio_free
--- M2Crypto/httpslib.py.orig 2016-07-25 09:05:21.000000000 -0600
+++ M2Crypto/httpslib.py 2017-03-16 10:22:30.351094000 -0600
@@ -121,6 +121,20 @@
self.session = session
+class HTTPS(HTTP):
+
+ _connection_class = HTTPSConnection
+
+ def __init__(self, host='', port=None, strict=None, **ssl):
+ HTTP.__init__(self, host, port, strict)
+ try:
+ self.ssl_ctx = ssl['ssl_context']
+ except KeyError:
+ self.ssl_ctx = SSL.Context('sslv23')
+ assert isinstance(self._conn, HTTPSConnection)
+ self._conn.ssl_ctx = self.ssl_ctx
+
+
class ProxyHTTPSConnection(HTTPSConnection):
"""
An HTTPS Connection that uses a proxy and the CONNECT request.
diff -ru M2Crypto-0.25.1.orig/M2Crypto/m2xmlrpclib.py M2Crypto-0.25.1/M2Crypto/m2xmlrpclib.py
--- M2Crypto/m2xmlrpclib.py.orig 2016-07-22 03:14:05.000000000 -0600
+++ M2Crypto/m2xmlrpclib.py 2017-03-16 10:23:47.153660000 -0600
@@ -40,8 +40,7 @@
# Handle username and password.
user_passwd, host_port = m2urllib.splituser(host)
_host, _port = m2urllib.splitport(host_port)
- h = httpslib.HTTPSConnection(_host, int(_port),
- ssl_context=self.ssl_ctx)
+ h = httpslib.HTTPS(_host, int(_port), ssl_context=self.ssl_ctx)
if verbose:
h.set_debuglevel(1)
M2Crypto is the most complete Python wrapper for OpenSSL featuring RSA, DSA, DH,
HMACs, message digests, symmetric ciphers (including AES); SSL functionality to
implement clients and servers; HTTPS extensions to Python's httplib, urllib, and
xmlrpclib; unforgeable HMAC'ing AuthCookies for web session management; FTP/TLS
client and server; S/MIME; ZServerSSL: A HTTPS server for Zope and ZSmime: An
S/MIME messenger for Zope.
WWW: https://pypi.python.org/pypi/M2Crypto
WWW: http://chandlerproject.org/Projects/MeTooCrypto
# New ports collection makefile for: emulab-py-m2crypto
# Date created: 06 January 2010
# Whom: mike@cs.utah.edu
# #
# $FreeBSD: ports/security/py-m2crypto/Makefile,v 1.21 2009/01/27 10:20:52 mnag Exp $ # Emulab version frozen at 0.29.0.
# #
# Version 0.30.1 has problems with unicode to string conversions.
# This explicitly caused an exception from the m2crypto SWIG stubs,
# but even after fixing that, we could not verify a certificate due
# to apparent missing chars in strings.
#
# We will resync if/when they fix the problem(s).
#
# Based on:
# Created by: Peter Haight <peterh@sapros.com>
# $FreeBSD: branches/2018Q2/security/py-m2crypto/Makefile 465899 2018-03-29 14:53:23Z mat $
# Make sure we pick up all the standard port patches too PORTNAME= m2crypto
PATCHDIR= $(PORTSDIR)/security/py-m2crypto/files PORTVERSION= 0.29.0
PORTREVISION= 1
CATEGORIES= security python misc
MASTER_SITES= CHEESESHOP http://www.emulab.net/distributions/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
DISTNAME= M2Crypto-${PORTVERSION}
PKGORIGIN= misc/emulab-py-m2crypto MAINTAINER= sunpoet@FreeBSD.org
.include "../../security/py-m2crypto/Makefile" COMMENT= Crypto and SSL toolkit for Python
# Our extra patch LICENSE= MIT
.if ${PORTVERSION} == "0.30.1" LICENSE_FILE= ${WRKSRC}/LICENCE
EXTRA_PATCHES= $(FILESDIR)/emulab-patch-SSL-Connection-30
.else
.if (${PORTVERSION} == "0.29.0" || ${PORTVERSION} == "0.30.1")
EXTRA_PATCHES= $(FILESDIR)/emulab-patch-SSL-Connection-29
.else
EXTRA_PATCHES= $(FILESDIR)/emulab-patch-SSL-Connection
.endif
.endif
.if ${PORTVERSION} == "0.25.1" BROKEN_SSL= openssl-devel
# Missing dependency for 0.25 BROKEN_SSL_REASON_openssl-devel= Error: Syntax error in input(1).
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}typing>0:${PORTSDIR}/devel/py-typing
.endif BUILD_DEPENDS= swig3.0:devel/swig30
.if !(${PORTVERSION} == "0.22.3" || ${PORTVERSION} == "0.22.5" || ${PORTVERSION} == "0.24.0") PYDISTUTILS_BUILDARGS= build_ext --include=${OPENSSLINC} --openssl=${OPENSSLBASE} --swig=${LOCALBASE}/bin/swig3.0
# Fix bug in 0.25.1 and above USE_PYTHON= autoplist concurrent distutils
EXTRA_PATCHES+= $(FILESDIR)/emulab-patch-httpslib USES= python ssl
post-patch:
@${REINPLACE_CMD} -e "s|swig\(', '-version\)|swig3.0\1|" ${WRKSRC}/setup.py
post-install:
${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/M2Crypto/_m2crypto.so
.include <bsd.port.pre.mk>
.if ${PYTHON_REL} < 3500
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}typing>=0:devel/py-typing@${FLAVOR}
.endif .endif
EXTRA_PATCHES= ${FILESDIR}/emulab-patch-SSL-Connection-29 \
${FILESDIR}/emulab-patch-httpslib
.include <bsd.port.post.mk>
SHA256 (M2Crypto-0.22.3.tar.gz) = 6071bfc817d94723e9b458a010d565365104f84aa73f7fe11919871f7562ff72 TIMESTAMP = 1519464453
SIZE (M2Crypto-0.22.3.tar.gz) = 74795
SHA256 (M2Crypto-0.22.5.tar.gz) = b5ce9b09062a2c453e9d9c28dde96b7f90834313e60f419b143d751eb4109fdc
SIZE (M2Crypto-0.22.5.tar.gz) = 80986
SHA256 (M2Crypto-0.24.0.tar.gz) = 80a56441a1d2c0cf27e725be7554c92598b938fc8767ee2c71fdbc2fdc055ee8
SIZE (M2Crypto-0.24.0.tar.gz) = 184457
SHA256 (M2Crypto-0.25.1.tar.gz) = ac303a1881307a51c85ee8b1d87844d9866ee823b4fdbc52f7e79187c2d9acef
SIZE (M2Crypto-0.25.1.tar.gz) = 300904
SHA256 (M2Crypto-0.26.0.tar.gz) = 05d94fd9b2dae2fb8e072819a795f0e05d3611b09ea185f68e1630530ec09ae8
SIZE (M2Crypto-0.26.0.tar.gz) = 305914
SHA256 (M2Crypto-0.26.4.tar.gz) = 5cae7acc0b34821f8c0ddf6665e482893fe1f198ad6379e61ffa9d8e65f5c199
SIZE (M2Crypto-0.26.4.tar.gz) = 1116587
SHA256 (M2Crypto-0.29.0.tar.gz) = a0fea2c5ab913e42864d1ccbaee5878c23886368b606e923609fda4ce37d26c0 SHA256 (M2Crypto-0.29.0.tar.gz) = a0fea2c5ab913e42864d1ccbaee5878c23886368b606e923609fda4ce37d26c0
SIZE (M2Crypto-0.29.0.tar.gz) = 1269694 SIZE (M2Crypto-0.29.0.tar.gz) = 1269694
SHA256 (M2Crypto-0.30.1.tar.gz) = a1b2751cdadc6afac3df8a5799676b7b7c67a6ad144bb62d38563062e7cd3fc6
SIZE (M2Crypto-0.30.1.tar.gz) = 1272599
...@@ -6,4 +6,4 @@ client and server; S/MIME; ZServerSSL: A HTTPS server for Zope and ZSmime: An ...@@ -6,4 +6,4 @@ client and server; S/MIME; ZServerSSL: A HTTPS server for Zope and ZSmime: An
S/MIME messenger for Zope. S/MIME messenger for Zope.
WWW: https://pypi.python.org/pypi/M2Crypto WWW: https://pypi.python.org/pypi/M2Crypto
WWW: http://chandlerproject.org/Projects/MeTooCrypto WWW: https://gitlab.com/m2crypto/m2crypto
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment