public inbox for [email protected]  
help / color / mirror / Atom feed
Separators in pg_hosts.conf fields
4+ messages / 2 participants
[nested] [flat]

* Separators in pg_hosts.conf fields
@ 2026-04-26 21:32 Noah Misch <[email protected]>
  2026-04-26 21:40 ` Re: Separators in pg_hosts.conf fields Daniel Gustafsson <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Noah Misch @ 2026-04-26 21:32 UTC (permalink / raw)
  To: [email protected]; +Cc: pgsql-hackers

If the build directory name contains a comma,
src/test/modules/ssl_passphrase_callback fails on master since commit 4f43302.
It fails because hba.c:next_token() treats a comma as a token separator:

 * Tokens can be delimited by double quotes (this allows the inclusion of
 * commas, blanks, and '#', but not newlines).  As in SQL, write two
 * double-quotes to represent a double quote.

Commit 4f43302 documented the pg_hosts.conf hostname field as a
comma-separated list, but not the other fields.  Should other pg_hosts.conf
fields continue to require quoting around commas, or not?

commit 4649408 (HEAD, master)
Author:     Noah Misch <[email protected]>
AuthorDate: Sun Apr 26 13:56:22 2026 -0700
Commit:     Noah Misch <[email protected]>
CommitDate: Sun Apr 26 14:26:08 2026 -0700

    Fix new test under comma in build directory.
    
    Quote pg_hosts.conf fields derived from the build directory, since
    hba.c:next_token() treats a comma as a token separator.  Commit
    4f433025f666fa4a6209f0e847715767fb1c7ace introduced pg_hosts.conf and
    this test.  A build directory name containing a comma worked before that
    commit.  A build directory name containing a quote character has not
    worked, so don't handle that.
---
 src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
index 09ff536..d8b07d4 100644
--- a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
+++ b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
@@ -90,8 +90,8 @@ ssl_sni = on
 });
 	$node->append_conf(
 		'pg_hosts.conf', qq{
-example.org $ddir/server.crt $ddir/server.key "" "echo FooBaR1" on
-example.com $ddir/server.crt $ddir/server.key "" "echo FooBaR1" on
+example.org "$ddir/server.crt" "$ddir/server.key" "" "echo FooBaR1" on
+example.com "$ddir/server.crt" "$ddir/server.key" "" "echo FooBaR1" on
 });
 
 	# If the servers starts and runs, the bad ssl_passphrase.passphrase was


Attachments:

  [text/plain] comma-test-sni-v1.patch (1.5K, 2-comma-test-sni-v1.patch)
  download | inline diff:
commit 4649408 (HEAD, master)
Author:     Noah Misch <[email protected]>
AuthorDate: Sun Apr 26 13:56:22 2026 -0700
Commit:     Noah Misch <[email protected]>
CommitDate: Sun Apr 26 14:26:08 2026 -0700

    Fix new test under comma in build directory.
    
    Quote pg_hosts.conf fields derived from the build directory, since
    hba.c:next_token() treats a comma as a token separator.  Commit
    4f433025f666fa4a6209f0e847715767fb1c7ace introduced pg_hosts.conf and
    this test.  A build directory name containing a comma worked before that
    commit.  A build directory name containing a quote character has not
    worked, so don't handle that.
---
 src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
index 09ff536..d8b07d4 100644
--- a/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
+++ b/src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
@@ -90,8 +90,8 @@ ssl_sni = on
 });
 	$node->append_conf(
 		'pg_hosts.conf', qq{
-example.org $ddir/server.crt $ddir/server.key "" "echo FooBaR1" on
-example.com $ddir/server.crt $ddir/server.key "" "echo FooBaR1" on
+example.org "$ddir/server.crt" "$ddir/server.key" "" "echo FooBaR1" on
+example.com "$ddir/server.crt" "$ddir/server.key" "" "echo FooBaR1" on
 });
 
 	# If the servers starts and runs, the bad ssl_passphrase.passphrase was


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Separators in pg_hosts.conf fields
  2026-04-26 21:32 Separators in pg_hosts.conf fields Noah Misch <[email protected]>
@ 2026-04-26 21:40 ` Daniel Gustafsson <[email protected]>
  2026-04-26 21:54   ` Re: Separators in pg_hosts.conf fields Noah Misch <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Daniel Gustafsson @ 2026-04-26 21:40 UTC (permalink / raw)
  To: Noah Misch <[email protected]>; +Cc: pgsql-hackers

> On 26 Apr 2026, at 23:32, Noah Misch <[email protected]> wrote:
> 
> If the build directory name contains a comma,
> src/test/modules/ssl_passphrase_callback fails on master since commit 4f43302.
> It fails because hba.c:next_token() treats a comma as a token separator:

Ugh, thanks for reporting.

> * Tokens can be delimited by double quotes (this allows the inclusion of
> * commas, blanks, and '#', but not newlines).  As in SQL, write two
> * double-quotes to represent a double quote.
> 
> Commit 4f43302 documented the pg_hosts.conf hostname field as a
> comma-separated list, but not the other fields.  Should other pg_hosts.conf
> fields continue to require quoting around commas, or not?

Yes, only the hostname field is a comma-separated list.  I think this should be
added to the documentation as well on top of the test fix in your patch.  Do
you want me to take care of both parts?

--
Daniel Gustafsson






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Separators in pg_hosts.conf fields
  2026-04-26 21:32 Separators in pg_hosts.conf fields Noah Misch <[email protected]>
  2026-04-26 21:40 ` Re: Separators in pg_hosts.conf fields Daniel Gustafsson <[email protected]>
