tstellar / rpms / openldap

Forked from rpms/openldap 3 years ago
Clone
4b2abac
Support TLSv1 and later.
4b2abac
4b2abac
Author: Mark Reynolds <mreynolds@redhat.com>
4b2abac
Backported-by: Jan Synacek <jsynacek@redhat.com>
4b2abac
Upstream ITS: #7979
4b2abac
Upstream commit: 7a7d9419432954cac18a582bed85a7c489d90f00
4b2abac
592250e
--- openldap-2.4.40/libraries/libldap/tls_m.c	2014-11-14 09:02:39.489493061 +0100
592250e
+++ openldap-2.4.40/libraries/libldap/tls_m.c	2014-11-14 09:23:07.239463097 +0100
592250e
@@ -790,7 +790,7 @@ tlsm_bad_cert_handler(void *arg, PRFileD
592250e
 	case SSL_ERROR_BAD_CERT_DOMAIN:
592250e
 		break;
592250e
 	default:
592250e
-		success = SECFailure;
592250e
+ 		success = SECFailure;
592250e
 		break;
592250e
 	}
4b2abac
 
592250e
@@ -1729,6 +1729,8 @@ tlsm_deferred_init( void *arg )
4b2abac
 	NSSInitContext *initctx = NULL;
4b2abac
 	PK11SlotInfo *certdb_slot = NULL;
4b2abac
 #endif
4b2abac
+	SSLVersionRange range;
4b2abac
+	SSLProtocolVariant variant;
4b2abac
 	SECStatus rc;
4b2abac
 	int done = 0;
4b2abac
 
592250e
@@ -1911,6 +1913,16 @@ tlsm_deferred_init( void *arg )
592250e
 			}
4b2abac
 		}
4b2abac
 
4b2abac
+		/*
4b2abac
+		 * Set the SSL version range.  MozNSS SSL versions are the same as openldap's:
4b2abac
+		 *
4b2abac
+		 * SSL_LIBRARY_VERSION_TLS_1_* are equivalent to LDAP_OPT_X_TLS_PROTOCOL_TLS1_*
4b2abac
+		 */
4b2abac
+		SSL_VersionRangeGetSupported(ssl_variant_stream, &range); /* this sets the max */
4b2abac
+		range.min = lt->lt_protocol_min ? lt->lt_protocol_min : range.min;
4b2abac
+		variant = ssl_variant_stream;
4b2abac
+		SSL_VersionRangeSetDefault(variant, &range);
4b2abac
+
592250e
 		NSS_SetDomesticPolicy();
4b2abac
 
4b2abac
 		PK11_SetPasswordFunc( tlsm_pin_prompt );
592250e
--- openldap-2.4.40/include/ldap.h	2014-09-19 03:48:49.000000000 +0200
592250e
+++ openldap-2.4.40/include/ldap.h	2014-11-14 09:25:54.560801030 +0100
592250e
@@ -176,6 +176,7 @@ LDAP_BEGIN_DECL
592250e
 #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_0		((3 << 8) + 1)
592250e
 #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_1		((3 << 8) + 2)
592250e
 #define LDAP_OPT_X_TLS_PROTOCOL_TLS1_2		((3 << 8) + 3)
592250e
+#define LDAP_OPT_X_TLS_PROTOCOL_TLS1_3		((3 << 8) + 4)
4b2abac
 
592250e
 /* OpenLDAP SASL options */
592250e
 #define LDAP_OPT_X_SASL_MECH			0x6100