diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2014-05-18 11:25:40 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2014-05-18 11:25:40 +0300 |
commit | bc0eeb7706bf5ba3d89f7f5e3563827c3981cc70 (patch) | |
tree | 5ba01fa967b924d32d8520f041f5f73b7d2cd6bc /src | |
parent | 9087acb001afd6fefa0fe4f2e4fbdcb3ae524e02 (diff) | |
download | anubis-bc0eeb7706bf5ba3d89f7f5e3563827c3981cc70.tar.gz anubis-bc0eeb7706bf5ba3d89f7f5e3563827c3981cc70.tar.bz2 |
Support for MySQL options file.
* NEWS: Document the use of MySQL options file.
* doc/anubis.texi: Document all anubisusr options.
Describe the use of MySQL options file.
* src/mysql.c (mysql_db_open): Use MySQL options file.
Two new URL parameters: options-file and options-group.
* src/usr.opt: New option --tls-priorities.
Diffstat (limited to 'src')
-rw-r--r-- | src/mysql.c | 23 | ||||
-rw-r--r-- | src/usr.opt | 7 |
2 files changed, 26 insertions, 4 deletions
diff --git a/src/mysql.c b/src/mysql.c index 676618a..81ea62c 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -123,8 +123,8 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode, const char *passwd = anubis_url_get_arg (url, "passwd"); const char *user = anubis_url_get_arg (url, "account"); const char *rcfile = anubis_url_get_arg (url, "rcfile"); - const char *portstr = anubis_url_get_arg (url, "port"); - const char *s = anubis_url_get_arg (url, "bufsize"); + const char *s; + char *optfile; int port = 0; size_t bufsize = 1024; struct mysql_db_data *mdata; @@ -141,6 +141,7 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode, if (!rcfile) rcfile = "rcfile"; + s = anubis_url_get_arg (url, "bufsize"); if (s) { char *p; @@ -152,10 +153,11 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode, } } - if (portstr) + s = anubis_url_get_arg (url, "port"); + if (s) { char *p; - port = strtoul (portstr, &p, 10); + port = strtoul (s, &p, 10); if (*p) { *errp = sql_open_error_text (ERR_BADPORT); @@ -169,6 +171,19 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode, mdata = xmalloc (sizeof (*mdata)); amp->data = mdata; mysql_init (&mdata->mysql); + + s = anubis_url_get_arg (url, "options-file"); + if (!s) { + if (access ("/etc/my.cnf", F_OK) == 0) + s = "/etc/my.cnf"; + } + + if (s && *s) { + mysql_options (&mdata->mysql, MYSQL_READ_DEFAULT_FILE, s); + mysql_options(&mdata->mysql, MYSQL_READ_DEFAULT_GROUP, + s ? s : "anubis"); + } + if (!mysql_real_connect (&mdata->mysql, url->host, url->user, url->passwd, url->path, port, diff --git a/src/usr.opt b/src/usr.opt index 72ab222..fa9d859 100644 --- a/src/usr.opt +++ b/src/usr.opt @@ -37,6 +37,13 @@ BEGIN #endif END +OPTION(tls-priorities,,PRIO,Set TLS priorities) +BEGIN +#ifdef HAVE_TLS + secure.prio = optarg; +#endif +END + OPTION(file,f,FILE, Set user configuration file name.) BEGIN |