Re: small patch to crypt.c - Mailing list pgsql-hackers

From Joshua D. Drake
Subject Re: small patch to crypt.c
Date
Msg-id 51B4B067.8000504@commandprompt.com
Whole thread Raw
In response to Re: small patch to crypt.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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





pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: small patch to crypt.c
Next
From: Simon Riggs
Date:
Subject: Re: Optimising Foreign Key checks