problems getting rewrite hook right

Charles Sprickman <[email protected]> Fri, 20 Oct 2006 16:58:55 -0400 (EDT)
Newsgroups gmane.comp.gnu.radius.general
Message-ID <[email protected]>
Hi all,

I have the following hook to try and rewrite usernames for folks dialing 
in via our outsourced ports:

string
domain_split(string name)
{
         integer a;

         %[User-Name] = gsub("%", "@", name);
         a = index(name, '@');
         if (a != -1)
                 return substr(name, a+1, -1);
         else
                 return "bway.net";
         return "";
}

This works fine for all the "[email protected]" people, but we also do full 
domain accounts where people can login with their email address, ie: 
"[email protected]".  If we instruct the users to enter this as 
"bob%[email protected]" our dialup providers will send this through as 
"bob%foo.com".  The above gives me the following result:

Oct 20 16:33:21 elephant radiusd: Auth.debug: mysql.c:57:do_mysql_query: 
called with SELECT attr,value FROM radius_attrib WHERE 
username='[email protected]' AND op IS NULL AND domain='bway.net'

So it is rewriting the "%" to "@", but not doing the split...

Any suggestions?

Thanks,

Charles

___
Charles Sprickman
NetEng/SysAdmin
Bway.net - New York's Best Internet - www.bway.net
[email protected] - 212.655.9344