Using username at example.com and plain username
Arran Cudbard-Bell
a.cudbardb at freeradius.org
Wed Sep 19 12:25:00 CEST 2012
On 19 Sep 2012, at 00:20, Kriston <me at kriston.net> wrote:
> On Tue, September 18, 2012 17:34, Arran Cudbard-Bell wrote:
>>
>> On 18 Sep 2012, at 22:22, "Kriston" <me at kriston.net> wrote:
>>
>>> I have users who log in as "username at example.com" and just as "username".
>>> How do I append @example.com only to those users who don't have
>>> @example.com
>>> already? I have a fairly generic FreeRADIUS 2.1.10 installation that
>>> connects to a MySQL server.
>>>
>>> I've tried a number of different things in dialup.conf but none have
>>> worked.
>>>
>>> Example 1:
>>> sql_user_name =
>>> "{%{Stripped-User-Name}:-%{User-Name}}@{%{Realm}:-example.com}"
>>>
>>> This results in a string in the SQL queries for User-Name that looks like
>>> "=7B:-username=7D@=7B:-example.com=7D".
>>
>> Look at all those lonely lonely left hand curly braces, don't you think they
>> might appreciate another character to snuggle up to? What do you think that
>> character might be?
>
> While this comment is clever, would you provide a corrected example?
Phil Mayers has now done that. I mean come on, every other variable expansion begins with %{.
The default example that you edited even shows the correct syntaxt:
https://github.com/alandekok/freeradius-server/blob/master/raddb/sql/mysql/dialup.conf#L36
>>> Example 2:
>>> I have also tried regular expressions like this:
>>> if ( %{User-Name} !~ /.example\.com/i) {
>>> sql_user_name = "%{User-Name}@example.com"
>>> }
>>> But this one results in a blank string for in the SQL queries that use
>>> sql_user_name.
>>>
>>> I'm open to any and all comments.
>>
>> Read man unlang, stop inventing syntax.
>
> Why not post the correct syntax and show us?
Why don't you go read man unlang and post the correct syntax? :)
-Arran
More information about the Freeradius-Users
mailing list