@@ -94,10 +94,6 @@ extern PyTypeObject _mysql_ResultObject_Type;
94
94
static int _mysql_server_init_done = 0 ;
95
95
#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;} }
96
96
97
- #if MYSQL_VERSION_ID >= 50500
98
- #define HAVE_OPENSSL 1
99
- #endif
100
-
101
97
/* According to https://dev.mysql.com/doc/refman/5.1/en/mysql-options.html
102
98
The MYSQL_OPT_READ_TIMEOUT appear in the version 5.1.12 */
103
99
#if MYSQL_VERSION_ID > 50112
@@ -502,12 +498,10 @@ _mysql_ConnectionObject_Initialize(
502
498
MYSQL * conn = NULL ;
503
499
PyObject * conv = NULL ;
504
500
PyObject * ssl = NULL ;
505
- #if HAVE_OPENSSL
506
501
char * key = NULL , * cert = NULL , * ca = NULL ,
507
502
* capath = NULL , * cipher = NULL ;
508
503
PyObject * ssl_keepref [5 ] = {NULL };
509
504
int n_ssl_keepref = 0 ;
510
- #endif
511
505
char * host = NULL , * user = NULL , * passwd = NULL ,
512
506
* db = NULL , * unix_socket = NULL ;
513
507
unsigned int port = 0 ;
@@ -571,18 +565,12 @@ _mysql_ConnectionObject_Initialize(
571
565
#endif
572
566
573
567
if (ssl ) {
574
- #if HAVE_OPENSSL
575
568
PyObject * value = NULL ;
576
569
_stringsuck (ca , value , ssl );
577
570
_stringsuck (capath , value , ssl );
578
571
_stringsuck (cert , value , ssl );
579
572
_stringsuck (key , value , ssl );
580
573
_stringsuck (cipher , value , ssl );
581
- #else
582
- PyErr_SetString (_mysql_NotSupportedError ,
583
- "client library does not have SSL support" );
584
- return -1 ;
585
- #endif
586
574
}
587
575
588
576
Py_BEGIN_ALLOW_THREADS ;
@@ -620,26 +608,22 @@ _mysql_ConnectionObject_Initialize(
620
608
if (local_infile != -1 )
621
609
mysql_options (& (self -> connection ), MYSQL_OPT_LOCAL_INFILE , (char * ) & local_infile );
622
610
623
- #if HAVE_OPENSSL
624
611
if (ssl ) {
625
612
mysql_ssl_set (& (self -> connection ), key , cert , ca , capath , cipher );
626
613
}
627
- #endif
628
614
629
615
conn = mysql_real_connect (& (self -> connection ), host , user , passwd , db ,
630
616
port , unix_socket , client_flag );
631
617
632
618
Py_END_ALLOW_THREADS ;
633
619
634
- #if HAVE_OPENSSL
635
620
if (ssl ) {
636
621
int i ;
637
622
for (i = 0 ; i < n_ssl_keepref ; i ++ ) {
638
623
Py_DECREF (ssl_keepref [i ]);
639
624
ssl_keepref [i ] = NULL ;
640
625
}
641
626
}
642
- #endif
643
627
644
628
if (!conn ) {
645
629
_mysql_Exception (self );
0 commit comments