Hi list,
  I'm trying to set authorize section in my default sites file.

 I need to allow traffic users in terms of time and bandwidth.
 So, my attempts were like these:


authorize{

    dailycounter
 
        if (Auth-Type == "Reject") {           #I tried also if(!ok) or if (reject)
           update control{
                Post-Auth-Type := "Access-Accept"
           }
           dailybandwidthcounter
       }
  .....
 }

The control never enters the condition and the dailycounter returns "reject"

Wed Aug 22 13:15:39 2012 : Info: [dailycounter] sql_xlat
Wed Aug 22 13:15:39 2012 : Info: [dailycounter]     expand: %{User-Name} -> xxxxxx
Wed Aug 22 13:15:39 2012 : Info: [dailycounter] sql_set_user escaped user --> '
xxxxxx'
Wed Aug 22 13:15:39 2012 : Info: [dailycounter]     expand: SELECT SUM(acctsessiontime -                  GREATEST((1345586400 - UNIX_TIMESTAMP(acctstarttime)), 0))                  FROM radacct WHERE username = 'xxxxxx' AND                  UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '1345586400' -> SELECT SUM(acctsessiontime -                  GREATEST((1345586400 - UNIX_TIMESTAMP(acctstarttime)), 0))                  FROM radacct WHERE username = '
xxxxxx' AND                  UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '1345586400'
Wed Aug 22 13:15:39 2012 : Debug: rlm_sql (sql): Reserving sql socket id: 11
Wed Aug 22 13:15:39 2012 : Info: [dailycounter] sql_xlat finished
Wed Aug 22 13:15:39 2012 : Debug: rlm_sql (sql): Released sql socket id: 11
Wed Aug 22 13:15:39 2012 : Info: [dailycounter]     expand: %{sql:SELECT SUM(acctsessiontime -                  GREATEST((1345586400 - UNIX_TIMESTAMP(acctstarttime)), 0))                  FROM radacct WHERE username = '
xxxxxx' AND                  UNIX_TIMESTAMP(acctstarttime) + acctsessiontime > '1345586400'} -> 327
Wed Aug 22 13:15:39 2012 : Debug: rlm_sqlcounter: (Check item - counter) is less than zero
Wed Aug 22 13:15:39 2012 : Debug: rlm_sqlcounter: Rejected user
xxxxxx, check_item=180, counter=327
Wed Aug 22 13:15:39 2012 : Info: ++[dailycounter] returns reject
Wed Aug 22 13:15:39 2012 : Auth: Invalid user (rlm_sqlcounter: Maximum daily usage time reached): [xxxxxx] (from client localhost port 0 cli
xxxxxx)
Wed Aug 22 13:15:39 2012 : Info: Using Post-Auth-Type Reject



Thank you very much for any help
Regards
Ilaria
-- 
------------------------------------------------
Ilaria De Marinis
Settore Reti e Servizi

CASPUR - Via dei Tizii ,6 - 00185 Roma
e-mail: ilaria.demarinis@caspur.it
------------------------------------------------