pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
8+ messages / 4 participants
[nested] [flat]

* BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-09 09:45  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 8+ messages in thread

From: PG Bug reporting form @ 2025-01-09 09:45 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: laurenz.albe@cybertec.at

The following bug has been logged on the website:

Bug reference:      18769
Logged by:          Laurenz Albe
Email address:      laurenz.albe@cybertec.at
PostgreSQL version: 17.2
Operating system:   any
Description:        

For whatever reason, the "ldapscheme" option was forgotten in the function
pg_hba_file_rules().



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

* Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-09 09:54  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 8+ messages in thread

From: Laurenz Albe @ 2025-01-09 09:54 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

On Thu, 2025-01-09 at 09:45 +0000, PG Bug reporting form wrote:
> For whatever reason, the "ldapscheme" option was forgotten in the function
> pg_hba_file_rules().

Here is a patch to fix the omission.

Yours,
Laurenz Albe

Attachments:

  [text/x-patch] v1-0001-Add-ldapscheme-to-pg_hba_file_rules.patch (1.0K, ../../513a15b5ff69d6023b57e78bbcf5a7c17180cedc.camel@cybertec.at/2-v1-0001-Add-ldapscheme-to-pg_hba_file_rules.patch)
  download | inline diff:
From b976eaf4cbbef79b43fb541b33982d9d742c7f75 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@cybertec.at>
Date: Thu, 9 Jan 2025 10:41:34 +0100
Subject: [PATCH v1] Add ldapscheme to pg_hba_file_rules

That option was forgotten in the pg_hba_file_rules() function.
This fixes bug #18769.  Backpatch all the way.

Author: Laurenz Albe
Discussion: https://postgr.es/m/18769-dd8610cbc0405172@postgresql.org
---
 src/backend/utils/adt/hbafuncs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backend/utils/adt/hbafuncs.c b/src/backend/utils/adt/hbafuncs.c
index beaae88e541..43cef2572f8 100644
--- a/src/backend/utils/adt/hbafuncs.c
+++ b/src/backend/utils/adt/hbafuncs.c
@@ -89,6 +89,10 @@ get_hba_options(HbaLine *hba)
 			options[noptions++] =
 				CStringGetTextDatum(psprintf("ldapport=%d", hba->ldapport));
 
+		if (hba->ldapscheme)
+			options[noptions++] =
+				CStringGetTextDatum(psprintf("ldapscheme=%s", hba->ldapscheme));
+
 		if (hba->ldaptls)
 			options[noptions++] =
 				CStringGetTextDatum("ldaptls=true");
-- 
2.47.1



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

* Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-09 10:00  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 8+ messages in thread

From: Laurenz Albe @ 2025-01-09 10:00 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

On Thu, 2025-01-09 at 10:54 +0100, Laurenz Albe wrote:
> On Thu, 2025-01-09 at 09:45 +0000, PG Bug reporting form wrote:
> > For whatever reason, the "ldapscheme" option was forgotten in the function
> > pg_hba_file_rules().
> 
> Here is a patch to fix the omission.

v2 of the patch has a correct "discussion" URL in the commit message;
otherwise it is unchanged.

Yours,
Laurenz Albe

Attachments:

  [text/x-patch] v2-0001-Add-ldapscheme-to-pg_hba_file_rules.patch (1.1K, ../../b9493f47474b40ab16cc533fad86b2ae1f340441.camel@cybertec.at/2-v2-0001-Add-ldapscheme-to-pg_hba_file_rules.patch)
  download | inline diff:
From b976eaf4cbbef79b43fb541b33982d9d742c7f75 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@cybertec.at>
Date: Thu, 9 Jan 2025 10:41:34 +0100
Subject: [PATCH v1] Add ldapscheme to pg_hba_file_rules

That option was forgotten in the pg_hba_file_rules() function.
This fixes bug #18769.  Backpatch all the way.

Author: Laurenz Albe
Discussion: https://postgr.es/m/513a15b5ff69d6023b57e78bbcf5a7c17180cedc.camel@cybertec.at
---
 src/backend/utils/adt/hbafuncs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backend/utils/adt/hbafuncs.c b/src/backend/utils/adt/hbafuncs.c
index beaae88e541..43cef2572f8 100644
--- a/src/backend/utils/adt/hbafuncs.c
+++ b/src/backend/utils/adt/hbafuncs.c
@@ -89,6 +89,10 @@ get_hba_options(HbaLine *hba)
 			options[noptions++] =
 				CStringGetTextDatum(psprintf("ldapport=%d", hba->ldapport));
 
+		if (hba->ldapscheme)
+			options[noptions++] =
+				CStringGetTextDatum(psprintf("ldapscheme=%s", hba->ldapscheme));
+
 		if (hba->ldaptls)
 			options[noptions++] =
 				CStringGetTextDatum("ldaptls=true");
-- 
2.47.1



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

* Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-09 12:09  Daniel Gustafsson <daniel@yesql.se>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 8+ messages in thread

From: Daniel Gustafsson @ 2025-01-09 12:09 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-bugs@lists.postgresql.org

> On 9 Jan 2025, at 11:00, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> 
> On Thu, 2025-01-09 at 10:54 +0100, Laurenz Albe wrote:
>> On Thu, 2025-01-09 at 09:45 +0000, PG Bug reporting form wrote:
>>> For whatever reason, the "ldapscheme" option was forgotten in the function
>>> pg_hba_file_rules().
>> 
>> Here is a patch to fix the omission.
> 
> v2 of the patch has a correct "discussion" URL in the commit message;
> otherwise it is unchanged.

