spine
spine copied to clipboard
spine 1.2.22 does not compile with SQL TLS deactivated
Describe the bug
Spine compilation runs into an error when being compiled without HAS_MYSQL_OPT_SSL_KEY
The "#ifdef HAS_MYSQL_OPT_SSL_KEY" is applied to the initializations for ssl_key, ssl_ca and ssl_cert, but not to the "free()" calls starting in line 353
So if the macro is not defined for what ever reasons, compilation fails logically.
sql.c: In function "db_connect": sql.c:353:6: error: "ssl_key" undeclared (first use in this function) if (ssl_key != NULL) { ^ sql.c:353:6: note: each undeclared identifier is reported only once for each function it appears in sql.c:357:6: error: âssl_caâ undeclared (first use in this function) if (ssl_ca != NULL) { ^ sql.c:361:6: error: "ssl_cert" undeclared (first use in this function) if (ssl_cert != NULL) { ^ make: *** [sql.o] Error 1
Fix:
#ifdef HAS_MYSQL_OPT_SSL_KEY
if (ssl_key != NULL) {
free(ssl_key);
}
if (ssl_ca != NULL) {
free(ssl_ca);
}
if (ssl_cert != NULL) {
free(ssl_cert);
}
#endif
I've came along the same issue on Ubuntu 14 today. Thanks for opening the issue.
I was able to reproduce the issue and fix on 2 systems.
I've created a pull request #280 for the fix.
cool, thanks for creating the pull! Seems it is already merged as well. (I need automation on the 2FA renewal with github ...)