Hi<br><br>I implemented this in the freeradius postgresql.conf file<br>SELECT id,username,attribute,op,value FROM try('7140944444','0000')
as(id integer,username varchar,attribute varchar,op character,value
varchar);<br><br>and implemented this function on the Postgres database server<br>CREATE OR REPLACE FUNCTION try (your_name TEXT, tiger TEXT) RETURNS RECORD AS $$<br> DECLARE<br> users_rec RECORD;<br> <br>
BEGIN<br> if tiger = '0000' then<br> SELECT INTO users_rec * FROM aniradcheck WHERE username = your_name;<br> else <br> SELECT INTO users_rec * FROM radcheck WHERE username = your_name;<br>
end if;<br> RETURN users_rec.username; <br> END;<br><br>$$ LANGUAGE plpgsql;<br><br>I am generally trying to authenticate with a postgres function<br><br>Thanks and your help very much appreciated.<br><br>
<br><div class="gmail_quote">On Mon, Oct 18, 2010 at 2:20 AM, Santiago Balaguer García <span dir="ltr"><<a href="mailto:santiagoawa@hotmail.com">santiagoawa@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
In which statement do you implement this query?<br> <br>
<hr>
Date: Sat, 16 Oct 2010 11:49:36 -0400<br>Subject: plpgsql freeradius authentication function<br>From: <a href="mailto:kakyea@gmail.com" target="_blank">kakyea@gmail.com</a><br>To: <a href="mailto:freeradius-users@lists.freeradius.org" target="_blank">freeradius-users@lists.freeradius.org</a><div>
<div></div><div class="h5"><br><br>Hi<br><br>I have a plpgsql function being called from freeradius to do authentication but i keep getting<br>Access-Reject from radius although when i run the function without freeradius it works fine.<br>
Please find below the function and how i call it<br><br>CREATE OR REPLACE FUNCTION try (your_name TEXT, tiger TEXT) RETURNS RECORD AS $$<br> DECLARE<br> users_rec RECORD;<br> <br> BEGIN<br>
if tiger = '0000' then<br> SELECT INTO users_rec * FROM aniradcheck WHERE username = your_name;<br> else <br> SELECT INTO users_rec * FROM radcheck WHERE username = your_name;<br> end if;<br>
RETURN users_rec.username; <br> END;<br><br>$$ LANGUAGE plpgsql;<br><br><br>SELECT id,username,attribute,op,value FROM try('7140944444','0000') as(id integer,username varchar,attribute varchar,op character,value varchar);<br>
<br><br>Appreciate if you can help<br>Thanks <br><br></div></div>- List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a> </div>
<br>-<br>
List info/subscribe/unsubscribe? See <a href="http://www.freeradius.org/list/users.html" target="_blank">http://www.freeradius.org/list/users.html</a><br></blockquote></div><br>