LGTM.

--
Daniel Gustafsson






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

* Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-10 08:00  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 8+ messages in thread

From: Laurenz Albe @ 2025-01-10 08:00 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: pgsql-bugs@lists.postgresql.org

On Thu, 2025-01-09 at 13:09 +0100, Daniel Gustafsson wrote:
> > On Thu, 2025-01-09 at 10:54 +0100, Laurenz Albe wrote:
> > > On Thu, 2025-01-09 at 09:45 +0000, PG Bug reporting form wrote:
> > > > For whatever reason, the "ldapscheme" option was forgotten in the function
> > > > pg_hba_file_rules().
> > > 
> > > Here is a patch to fix the omission.
> 
> LGTM.

Do you want to commit it, or should I add it to the next commitfest?

Yours,
Laurenz Albe





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

* Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-10 08:02  Daniel Gustafsson <daniel@yesql.se>
  parent: Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 8+ messages in thread

From: Daniel Gustafsson @ 2025-01-10 08:02 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-bugs@lists.postgresql.org

> On 10 Jan 2025, at 09:00, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> 
> On Thu, 2025-01-09 at 13:09 +0100, Daniel Gustafsson wrote:
>>> On Thu, 2025-01-09 at 10:54 +0100, Laurenz Albe wrote:
>>>> On Thu, 2025-01-09 at 09:45 +0000, PG Bug reporting form wrote:
>>>>> For whatever reason, the "ldapscheme" option was forgotten in the function
>>>>> pg_hba_file_rules().
>>>> 
>>>> Here is a patch to fix the omission.
>> 
>> LGTM.
> 
> Do you want to commit it, or should I add it to the next commitfest?

I'm planning to do it today, so no need to add it. Thanks!

--
Daniel Gustafsson






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

* Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-12 15:55  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2025-01-12 15:55 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-bugs@lists.postgresql.org

Daniel Gustafsson <daniel@yesql.se> writes:
> I'm planning to do it today, so no need to add it. Thanks!

Our weekly Coverity run complained about this in all branches:

*** CID 181934:  Memory - corruptions  (OVERRUN)
/srv/coverity/git/pgsql-git/13stable/src/backend/libpq/hba.c: 2368 in gethba_options()
2362     		if (hba->ldapsearchfilter)
2363     			options[noptions++] =
2364     				CStringGetTextDatum(psprintf("ldapsearchfilter=%s",
2365     											 hba->ldapsearchfilter));
2366     
2367     		if (hba->ldapscope)
>>>     CID 181934:  Memory - corruptions  (OVERRUN)
>>>     Overrunning array "options" of 14 8-byte elements at element index 14 (byte offset 119) using index "noptions++" (which evaluates to 14).
2368     			options[noptions++] =
2369     				CStringGetTextDatum(psprintf("ldapscope=%d", hba->ldapscope));
2370     	}
2371     
2372     	if (hba->auth_method == uaRADIUS)
2373     	{

Looks like you should have increased MAX_HBA_OPTIONS.  The comment
just above that macro needs work too.

			regards, tom lane





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

* Re: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules
@ 2025-01-12 16:20  Daniel Gustafsson <daniel@yesql.se>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: Daniel Gustafsson @ 2025-01-12 16:20 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-bugs@lists.postgresql.org

> On 12 Jan 2025, at 16:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> Daniel Gustafsson <daniel@yesql.se> writes:
>> I'm planning to do it today, so no need to add it. Thanks!
> 
> Our weekly Coverity run complained about this in all branches:
> 
> *** CID 181934:  Memory - corruptions  (OVERRUN)
> /srv/coverity/git/pgsql-git/13stable/src/backend/libpq/hba.c: 2368 in gethba_options()
> 2362      if (hba->ldapsearchfilter)
> 2363      options[noptions++] =
> 2364      CStringGetTextDatum(psprintf("ldapsearchfilter=%s",
> 2365      hba->ldapsearchfilter));
> 2366     
> 2367      if (hba->ldapscope)
>>>>    CID 181934:  Memory - corruptions  (OVERRUN)
>>>>    Overrunning array "options" of 14 8-byte elements at element index 14 (byte offset 119) using index "noptions++" (which evaluates to 14).
> 2368      options[noptions++] =
> 2369      CStringGetTextDatum(psprintf("ldapscope=%d", hba->ldapscope));
> 2370      }
> 2371     
> 2372      if (hba->auth_method == uaRADIUS)
> 2373      {
> 
> Looks like you should have increased MAX_HBA_OPTIONS.  The comment
> just above that macro needs work too.

Ugh, I missed that when reading over the function.  Thanks for the report, I'll
get it fixed tonight.

--
Daniel Gustafsson






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


end of thread, other threads:[~2025-01-12 16:20 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-09 09:45 BUG #18769: ldapscheme is not displayed in pg_hba_file_rules PG Bug reporting form <noreply@postgresql.org>
2025-01-09 09:54 ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-01-09 10:00   ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-01-09 12:09     ` Daniel Gustafsson <daniel@yesql.se>
2025-01-10 08:00       ` Laurenz Albe <laurenz.albe@cybertec.at>
2025-01-10 08:02         ` Daniel Gustafsson <daniel@yesql.se>
2025-01-12 15:55           ` Tom Lane <tgl@sss.pgh.pa.us>
2025-01-12 16:20             ` Daniel Gustafsson <daniel@yesql.se>

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