agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix postmaster crash on whitespace-only oauth_validator_librarie
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix postmaster crash on whitespace-only oauth_validator_librarie
@ 2026-09-17 12:54 Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Daniel Gustafsson @ 2026-09-17 12:54 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix postmaster crash on whitespace-only oauth_validator_libraries

The check_oauth_validator check for an empty validator list didn't test
for a string with only whitespace, which would cause the postmaster to
crash.  Instead of testing for the empty string cases, pass the config
value to SplitDirectoriesString unconditionally.  If an empty list is
returned then the input string was empty.  Since pstrdup cannot handle
NULL, assert that the string ie set.  While users cannot set the string
to NULL, it is initialized to NULL so guard against programmer error.

Check the parsed list instead.  Assert that the GUC string is non-NULL
before pstrdup(); users cannot set it to NULL, but the C variable is
initialized that way.

This also adds a TAP test that reloads a whitespace-only setting after
pg_hba_file_rules and waits until the existing backend sees the restored
GUC.

Author: Grigorev Jurij <ju.grigorev@ftdata.ru>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/04fa84f6ebbe400f940e179ebe1070e9@localhost.localdomain
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bca67e5a33b07180c2f1703faf4443f2a1b92134

Modified Files
--------------
src/backend/libpq/auth-oauth.c                   | 27 ++++++++++++------------
src/test/modules/oauth_validator/t/001_server.pl | 18 ++++++++++++++++
2 files changed, 32 insertions(+), 13 deletions(-)



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

* pgsql: Fix postmaster crash on whitespace-only oauth_validator_librarie
@ 2026-09-17 12:55 Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Daniel Gustafsson @ 2026-09-17 12:55 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix postmaster crash on whitespace-only oauth_validator_libraries

The check_oauth_validator check for an empty validator list didn't test
for a string with only whitespace, which would cause the postmaster to
crash.  Instead of testing for the empty string cases, pass the config
value to SplitDirectoriesString unconditionally.  If an empty list is
returned then the input string was empty.  Since pstrdup cannot handle
NULL, assert that the string ie set.  While users cannot set the string
to NULL, it is initialized to NULL so guard against programmer error.

Check the parsed list instead.  Assert that the GUC string is non-NULL
before pstrdup(); users cannot set it to NULL, but the C variable is
initialized that way.

This also adds a TAP test that reloads a whitespace-only setting after
pg_hba_file_rules and waits until the existing backend sees the restored
GUC.

Author: Grigorev Jurij <ju.grigorev@ftdata.ru>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/04fa84f6ebbe400f940e179ebe1070e9@localhost.localdomain
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1d094904bc76b57fa1fd634b9c49bbb5ab76ece7

Modified Files
--------------
src/backend/libpq/auth-oauth.c                   | 27 ++++++++++++------------
src/test/modules/oauth_validator/t/001_server.pl | 18 ++++++++++++++++
2 files changed, 32 insertions(+), 13 deletions(-)



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

* pgsql: Fix postmaster crash on whitespace-only oauth_validator_librarie
@ 2026-09-17 12:55 Daniel Gustafsson <dgustafsson@postgresql.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Daniel Gustafsson @ 2026-09-17 12:55 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix postmaster crash on whitespace-only oauth_validator_libraries

The check_oauth_validator check for an empty validator list didn't test
for a string with only whitespace, which would cause the postmaster to
crash.  Instead of testing for the empty string cases, pass the config
value to SplitDirectoriesString unconditionally.  If an empty list is
returned then the input string was empty.  Since pstrdup cannot handle
NULL, assert that the string ie set.  While users cannot set the string
to NULL, it is initialized to NULL so guard against programmer error.

Check the parsed list instead.  Assert that the GUC string is non-NULL
before pstrdup(); users cannot set it to NULL, but the C variable is
initialized that way.

This also adds a TAP test that reloads a whitespace-only setting after
pg_hba_file_rules and waits until the existing backend sees the restored
GUC.

Author: Grigorev Jurij <ju.grigorev@ftdata.ru>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/04fa84f6ebbe400f940e179ebe1070e9@localhost.localdomain
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/99c3f5e2037bc1192004f3893fd0decd97a7f165

Modified Files
--------------
src/backend/libpq/auth-oauth.c                   | 27 ++++++++++++------------
src/test/modules/oauth_validator/t/001_server.pl | 18 ++++++++++++++++
2 files changed, 32 insertions(+), 13 deletions(-)



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


end of thread, other threads:[~2026-09-17 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 12:54 pgsql: Fix postmaster crash on whitespace-only oauth_validator_librarie Daniel Gustafsson <dgustafsson@postgresql.org>
2026-09-17 12:55 pgsql: Fix postmaster crash on whitespace-only oauth_validator_librarie Daniel Gustafsson <dgustafsson@postgresql.org>
2026-09-17 12:55 pgsql: Fix postmaster crash on whitespace-only oauth_validator_librarie Daniel Gustafsson <dgustafsson@postgresql.org>

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