(RADIATOR) Problems with PreAuthHook

Bogdan TARU bgd at icomag.de
Fri Oct 25 06:42:30 CDT 2002


	Hi guys,

 It seems that I don't know how to use PreAuthHook properly. I would like
to do something like: if a username matches a certain patter (in my case,
the last two chars are 'es'), then rename the username to a known one
'abracadabra', and do the authentification (fetch 'abracadabra's
attributes instead of the actual user ending in 'es'). So I did a:

    RewriteUsername s/(.*)\\+$/$1/
    PreAuthHook sub { \
        my $p = ${$_[0]}; \
        my $username = $p->get_attr('User-Name'); \
        if (substr($username,-2) eq 'es') { \
          $p->delete_attr('User-Name'); \
          $p->add_attr('User-Name', 'abracadabra'); \
          &main::log($main::LOG_ERR, $p->get_attr('User-Name')); \
	} \
    }

 And the AuthSelect looks like:

 AuthSelect      select users.attribute from users left join users AS tmp
			on \
                 tmp.User='%{User-Name}' where (tmp.User IS NULL AND
			users.User='Default')

 But it seems that %{User-Name} in the Select statement is the original
username, not the one that I replaced. The log file looks like:


Fri Oct 25 13:36:41 2002: ERR: abracadabra
Fri Oct 25 13:36:41 2002: DEBUG: Handling with Radius::AuthSQL
Fri Oct 25 13:36:41 2002: DEBUG: Handling with Radius::AuthSQL:
Fri Oct 25 13:36:41 2002: DEBUG: Query is: select users.attribute from
users left join users AS tmp on tmp.User='bgdes' where (tmp.User IS NULL
AND users.User='Default')


 What am I doing wrong?

 Thanks,
 bogdan

----------------------------
iCom Media AG
Kirchweg 36
Koln, 50858
Germany

Phone: +49-(0)221-485-689-16
Fax  : +49-(0)221-485-689-20
Mobile:+49-(0)173-906-46-01

===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list