From fcb64ebef80c381cc9357212fd4690777669cb35 Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Wed, 4 Sep 2019 17:04:01 +0900 Subject: [PATCH] Allow to specify absolute path in "pool_passwd". Patch is provided by Danylo Hlynskyi. --- doc.ja/src/sgml/connection-settings.sgml | 11 +++++++---- doc/src/sgml/connection-settings.sgml | 6 ++++-- src/main/main.c | 15 +++++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/doc.ja/src/sgml/connection-settings.sgml b/doc.ja/src/sgml/connection-settings.sgml index 1600dd95d..2e5f5835e 100644 --- a/doc.ja/src/sgml/connection-settings.sgml +++ b/doc.ja/src/sgml/connection-settings.sgml @@ -449,13 +449,16 @@ - 認証に用いるパスワードファイルのファイル名を指定します。 - デフォルト値は"pool_passwd"です。 + 認証用のパスワードファイルへのパス(絶対パスまたは相対パス)を指定します。 + デフォルト値は"pool_passwd"です。 + 相対パスは、設定ファイルが置かれているディレクトリを基準としています。 ''(空文字列)を指定すると パスワードファイルの使用は無効になります。 diff --git a/doc/src/sgml/connection-settings.sgml b/doc/src/sgml/connection-settings.sgml index ba84e75bd..2fe5051f7 100644 --- a/doc/src/sgml/connection-settings.sgml +++ b/doc/src/sgml/connection-settings.sgml @@ -290,8 +290,10 @@ - Specify the password file name for authentication. - Default value is "pool_passwd". + Specify the path (absolute or relative) to password file for + authentication. Default value is "pool_passwd". + A relative path will be interpreted with respect to the directory + where configuration file is placed. Specifying '' (empty) disables the use of password file. diff --git a/src/main/main.c b/src/main/main.c index eec3c3e48..9b55f3d4d 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -337,10 +337,17 @@ main(int argc, char **argv) char dirnamebuf[POOLMAXPATHLEN + 1]; char *dirp; - strlcpy(dirnamebuf, conf_file, sizeof(dirnamebuf)); - dirp = dirname(dirnamebuf); - snprintf(pool_passwd, sizeof(pool_passwd), "%s/%s", - dirp, pool_config->pool_passwd); + if (pool_config->pool_passwd[0] != '/') + { + strlcpy(dirnamebuf, conf_file, sizeof(dirnamebuf)); + dirp = dirname(dirnamebuf); + snprintf(pool_passwd, sizeof(pool_passwd), "%s/%s", + dirp, pool_config->pool_passwd); + } + else + strlcpy(pool_passwd, pool_config->pool_passwd, + sizeof(pool_passwd)); + pool_init_pool_passwd(pool_passwd, POOL_PASSWD_R); } -- 2.39.5