plpgsql freeradius authentication function
Kafui Akyea
kakyea at gmail.com
Mon Oct 18 17:32:19 CEST 2010
Hi
I implemented this in the freeradius postgresql.conf file
SELECT id,username,attribute,op,value FROM try('7140944444','0000') as(id
integer,username varchar,attribute varchar,op character,value varchar);
and implemented this function on the Postgres database server
CREATE OR REPLACE FUNCTION try (your_name TEXT, tiger TEXT) RETURNS RECORD
AS $$
DECLARE
users_rec RECORD;
BEGIN
if tiger = '0000' then
SELECT INTO users_rec * FROM aniradcheck WHERE username = your_name;
else
SELECT INTO users_rec * FROM radcheck WHERE username = your_name;
end if;
RETURN users_rec.username;
END;
$$ LANGUAGE plpgsql;
I am generally trying to authenticate with a postgres function
Thanks and your help very much appreciated.
On Mon, Oct 18, 2010 at 2:20 AM, Santiago Balaguer García <
santiagoawa at hotmail.com> wrote:
> In which statement do you implement this query?
>
> ------------------------------
> Date: Sat, 16 Oct 2010 11:49:36 -0400
> Subject: plpgsql freeradius authentication function
> From: kakyea at gmail.com
> To: freeradius-users at lists.freeradius.org
>
>
> Hi
>
> I have a plpgsql function being called from freeradius to do authentication
> but i keep getting
> Access-Reject from radius although when i run the function without
> freeradius it works fine.
> Please find below the function and how i call it
>
> CREATE OR REPLACE FUNCTION try (your_name TEXT, tiger TEXT) RETURNS RECORD
> AS $$
> DECLARE
> users_rec RECORD;
>
> BEGIN
> if tiger = '0000' then
> SELECT INTO users_rec * FROM aniradcheck WHERE username = your_name;
> else
> SELECT INTO users_rec * FROM radcheck WHERE username = your_name;
> end if;
> RETURN users_rec.username;
> END;
>
> $$ LANGUAGE plpgsql;
>
>
> SELECT id,username,attribute,op,value FROM try('7140944444','0000') as(id
> integer,username varchar,attribute varchar,op character,value varchar);
>
>
> Appreciate if you can help
> Thanks
>
> - List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20101018/8ec36797/attachment.html>
More information about the Freeradius-Users
mailing list