diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-02 20:58:39 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-12-02 20:58:39 +0200 |
commit | 565650272f219fd372347f0ff3375b09caa18952 (patch) | |
tree | 9e9c96e4fb72332df0e1dd8fef9c51905b0793aa | |
parent | 3164dc277082c023337d32ecf21da62d991399af (diff) | |
download | wydawca-565650272f219fd372347f0ff3375b09caa18952.tar.gz wydawca-565650272f219fd372347f0ff3375b09caa18952.tar.bz2 |
Initial implementation of mysql over SSL.
* src/config.c (sql_kw): New keyword `ssl-ca'.
* src/sql.c (sql_init_method): Initialize SSL, if
required.
* src/sql.h (struct sqlconn): New member `cacert'.
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/sql.c | 3 | ||||
-rw-r--r-- | src/sql.h | 1 |
3 files changed, 6 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index 6c351d9..c877c26 100644 --- a/src/config.c +++ b/src/config.c @@ -632,6 +632,8 @@ static struct grecs_keyword sql_kw[] = { grecs_type_string, NULL, offsetof(struct sqlconn, user) }, { "password", N_("arg"), N_("Set SQL user password"), grecs_type_string, NULL, offsetof(struct sqlconn, password) }, + { "ssl-ca", N_("file"), N_("File name of the Certificate Authority (CA) certificate"), + grecs_type_string, NULL, offsetof(struct sqlconn, cacert) }, { NULL } }; @@ -70,6 +70,9 @@ sql_init_method (struct access_method *method) if (conn->initcount++ == 0) { mysql_init (&conn->mysql); + if (conn->cacert) + mysql_ssl_set (&conn->mysql, NULL, NULL, conn->cacert, + NULL, NULL); if (!mysql_real_connect (&conn->mysql, conn->host, conn->user, conn->password, conn->database, conn->port, conn->socket, 0)) @@ -25,6 +25,7 @@ struct sqlconn char *database; char *user; char *password; + char *cacert; size_t initcount; /* Number of initializations */ MYSQL mysql; MYSQL_RES *result; |