-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace MySQL user_name and computer_name column '=5C' with '\' #3510
Conversation
@julsemaan not tested. |
freeradius encodes the sql changing special characters to the following format '=6F' where 6F is the hexadecimal representation of the character. So either this can be done in perl or MySQL $value =~ s/=([a-fA-F0-9]{2})/chr(hex($1))/ge; DELIMITER $$
DROP FUNCTION IF EXISTS FREERADIUS_DECODE $$
CREATE FUNCTION FREERADIUS_DECODE (str text)
RETURNS text
DETERMINISTIC
BEGIN
DECLARE result text;
DECLARE ind INT DEFAULT 0;
SET result = str;
WHILE ind <= 255 DO
SET result = REPLACE(result, CONCAT('=', LPAD(LOWER(HEX(ind)), 2, 0)), CHAR(ind));
SET result = REPLACE(result, CONCAT('=', LPAD(HEX(ind), 2, 0)), CHAR(ind));
SET ind = ind + 1;
END WHILE;
RETURN result;
END$$
DELIMITER ; select FREERADIUS_DECODE('=5C') as decoded_value;
+---------------+
| decoded_value |
+---------------+
| \ |
+---------------+ |
I like the second option @jrouzierinverse has suggested since this allows us to integrate it easily in the custom reports |
@julsemaan reworked Note that |
PR looks good to me @satkunas were you able to test te new code or should this be tested prior to merge? |
We do put the stored procs in the schema file: |
@julsemaan added to schema in 988d1b8 |
@julsemaan not tested fully. |
Won't be cherry-picking because this contains schema changes |
Description
Replaces '=5C' with '' in reports for top authentication successes and failures user_name and computer_name.
Impacts
none
Issue
fixes #3508
Delete branch after merge
YES
Bug Fixes