Freeradius Name field utf-8 support



  • Hello,

    I did some simple changes on freeradius.xml  gui like adding a new field called "Name" ($varuserfirstname) for First name and Last name of the user and it's working but I need to save UTF-8 characters on the name field but it do not submit and save the utf-8 (Arabic) characters. and it goes blank.

    I read this https://redmine.pfsense.org/issues/2227
    and tried to do some changes with utf8_encode in freeradius.inc, I added ($varuserfirstname = utf8_encode($users['varuserfirstname']);) but still no hope.

    Is there any idea on how can I fix this issue and what file to look for.

    Thanks



  • I imported the config with utf8 text in config.xml (the freeradius account part) and restarted the box to see how it call the accounts in the frontend, after the boot up i get this error in the console:

    Fatal error: cannot create reference to/from string offsets nor overloaded objects in /etc/inc/xmlparse.inc on line 69

    pfsense can't retrieve utf8 in xml so this is lines 60-70 on xmlparse.inc

    function startElement($parser, $name, $attrs) {
    global $parsedcfg, $depth, $curpath, $havedata, $listtags;

    array_push($curpath, strtolower($name));

    $ptr =& $parsedcfg;
    foreach ($curpath as $path) {
    $ptr =& $ptr[$path];
    }

    there is already a strtolower function, we need to implement a utf8 encoder too.



  • woohoo! :) I changed xmlparse.inc at line 65 and it working!

    line 65: file xmlparse.inc

    before:
    array_push($curpath, strtolower($name));

    after:
    array_push($curpath, utf8_encode(strtolower($name)));


Log in to reply