Fixed Duration Weekly, Monthly and Daily Accounts

JennyBlunt jennyshoehorn at me.com
Fri Nov 11 20:43:20 CET 2011


I'm looking at your query and am a bit lost as to what I should use for the
attributes.

Say I wanted 24 hour voucher - expires exactly 24 hours after first login. I
need to give the user some attribute in the db of 86400 seconds - for
example I'll call this Access-Duration

So how do I insert the sql query?

Your query looks like this:

post-auth { 
... 
  update control { 
    Tmp-String-0 := "%{sql: SELECT ID FROM radcheck WHERE 
username='%{User-Name}' AND attribute='Expiration'}" 
  } 

  if (! "%{control.Tmp-String-0}") { 
    update control { 
      Tmp-String-0 := "%{sql: INSERT INTO radcheck 
(username,atrribute,op,value) values (...)}; SELECT NOW()" 
    } 
  } 
... 
} 

What should the values be and how do I call the Access-Duration value?? Do I
need another statement near TmpWould it be something like this:

"%{sql: INSERT INTO radcheck 
(username,atrribute,op,value) values ('%{User-Name}', 'expiration', ':=',
'UNIX_TIMESTAMP+ %{control.Tmp-String-0}'}; SELECT NOW()" 

Thanks for your help

--
View this message in context: http://freeradius.1045715.n5.nabble.com/Fixed-Duration-Weekly-Monthly-and-Daily-Accounts-tp4950022p4985367.html
Sent from the FreeRadius - User mailing list archive at Nabble.com.



More information about the Freeradius-Users mailing list