Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Freeradius Name field utf-8 support

    Scheduled Pinned Locked Moved pfSense Packages
    3 Posts 1 Posters 1.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      n3tg33k
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • N
        n3tg33k
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • N
          n3tg33k
          last edited by

          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)));

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.