pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Outdated comment on scram_build_secret
2+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2024-12-10 7b2690a571 416d1bd66c 8ac97ce42c  Fix outdated comment of scram_build_secret()
* Outdated comment on scram_build_secret
@ 2024-12-09 23:39  Matheus Alcantara <matheusssilv97@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Matheus Alcantara @ 2024-12-09 23:39 UTC (permalink / raw)
  To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

Hi,

The documentation for the iterations parameter on scram_build_secret say:
  * If iterations is 0, default number of iterations is used.

But the body of the function have the following assert
	Assert(iterations > 0);

Commit b577743000 introduced the assert and remove the if condition. 
All usages of this function is using an iteration > 0, so I think that 
is just a matter of updating the documentation? If that's the case the 
attached patch does that.

-- 
Matheus Alcantara
EDB: https://www.enterprisedb.com

Attachments:

v1-0001-Fix-outdated-scram_build_secret-comment.patch (text/plain, 972B) download From c560e0c5b7e51e48314c6e3ada6126f9ef27d8e3 Mon Sep 17 00:00:00 2001 From: Matheus Alcantara <mths.dev@pm.me> Date: Mon, 9 Dec 2024 20:36:30 -0300 Subject: [PATCH v1] Fix outdated scram_build_secret comment --- src/common/scram-common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/scram-common.c b/src/common/scram-common.c index b611bb8fe7..51cc12e8c3 100644 --- a/src/common/scram-common.c +++ b/src/common/scram-common.c @@ -200,8 +200,7 @@ scram_ServerKey(const uint8 *salted_password, * * The password should already have been processed with SASLprep, if necessary! * - * If iterations is 0, default number of iterations is used. The result is - * palloc'd or malloc'd, so caller is responsible for freeing it. + * The result is palloc'd or malloc'd, so caller is responsible for freeing it. * * On error, returns NULL and sets *errstr to point to a message about the * error details. -- 2.39.3 (Apple Git-146)
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: Outdated comment on scram_build_secret
@ 2024-12-10 00:58  Michael Paquier <michael@paquier.xyz>
  parent: Matheus Alcantara <matheusssilv97@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2024-12-10 00:58 UTC (permalink / raw)
  To: Matheus Alcantara <matheusssilv97@gmail.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>

On Mon, Dec 09, 2024 at 08:39:03PM -0300, Matheus Alcantara wrote:
> Commit b577743000 introduced the assert and remove the if condition. All
> usages of this function is using an iteration > 0, so I think that is just a
> matter of updating the documentation? If that's the case the attached patch
> does that.

Ah, good catch.  

> - * If iterations is 0, default number of iterations is used.  The result is
> - * palloc'd or malloc'd, so caller is responsible for freeing it.
> + * The result is palloc'd or malloc'd, so caller is responsible for freeing it.

Removing the comment sounds like the right thing to do here.  I'll go
do that in a bit down to v16.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

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


end of thread, other threads:[~2024-12-10 00:58 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-09 23:39 Outdated comment on scram_build_secret Matheus Alcantara <matheusssilv97@gmail.com>
2024-12-10 00:58 ` Michael Paquier <michael@paquier.xyz>

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