Need to conditionally update user data in authentication process (mysql) - Clues?

Mark Elkins mje at posix.co.za
Fri Sep 9 18:19:28 CEST 2005


Hi

I need to conditionally update some user data whilst in the
authentication process - I'm looking for clues as how to do this.

Background: I'm providing vouchers with a username and password on them.
The first time the voucher details are used - I need to update that
users details (change their group, add an expiry date - etc). All my
users are in groups and its only users in a particular group that I want
this to happen too...
Everything is in MySQL.

Sort of...
    
 pre_authorize_check = "UPDATE useracct SET groupname='newgroup',
expireaccount='now() + 30 days' IF 
(SELECT groupname FROM useracct WHERE Username='%{Stripped-User-Name}'
AND realm='%{Realm}' ) ==  'voucher_group';

ie - If the person trying to login is a member of my 'voucher_group',
make some changes to their SQL details first.... then authenticate them
as normal...

How would I do something like this?

This process would only ever happen once to a user in the lifetime of
their account, unlike repetitively logging in and using the service
afterwards.

ps - I also want to send them some welcoming e-mail at the same time and
as their username at realm is actually their e-mail address .. the address
is easy...but the process of doing so?
-- 
  .  .     ___. .__      Posix Systems - Sth Africa.  e.164 VOIP ready
 /| /|       / /__       mje at posix.co.za  -  Mark J Elkins, Cisco CCIE
/ |/ |ARK \_/ /__ LKINS  Tel: +27 12 807 0590  Cell: +27 82 601 0496




More information about the Freeradius-Users mailing list