pgpool2.git / summary / log / commit / refs
commit fcb64ebef80c381cc9357212fd4690777669cb35
Author: Bo Peng <pengbo@sraoss.co.jp>
Date: Wed Sep 04 08:04:01 2019 +0000
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 @@
<listitem>
<para>
<!--
- Specify the password file name for authentication.
- Default value is <literal>"pool_passwd"</literal>.
+ Specify the path (absolute or relative) to password file for
+ authentication. Default value is <literal>"pool_passwd"</literal>.
+ A relative path will be interpreted with respect to the directory
+ where configuration file is placed.
Specifying <literal>''</literal> (empty) disables the use
of password file.
-->
- 認証に用いるパスワードファイルのファイル名を指定します。
- デフォルト値は<literal>"pool_passwd"</literal>です。
+ 認証用のパスワードファイルへのパス(絶対パスまたは相対パス)を指定します。
+ デフォルト値は<literal>"pool_passwd"</literal>です。
+ 相対パスは、設定ファイルが置かれているディレクトリを基準としています。
<literal>''</literal>(空文字列)を指定すると パスワードファイルの使用は無効になります。
</para>
<para>
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 @@
</term>
<listitem>
<para>
- Specify the password file name for authentication.
- Default value is <literal>"pool_passwd"</literal>.
+ Specify the path (absolute or relative) to password file for
+ authentication. Default value is <literal>"pool_passwd"</literal>.
+ A relative path will be interpreted with respect to the directory
+ where configuration file is placed.
Specifying <literal>''</literal> (empty) disables the use
of password file.
</para>
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);
}
[parent: 7437d3155c37]