spine icon indicating copy to clipboard operation
spine copied to clipboard

spine 1.2.22 does not compile with SQL TLS deactivated

Open bernisys opened this issue 2 years ago • 2 comments

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

bernisys avatar Sep 01 '22 14:09 bernisys

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.

thurban avatar Sep 01 '22 17:09 thurban

cool, thanks for creating the pull! Seems it is already merged as well. (I need automation on the 2FA renewal with github ...)

bernisys avatar Sep 08 '22 14:09 bernisys