/etc/freeradius/3.0/mods-config/sql/ippool/oracle/procedures.sql is in freeradius-config 3.0.16+dfsg-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | CREATE OR REPLACE FUNCTION msqlippool(user varchar2, pool varchar2)
RETURN varchar2 IS
PRAGMA AUTONOMOUS_TRANSACTION;
ip_temp varchar2(20);
BEGIN
-- If the user's pool is dynamic, get an ipaddress (oldest one) from the corresponding pool
if pool = 'Dynamic' then
select framedipaddress into ip_temp from (select framedipaddress from radippool where expiry_time < current_timestamp and pool_name = pool ORDER BY expiry_time) where rownum = 1;
return (ip_temp);
-- Else, then get the static ipaddress for that user from the corresponding pool
else
select framedipaddress into ip_temp from radippool where username = user and pool_name = pool;
return (ip_temp);
end if;
exception
-- This block is executed if there's no free ipaddresses or no static ip assigned to the user
when NO_DATA_FOUND then
if pool = 'Dynamic' then
return(''); -- so sqlippool can log it on radius.log
end if;
-- Else, grabs a free IP from the static pool and saves it in radippool so the user will always get the same IP the next time
select framedipaddress into ip_temp from (select framedipaddress from radippool where expiry_time < current_timestamp and username is null and pool_name = pool) where rownum = 1;
UPDATE radippool SET username = user where framedipaddress = ip_temp;
commit;
return (ip_temp);
when others
then return('Oracle Exception');
END;
/
|