| 38 |
#endif |
#endif |
| 39 |
char sql[SQL_BUFFER_LEN]; |
char sql[SQL_BUFFER_LEN]; |
| 40 |
int fd; |
int fd; |
| 41 |
|
int have_ca_cert = 0; |
| 42 |
|
|
| 43 |
db = mysql_init(NULL); |
db = mysql_init(NULL); |
| 44 |
if (db == NULL) |
if (db == NULL) |
| 58 |
else |
else |
| 59 |
{ |
{ |
| 60 |
close(fd); |
close(fd); |
| 61 |
|
have_ca_cert = 1; |
| 62 |
#ifndef HAVE_MARIADB_CLIENT |
#ifndef HAVE_MARIADB_CLIENT |
| 63 |
ssl_mode = SSL_MODE_VERIFY_CA; |
ssl_mode = SSL_MODE_VERIFY_CA; |
| 64 |
#endif |
#endif |
| 65 |
} |
} |
| 66 |
|
|
| 67 |
if (mysql_ssl_set(db, NULL, NULL, DB_ca_cert, NULL, NULL) != 0) |
if (mysql_ssl_set(db, NULL, NULL, (have_ca_cert ? DB_ca_cert : NULL), NULL, NULL) != 0) |
| 68 |
{ |
{ |
| 69 |
log_error("mysql_ssl_set() error\n"); |
log_error("mysql_ssl_set() error\n"); |
| 70 |
return NULL; |
return NULL; |