Skip to content

Commit e7ad7f0

Browse files
committed
Bug #16861371 SSL_OP_NO_COMPRESSION NOT DEFINED
Description: Can't build mysql-5.5 latest source with openssl 0.9.8e. Analysis: Older OpenSSL versions(prior to openssl 1.0) doesn't have 'SSL_OP_NO_COMPRESSION' defined. Hence the build is failing with SSL_OP_NO_COMPRESSION undeclared. Fix: Added a conditonal compilation for 'SSL_OP_NO_COMPRESSION'. i.e if 'SSL_OP_NO_COMPRESSION' is defined then have the SSL_set_options call for OpenSSL 1.0 versions. Have sk_SSL_COMP_zero() call for OpenSSL 0.9.8 version
1 parent 30c1489 commit e7ad7f0

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

vio/viossl.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -171,8 +171,27 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
171171
SSL_clear(ssl);
172172
SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout);
173173
SSL_set_fd(ssl, vio->sd);
174-
#ifndef HAVE_YASSL
175-
SSL_set_options(ssl, SSL_OP_NO_COMPRESSION);
174+
#if !defined(HAVE_YASSL) && defined(SSL_OP_NO_COMPRESSION)
175+
SSL_set_options(ssl, SSL_OP_NO_COMPRESSION); /* OpenSSL >= 1.0 only */
176+
#elif OPENSSL_VERSION_NUMBER >= 0x00908000L /* workaround for OpenSSL 0.9.8 */
177+
sk_SSL_COMP_zero(SSL_COMP_get_compression_methods());
178+
#endif
179+
180+
#if !defined(HAVE_YASSL) && !defined(DBUG_OFF)
181+
{
182+
STACK_OF(SSL_COMP) *ssl_comp_methods = NULL;
183+
ssl_comp_methods = SSL_COMP_get_compression_methods();
184+
DBUG_PRINT("info", ("Available compression methods:\n"));
185+
int j, n = sk_SSL_COMP_num(ssl_comp_methods);
186+
if (n == 0)
187+
fprintf(stderr, " NONE\n");
188+
else
189+
for (j = 0; j < n; j++)
190+
{
191+
SSL_COMP *c = sk_SSL_COMP_value(ssl_comp_methods, j);
192+
DBUG_PRINT("info", (" %d: %s\n", c->id, c->name));
193+
}
194+
}
176195
#endif
177196

178197
if ((r= connect_accept_func(ssl)) < 1)

0 commit comments

Comments
 (0)