Skip to content

Commit 45bf879

Browse files
authored
Remove HAVE_OPENSSL (#292)
Assume ssl is always available.
1 parent 01f8209 commit 45bf879

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

_mysql.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ extern PyTypeObject _mysql_ResultObject_Type;
9494
static int _mysql_server_init_done = 0;
9595
#define check_server_init(x) if (!_mysql_server_init_done) { if (mysql_server_init(0, NULL, NULL)) { _mysql_Exception(NULL); return x; } else { _mysql_server_init_done = 1;} }
9696

97-
#if MYSQL_VERSION_ID >= 50500
98-
#define HAVE_OPENSSL 1
99-
#endif
100-
10197
/* According to https://dev.mysql.com/doc/refman/5.1/en/mysql-options.html
10298
The MYSQL_OPT_READ_TIMEOUT appear in the version 5.1.12 */
10399
#if MYSQL_VERSION_ID > 50112
@@ -502,12 +498,10 @@ _mysql_ConnectionObject_Initialize(
502498
MYSQL *conn = NULL;
503499
PyObject *conv = NULL;
504500
PyObject *ssl = NULL;
505-
#if HAVE_OPENSSL
506501
char *key = NULL, *cert = NULL, *ca = NULL,
507502
*capath = NULL, *cipher = NULL;
508503
PyObject *ssl_keepref[5] = {NULL};
509504
int n_ssl_keepref = 0;
510-
#endif
511505
char *host = NULL, *user = NULL, *passwd = NULL,
512506
*db = NULL, *unix_socket = NULL;
513507
unsigned int port = 0;
@@ -571,18 +565,12 @@ _mysql_ConnectionObject_Initialize(
571565
#endif
572566

573567
if (ssl) {
574-
#if HAVE_OPENSSL
575568
PyObject *value = NULL;
576569
_stringsuck(ca, value, ssl);
577570
_stringsuck(capath, value, ssl);
578571
_stringsuck(cert, value, ssl);
579572
_stringsuck(key, value, ssl);
580573
_stringsuck(cipher, value, ssl);
581-
#else
582-
PyErr_SetString(_mysql_NotSupportedError,
583-
"client library does not have SSL support");
584-
return -1;
585-
#endif
586574
}
587575

588576
Py_BEGIN_ALLOW_THREADS ;
@@ -620,26 +608,22 @@ _mysql_ConnectionObject_Initialize(
620608
if (local_infile != -1)
621609
mysql_options(&(self->connection), MYSQL_OPT_LOCAL_INFILE, (char *) &local_infile);
622610

623-
#if HAVE_OPENSSL
624611
if (ssl) {
625612
mysql_ssl_set(&(self->connection), key, cert, ca, capath, cipher);
626613
}
627-
#endif
628614

629615
conn = mysql_real_connect(&(self->connection), host, user, passwd, db,
630616
port, unix_socket, client_flag);
631617

632618
Py_END_ALLOW_THREADS ;
633619

634-
#if HAVE_OPENSSL
635620
if (ssl) {
636621
int i;
637622
for (i=0; i<n_ssl_keepref; i++) {
638623
Py_DECREF(ssl_keepref[i]);
639624
ssl_keepref[i] = NULL;
640625
}
641626
}
642-
#endif
643627

644628
if (!conn) {
645629
_mysql_Exception(self);

0 commit comments

Comments
 (0)