On Sat, 17 Aug 2002, SAber Khamooshi wrote:

> No Answer ?
> FreeRADIUS doesn't support such group ?
>
>
> Kind Regards
> SAber Khamooshi

Please try the attached patch. You should then be able to use Login-Time
compares in the users file. Then you can do the following:

DEFAULT Login-Time == "Any1400-0200", Max-Monthly-Session := 90000
        Fall-Through = 1

DEFAULT Login-Time == "Any0200-0700", Max-Monthly-Session := 270000
        Fall-Through = 1

DEFAULT Login-Time == "Any0700-1400", Max-Monthly-Session := 180000
        Fall-Through = 1

Hope it works

--
Kostas Kalevras         Network Operations Center
[EMAIL PROTECTED]      National Technical University of Athens, Greece
Work Phone:             +30 10 7721861
'Go back to the shadow' Gandalf

>
>
> ----- Original Message -----
> From: "SAber Khamooshi" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 14, 2002 10:39 PM
> Subject: MultiGroup and counter module
>
>
> > hi all
> > I am newbie in FreeRADIUS and I am going to migrate from my NT Commercial
> > Accounting/Radius Server to FreeRadius.
> >
> > my biggest problem is this :
> > I defined a special group in my previous accounting server , and it was :
> > 25H/month group
> >
> > if my users login between 2Pm-2Am they could use just 25 hours per month
> > but if they login between 2Am-7Am they could use 75 hours/month
> > and if they login between 7Am-2PM they could use 50 hours/month
> >
> > I read counter module session in radiusd.conf
> > but I couldn't find any appropriate option to accomplish such group.
> > anybody before done it ?
> > thanks your help
> >
> > P.s
> > I am using FreeRADIUS 0.7 with sql module (MySQL)
> >
> > Kind Regards
> > SAber Khamooshi
> >
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>
diff -ruN /src/cvs/radiusd.orig/src/include/token.h src/include/token.h
--- /src/cvs/radiusd.orig/src/include/token.h   Sat Aug 17 20:48:50 2002
+++ src/include/token.h Sat Aug 17 20:49:38 2002
@@ -55,6 +55,7 @@
 } LRAD_TOKEN;
 
 #define T_EQSTART      T_OP_ADD
+#define T_OP_CMP_START T_OP_NE
 #define        T_EQEND         (T_OP_CMP_EQ + 1)
 
 int            getword (char **ptr, char *buf, int buflen);
diff -ruN /src/cvs/radiusd.orig/src/main/auth.c src/main/auth.c
--- /src/cvs/radiusd.orig/src/main/auth.c       Sat Aug 17 20:48:50 2002
+++ src/main/auth.c     Sat Aug 17 20:49:24 2002
@@ -680,7 +680,7 @@
        }
 
        if (result >= 0 &&
-           (check_item = pairfind(request->config_items, PW_LOGIN_TIME)) != NULL) {
+           (check_item = pairfind(request->config_items, PW_LOGIN_TIME)) != NULL && 
+check_item->operator < T_OP_CMP_START) {
 
                /*
                 *      Authentication is OK. Now see if this
diff -ruN /src/cvs/radiusd.orig/src/main/valuepair.c src/main/valuepair.c
--- /src/cvs/radiusd.orig/src/main/valuepair.c  Sat Aug 17 20:48:50 2002
+++ src/main/valuepair.c        Sat Aug 17 20:49:25 2002
@@ -591,6 +591,26 @@
 }
 
 /*
+ *     Compare the Login-Time attribute
+ */
+static int logtimecmp(void *instance, REQUEST *req, VALUE_PAIR *request,
+                       VALUE_PAIR *check, VALUE_PAIR *check_pairs, VALUE_PAIR 
+**reply_pairs)
+{
+       int ret;
+
+       if (check && check->strvalue){
+               ret = timestr_match((char *)check->strvalue,req->timestamp);
+               if (ret == -1)
+                       return -1;
+               else
+                       return 0;
+       }
+
+       return -1;
+}
+
+
+/*
  *     Register server-builtin special attributes.
  */
 void pair_builtincompare_init(void)
@@ -602,6 +622,7 @@
        paircompare_register(PW_CURRENT_TIME, 0, timecmp, NULL);
        paircompare_register(PW_NO_SUCH_ATTRIBUTE, 0, attrcmp, NULL);
        paircompare_register(PW_EXPIRATION, 0, expirecmp, NULL);
+       paircompare_register(PW_LOGIN_TIME, 0, logtimecmp, NULL);
 }
 
 /*

Reply via email to