Re: small patch to crypt.c

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: small patch to crypt.c
Date: 2013-06-09 16:42:15
Message-ID: 51B4B067.8000504@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 06/09/2013 09:28 AM, Tom Lane wrote:

> Even aside from that, the proposed change seems like a bad idea because
> it introduces an unnecessary call of GetCurrentTimestamp() in the common
> case where there's no valuntil limit. On some platforms that call is
> pretty slow.

And that would explain why we don't do something like this:

index f01d904..4935c9f 100644
--- a/src/backend/libpq/crypt.c
+++ b/src/backend/libpq/crypt.c
@@ -145,12 +145,10 @@ md5_crypt_verify(const Port *port, const char
*role, char *client_pass)
/*
* Password OK, now check to be sure we are not past
rolvaliduntil
*/
- if (isnull)
+ if (isnull || vuntil > GetCurrentTimestamp())
retval = STATUS_OK;
- else if (vuntil < GetCurrentTimestamp())
- retval = STATUS_ERROR;
else
- retval = STATUS_OK;
+ retval = STATUS_ERROR;
}

Right. Ty for the feedback, I know it was just a little bit of code but
it just looked off and I appreciate the explanation.

JD

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2013-06-09 17:13:15 Re: Optimising Foreign Key checks
Previous Message Tom Lane 2013-06-09 16:28:13 Re: small patch to crypt.c