On Thu, Aug 22, 2002 at 09:43:48AM -0400, David C. Troy wrote: > > All -- > > I am looking for a quick and dirty script that will do a straight > conversion of a detail file to the current MySQL radacct schema. > > I can write one, but would prefer not to reinvent the wheel if I can... > any pointers (or scripts e-mailed here) would be appreciated. I have write little more then you want: 1) Add attribute Recount-Timestamp to my radius dictionary; 2) hack preprocess module, it set request->timestamp to Recount-Timestamp value if radius configured to do it, patch attached; 3) perl script, which parse detail log, replce Timestamp -> Recount-TimeStamp and use radclient to send requests to radius, attached also.
It allow me to re-account old accounting records without writing particular purpose scripts. Probably, some (authors, first :) ), know how this problem (re-account old accounting records) could be solved better and easier? -- Denis Tatarskikh [UdSU/MF] [UdSU/IC] mailto:[EMAIL PROTECTED]
diff -aNur f.orig/raddb/radiusd.conf.in f/raddb/radiusd.conf.in
--- f.orig/raddb/radiusd.conf.in 2002-08-14 21:21:59.000000000 +0500
+++ f/raddb/radiusd.conf.in 2002-08-22 19:51:24.000000000 +0500
@@ -794,6 +794,7 @@
# If you're not running a Cisco NAS, you don't need
# this hack.
with_cisco_vsa_hack = no
+ with_recount_timestamp_hack = no
}
# Livingston-style 'users' file
diff -aNur f.orig/src/modules/rlm_preprocess/rlm_preprocess.c
f/src/modules/rlm_preprocess/rlm_preprocess.c
--- f.orig/src/modules/rlm_preprocess/rlm_preprocess.c 2002-08-06 22:33:40.000000000
+0500
+++ f/src/modules/rlm_preprocess/rlm_preprocess.c 2002-08-22 20:02:24.000000000
++0500
@@ -48,6 +48,7 @@
int with_ntdomain_hack;
int with_specialix_jetstream_hack;
int with_cisco_vsa_hack;
+ int with_recount_timestamp_hack;
} rlm_preprocess_t;
static CONF_PARSER module_config[] = {
@@ -69,6 +70,8 @@
"no" },
{ "with_cisco_vsa_hack", PW_TYPE_BOOLEAN,
offsetof(rlm_preprocess_t,with_cisco_vsa_hack), NULL, "no" },
+ { "with_recount_timestamp_hack", PW_TYPE_BOOLEAN,
+ offsetof(rlm_preprocess_t,with_recount_timestamp_hack), NULL, "no" },
{ NULL, -1, 0, NULL, NULL }
};
@@ -138,6 +141,14 @@
}
}
+static int recount_timestamp_hack(REQUEST * request){
+ VALUE_PAIR * vp;
+
+
+if((vp=pairfind(request->packet->vps,dict_attrbyname("Recount-Timestamp")->attr))==NULL)
+ return 0;
+ request->timestamp = vp->lvalue;
+ return 1;
+}
/*
* Mangle username if needed, IN PLACE.
*/
@@ -716,6 +727,8 @@
*/
cisco_vsa_hack(request->packet->vps);
}
+ if(data->with_recount_timestamp_hack)
+ recount_timestamp_hack(request);
/*
* Ensure that we log the NAS IP Address in the packet.
recount.pl
Description: Perl program
