Re: problems getting rewrite hook right

Charles Sprickman <[email protected]> Fri, 27 Oct 2006 16:31:21 -0400 (EDT)
Newsgroups gmane.comp.gnu.radius.general
Message-ID <[email protected]>
On Thu, 26 Oct 2006, Sergey Poznyakoff wrote:

> Charles Sprickman <[email protected]> wrote:
>
>> I'm trying that, but I get an even stranger result:
>>
>> Oct 25 15:53:10 elephant radiusd: Auth.debug:
>> mysql.c:216:rad_mysql_exec: query:
>> SELECT attr,value FROM radius_attrib WHERE username='[email protected]' AND
>> op IS NULL AND domain='[email protected]'
>
> Then, it seems I have not understood the intent of the function. In its
> current form it simply returns the domain name of the user,
> i.e. everything after the first @ or % sign. Was it supposed to do
> something else?

Yeah, I'm not sure I understood what I was looking for either. :)

Currently all our dialup stuff is outsourced.  So with a "normal" user 
with an @bway.net account, they login using [email protected].  Our dial 
provider strips the "@bway.net" and sends the user/pass to us.

We also have domain accounts where the user's actual username is 
"[email protected]".  We instruct those users to use 
"username%[email protected]" when dialing in.  The "@bway.net" is 
stripped by our dial provider and we see the user as 
"username%domain.com".

So I need to split at the "%".  If there's no "%", it can be left as-is.

More of the picture to make this clear...

hints contains this:

DEFAULT NULL    Client-IP-Address = "=request_source_ip()",
                 Fall-Through = Yes
DEFAULT NULL    Rewrite-Function = restore_nas_ip,
                 Fall-Through = Yes

DEFAULT NULL    Auth-Dom = "=domain_split(%[User-Name])"

sqlserver has a query like this (note the user and domain are two 
seperate fields in the auth table):

# Query to select the password for the given user. Should return one 
string.
auth_query  SELECT pw_passwd \
         FROM vpopmail \
         WHERE pw_name='%u' \
         AND pw_domain='%C{Auth-Dom}'

Does that pretty much make sense?  It's kind of a strange setup...

> Regards,
> Sergey
>
> PS: Is skunkworks still alive?

I recently had to steal the mainboard from it for another machine...  I 
have an older board/processor here and all the drives so I should be able 
to get something together in the next week or two.

I'd like to get it setup with FreeBSD 4.11 and 6.2, would that be helpful?

Thanks,

Charles

>
>