Substrings with unlang
Mikhail Sutormin
msutormin at gmail.com
Thu Sep 22 01:12:38 CEST 2016
Greetings,
We are running a VM with FR3 in Azure which authenticates users with their
O365 credentials against Azure ADDS. The problem is a legacy 20 characters
limitation of SamAccountName attribute. I strip "@domain.com" part off O365
username before passing it to ntlm_auth but some users have very long names
so "sampleverylongusername" is truncated to "sampleverylonguserna" in DC.
How do I right a simple check to truncate it in FR? I'm not skilled in
regular expressions.
So I've tried
if (Stripped-User-Name =~ /(.{0,19})$/) {
update request {
Stripped-User-Name := "%{1}"
}
}
but that cuts off first 20 characters and leaves the rest.
More information about the Freeradius-Users
mailing list