[packages/imap] - rel 7; fix build with openssl 1.1.1

arekm arekm at pld-linux.org
Wed Sep 19 09:53:14 CEST 2018


commit 0cdcd309ebbf84aca15b727f34da2e0fa46fe5c3
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Sep 19 09:53:04 2018 +0200

    - rel 7; fix build with openssl 1.1.1

 imap.spec     |  4 +++-
 openssl.patch | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)
---
diff --git a/imap.spec b/imap.spec
index 0eac3e9..53e1a2e 100644
--- a/imap.spec
+++ b/imap.spec
@@ -7,7 +7,7 @@ Summary(uk.UTF-8):	Забезпечує підтримку мережевого
 Summary(zh_CN.UTF-8):	IMAP和POP服务器
 Name:		imap
 Version:	2007f
-Release:	6
+Release:	7
 Epoch:		1
 License:	Apache v2.0
 Group:		Networking/Daemons
@@ -33,6 +33,7 @@ Patch8:		%{name}-headers_fix.patch
 Patch9:		%{name}-annotations.patch
 Patch10:	%{name}-werror.patch
 Patch11:	no-ustat.h.patch
+Patch12:	openssl.patch
 URL:		http://www.washington.edu/imap/
 BuildRequires:	/sbin/ldconfig
 BuildRequires:	openssl-devel >= 0.9.7d
@@ -300,6 +301,7 @@ POP/IMAP.
 %patch9 -p1
 %patch10 -p1
 %patch11 -p1
+%patch12 -p1
 
 cd docs/rfc
 ls rfc* > ../INDEX.rfc
diff --git a/openssl.patch b/openssl.patch
new file mode 100644
index 0000000..1a06341
--- /dev/null
+++ b/openssl.patch
@@ -0,0 +1,58 @@
+diff -urN imap-2007f.org/src/osdep/unix/ssl_unix.c imap-2007f/src/osdep/unix/ssl_unix.c
+--- imap-2007f.org/src/osdep/unix/ssl_unix.c	2011-07-23 02:20:10.000000000 +0200
++++ imap-2007f/src/osdep/unix/ssl_unix.c	2018-09-19 09:48:16.264495807 +0200
+@@ -269,10 +269,21 @@
+   if (!(flags & NET_NOVALIDATECERT) &&
+       (err = ssl_validate_cert (cert = SSL_get_peer_certificate (stream->con),
+ 				host))) {
++    X509_NAME *subject_name;
++    char *cert_name = NULL;
++    if (cert) {
++      subject_name = X509_get_subject_name(cert);
++      cert_name = X509_NAME_oneline(subject_name, NULL, 0);
++    }
++    if (scq) {
++      sprintf (tmp,"*%.255s",err,cert_name ? cert_name : "???");
++      OPENSSL_free(cert_name);
+ 				/* application callback */
+-    if (scq) return (*scq) (err,host,cert ? cert->name : "???") ? NIL : "";
++      return (*scq) (err,host,cert ? tmp : "???") ? NIL : "";
++    }
+ 				/* error message to return via mm_log() */
+-    sprintf (tmp,"*%.128s: %.255s",err,cert ? cert->name : "???");
++    sprintf (tmp,"*%.128s: %.255s",err,cert_name ? cert_name : "???");
++    OPENSSL_free(cert_name);
+     return ssl_last_error = cpystr (tmp);
+   }
+   return NIL;
+@@ -319,12 +330,20 @@
+   char *s,*t,*ret;
+   void *ext;
+   GENERAL_NAME *name;
++
++  X509_NAME *subject_name;
++  char *cert_name = NULL;
++  if (cert) {
++    subject_name = X509_get_subject_name(cert);
++    cert_name = X509_NAME_oneline(subject_name, NULL, 0);
++  }
++
+ 				/* make sure have a certificate */
+   if (!cert) ret = "No certificate from server";
+ 				/* and that it has a name */
+-  else if (!cert->name) ret = "No name in certificate";
++  else if (!cert_name) ret = "No name in certificate";
+ 				/* locate CN */
+-  else if (s = strstr (cert->name,"/CN=")) {
++  else if (s = strstr (cert_name,"/CN=")) {
+     if (t = strchr (s += 4,'/')) *t = '\0';
+ 				/* host name matches pattern? */
+     ret = ssl_compare_hostnames (host,s) ? NIL :
+@@ -340,6 +359,7 @@
+ 	    ssl_compare_hostnames (host,s)) ret = NIL;
+   }
+   else ret = "Unable to locate common name in certificate";
++  OPENSSL_free(cert_name);
+   return ret;
+ }
+ 

================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/imap.git/commitdiff/0cdcd309ebbf84aca15b727f34da2e0fa46fe5c3



More information about the pld-cvs-commit mailing list