Skip to content

Remove HAVE_OPENSSL #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions _mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ extern PyTypeObject _mysql_ResultObject_Type;
static int _mysql_server_init_done = 0;
#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;} }

#if MYSQL_VERSION_ID >= 50500
#define HAVE_OPENSSL 1
#endif

/* According to https://dev.mysql.com/doc/refman/5.1/en/mysql-options.html
The MYSQL_OPT_READ_TIMEOUT appear in the version 5.1.12 */
#if MYSQL_VERSION_ID > 50112
Expand Down Expand Up @@ -502,12 +498,10 @@ _mysql_ConnectionObject_Initialize(
MYSQL *conn = NULL;
PyObject *conv = NULL;
PyObject *ssl = NULL;
#if HAVE_OPENSSL
char *key = NULL, *cert = NULL, *ca = NULL,
*capath = NULL, *cipher = NULL;
PyObject *ssl_keepref[5] = {NULL};
int n_ssl_keepref = 0;
#endif
char *host = NULL, *user = NULL, *passwd = NULL,
*db = NULL, *unix_socket = NULL;
unsigned int port = 0;
Expand Down Expand Up @@ -571,18 +565,12 @@ _mysql_ConnectionObject_Initialize(
#endif

if (ssl) {
#if HAVE_OPENSSL
PyObject *value = NULL;
_stringsuck(ca, value, ssl);
_stringsuck(capath, value, ssl);
_stringsuck(cert, value, ssl);
_stringsuck(key, value, ssl);
_stringsuck(cipher, value, ssl);
#else
PyErr_SetString(_mysql_NotSupportedError,
"client library does not have SSL support");
return -1;
#endif
}

Py_BEGIN_ALLOW_THREADS ;
Expand Down Expand Up @@ -620,26 +608,22 @@ _mysql_ConnectionObject_Initialize(
if (local_infile != -1)
mysql_options(&(self->connection), MYSQL_OPT_LOCAL_INFILE, (char *) &local_infile);

#if HAVE_OPENSSL
if (ssl) {
mysql_ssl_set(&(self->connection), key, cert, ca, capath, cipher);
}
#endif

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

Py_END_ALLOW_THREADS ;

#if HAVE_OPENSSL
if (ssl) {
int i;
for (i=0; i<n_ssl_keepref; i++) {
Py_DECREF(ssl_keepref[i]);
ssl_keepref[i] = NULL;
}
}
#endif

if (!conn) {
_mysql_Exception(self);
Expand Down