Yes, it’s ok.
I’ve simply made a mistake in cut/paste
operations.
The corret one is as follows
CREATE FUNCTION `mac_check`(utente VARCHAR(20),mac
VARCHAR(30)) RETURNS varchar(50)
DETERMINISTIC
BEGIN
IF (SELECT (SELECT
MAX((Attribute='Calling-Station-Id')) from radcheck WHERE UserName=user))
THEN
#INSERT
into radpostauth (id, user, pass, reply, date) values ('', utente,
passwd,reply_packet, NOW());
RETURN
'record already present';
END IF;
INSERT
INTO radcheck (UserName,Attribute,op,Value) VALUES
(utente,'Calling-Station-Id',':=', mac);
RETURN
'record inserted';
END
The five arguments one is because I tried to change
the content of postauth_query with a function that have to perform two actions:
-
INSERT into
radcheck (needed to perform MAC control)
-
INSERT into
radpostauth (original behaviour of postauth_query)
Regards,
Carlo