Allow to specify absolute path in "pool_passwd".
authorBo Peng <pengbo@sraoss.co.jp>
Wed, 4 Sep 2019 08:04:01 +0000 (17:04 +0900)
committerBo Peng <pengbo@sraoss.co.jp>
Wed, 4 Sep 2019 08:04:01 +0000 (17:04 +0900)
Patch is provided by Danylo Hlynskyi.

doc.ja/src/sgml/connection-settings.sgml
doc/src/sgml/connection-settings.sgml
src/main/main.c

index 1600dd95d681a439556b865cf69fb5b951db1c68..2e5f5835ebc01d4e491743bb6dd7c50a97b4d064 100644 (file)
     <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>
index ba84e75bdce3541f7b7b9e927a18495e41a07c4d..2fe5051f744c90394d94682ec92d3b76a23954e8 100644 (file)
     </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>
index eec3c3e4868e4772d675d59fb8b54b8297988e4d..9b55f3d4dde7d6f1943622101b132054af62afe0 100644 (file)
@@ -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);
        }