Re: small patch to crypt.c

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: small patch to crypt.c
Дата
Msg-id 51B4B067.8000504@commandprompt.com
обсуждение исходный текст
Ответ на Re: small patch to crypt.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: small patch to crypt.c
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Optimising Foreign Key checks