non ascii characters in exec output

Oleg Palij o.palij at dp.uz.gov.ua
Sat Aug 13 20:30:09 CEST 2016


I am using freeradius 3.0.12 on debian jessie.

I have custom 'control' variable mapped to user distinguishedName attribute (it is in UTF-8) in Active Directory:
ldap {
  update {
    control:ms-distinguishedName    := 'distinguishedName'
  }

I want to convert it to custom format and log to postauth table:
authorize {
  update control {
    &ms-publishedAt := "%{exec:/etc/freeradius/dn2ou.py %{control:ms-distinguishedName}}"
  }

In script I got UTF-8 string from freeradius, but I can't understand in what encoding I should return result.
I tried different variants without success.
Simple bash script like:
echo $@
shows following debug:

(2)       update control {
(2)         Executing: /etc/freeradius/test.sh CN\=Сотрудник\ ХХХ,OU\=ОК\ \(Р-1\),OU\=орг,DC\=xx,DC\=xx,DC\=xx,DC\=xx:
(2)         Program returned code (0) and output 'CN\=Сотрудник ХХХ,OU\=ОК \(Р-1\),OU\=орг,DC\=xx,DC\=xx,DC\=xx,DC\=xx'
(2)         EXPAND %{exec:/etc/freeradius/ivc/test.sh %{control:ms-distinguishedName}}
(2)            --> CN\=                     ,OU\=                       \( -1\),OU\=                               ,DC\=xx,DC\=xx,DC\=xx,DC\=xx
(2)         &ms-publishedAt := CN\=                     ,OU\=                       \( -1\),OU\=                               ,DC\=xx,DC\=xx,DC\=xx,DC\=xx
(2)       } # update control = noop


So it get output as UTF-8 string, but next EXPAND vanishes non-ascii symbols to spaces.

Is it possible to get 'exec' module output with non ascii characters?


More information about the Freeradius-Users mailing list