mirror of
				https://bitbucket.org/jsuto/piler.git
				synced 2025-11-04 00:32:26 +01:00 
			
		
		
		
	Added compat support for openssl 1.0.2 (most notably centos7)
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
		@@ -152,7 +152,9 @@ int get_tls_protocol_number(char *protocol){
 | 
				
			|||||||
      { "TLSv1", TLS1_VERSION },
 | 
					      { "TLSv1", TLS1_VERSION },
 | 
				
			||||||
      { "TLSv1.1", TLS1_1_VERSION },
 | 
					      { "TLSv1.1", TLS1_1_VERSION },
 | 
				
			||||||
      { "TLSv1.2", TLS1_2_VERSION },
 | 
					      { "TLSv1.2", TLS1_2_VERSION },
 | 
				
			||||||
 | 
					   #if OPENSSL_VERSION_NUMBER >= 0x10100000L
 | 
				
			||||||
      { "TLSv1.3", TLS1_3_VERSION },
 | 
					      { "TLSv1.3", TLS1_3_VERSION },
 | 
				
			||||||
 | 
					   #endif
 | 
				
			||||||
   };
 | 
					   };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   for(unsigned int i=0; i<sizeof(tls_protocols)/sizeof(struct tls_protocol); i++){
 | 
					   for(unsigned int i=0; i<sizeof(tls_protocols)/sizeof(struct tls_protocol); i++){
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -171,10 +171,14 @@ int init_ssl(struct smtp_session *session){
 | 
				
			|||||||
      return 0;
 | 
					      return 0;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if OPENSSL_VERSION_NUMBER < 0x10100000L
 | 
				
			||||||
 | 
					   SSL_CTX_set_options(session->net.ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1|SSL_OP_NO_TLSv1_1);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
   if(SSL_CTX_set_min_proto_version(session->net.ctx, session->cfg->tls_min_version_number) == 0){
 | 
					   if(SSL_CTX_set_min_proto_version(session->net.ctx, session->cfg->tls_min_version_number) == 0){
 | 
				
			||||||
      syslog(LOG_PRIORITY, "failed SSL_CTX_set_min_proto_version() to %s/%d", session->cfg->tls_min_version, session->cfg->tls_min_version_number);
 | 
					      syslog(LOG_PRIORITY, "failed SSL_CTX_set_min_proto_version() to %s/%d", session->cfg->tls_min_version, session->cfg->tls_min_version_number);
 | 
				
			||||||
      return 0;
 | 
					      return 0;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if(SSL_CTX_set_cipher_list(session->net.ctx, session->cfg->cipher_list) == 0){
 | 
					   if(SSL_CTX_set_cipher_list(session->net.ctx, session->cfg->cipher_list) == 0){
 | 
				
			||||||
      syslog(LOG_PRIORITY, "failed to set cipher list: '%s'", session->cfg->cipher_list);
 | 
					      syslog(LOG_PRIORITY, "failed to set cipher list: '%s'", session->cfg->cipher_list);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user