Re: Error in chkpass.c (contrib area) with suggestion

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Sedlak Anton <ased(at)cce(dot)cz>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Error in chkpass.c (contrib area) with suggestion
Date: 2002-10-23 13:24:06
Message-ID: 20021023062015.U3876-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 22 Oct 2002, Sedlak Anton wrote:

> Because author is not responding I'm writing to you.
> In contrib/chkpass.c there is no checking against NULL values on input,
> thus if you call eg. raw(NULL) then postgresql always dies.
> Although storing encrypted password are highly required this behavior
> makes this extension module unusable.
>
> To correct it one must add some checkin before any PG_GETARG_XXX in
> chkpass.c:
> Suggested type of code follows:
> ------------------------------------------------------------------
> if(PG_ARGISNULL(0)) PG_RETURN_NULL();
> ------------------------------------------------------------------
>
> Best regards and let me know if this is acceptable

It might be easier to declare the function strict which means that
it returns NULL on NULL input without calling the function for each
of the functions that should act that way (I'd guess all of
raw, eq and ne should be strict). This can also be done without
needing to recompile if you drop the functions and recreate them
with "with (isstrict)"

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2002-10-23 13:44:10 Re: now() gives the time of the last commit, not the time it
Previous Message Stephan Szabo 2002-10-23 13:19:50 Re: vacuum bug