@ 2026-04-26 21:54   ` Noah Misch <[email protected]>
  2026-04-26 22:01     ` Re: Separators in pg_hosts.conf fields Daniel Gustafsson <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Noah Misch @ 2026-04-26 21:54 UTC (permalink / raw)
  To: Daniel Gustafsson <[email protected]>; +Cc: pgsql-hackers

On Sun, Apr 26, 2026 at 11:40:13PM +0200, Daniel Gustafsson wrote:
> > On 26 Apr 2026, at 23:32, Noah Misch <[email protected]> wrote:
> > 
> > If the build directory name contains a comma,
> > src/test/modules/ssl_passphrase_callback fails on master since commit 4f43302.
> > It fails because hba.c:next_token() treats a comma as a token separator:
> 
> Ugh, thanks for reporting.
> 
> > * Tokens can be delimited by double quotes (this allows the inclusion of
> > * commas, blanks, and '#', but not newlines).  As in SQL, write two
> > * double-quotes to represent a double quote.
> > 
> > Commit 4f43302 documented the pg_hosts.conf hostname field as a
> > comma-separated list, but not the other fields.  Should other pg_hosts.conf
> > fields continue to require quoting around commas, or not?
> 
> Yes, only the hostname field is a comma-separated list.  I think this should be
> added to the documentation as well on top of the test fix in your patch.

Do you anticipate docs like "this isn't a list, but the file's general parsing
rules require quotes if there's a comma"?  Or something different?

> Do
> you want me to take care of both parts?

That's fine.  I also don't mind pushing what I sent.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Separators in pg_hosts.conf fields
  2026-04-26 21:32 Separators in pg_hosts.conf fields Noah Misch <[email protected]>
  2026-04-26 21:40 ` Re: Separators in pg_hosts.conf fields Daniel Gustafsson <[email protected]>
  2026-04-26 21:54   ` Re: Separators in pg_hosts.conf fields Noah Misch <[email protected]>
@ 2026-04-26 22:01     ` Daniel Gustafsson <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Daniel Gustafsson @ 2026-04-26 22:01 UTC (permalink / raw)
  To: Noah Misch <[email protected]>; +Cc: pgsql-hackers

> On 26 Apr 2026, at 23:54, Noah Misch <[email protected]> wrote:
> On Sun, Apr 26, 2026 at 11:40:13PM +0200, Daniel Gustafsson wrote:

>> Yes, only the hostname field is a comma-separated list.  I think this should be
>> added to the documentation as well on top of the test fix in your patch.
> 
> Do you anticipate docs like "this isn't a list, but the file's general parsing
> rules require quotes if there's a comma"?  Or something different?

Something along those lines yes.

>> Do you want me to take care of both parts?
> 
> That's fine.  I also don't mind pushing what I sent.

+1, please do.

--
Daniel Gustafsson






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-04-26 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-26 21:32 Separators in pg_hosts.conf fields Noah Misch <[email protected]>
2026-04-26 21:40 ` Daniel Gustafsson <[email protected]>
2026-04-26 21:54   ` Noah Misch <[email protected]>
2026-04-26 22:01     ` Daniel Gustafsson <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox