5 # Script started when the PPP daemon disconnects.
14 my ($sessionid, $username, $port, $portid, $timeout) = split (/:/, $ARGV[5]);
18 # Code to inform the server that we're getting out.
20 # Port information database.
21 my $path_portinfo = "/var/ipoint/acct/portinfo";
24 # Radius accounting record generator.
25 my $prog_radacct = "/usr/local/lib/radiusclient/radacct";
27 # The session ID, username, raw port and ID are given to this script
28 # through the ipparam parameter of pppd 2.2.0e and above.
30 # Generate the accounting entry, and hand it over to RADIUS.
32 # Delete the port info entry since the user has logged off, but make use
33 # of the starting time.
34 my (%s, @e, $sessiontime);
35 tie
(%s, "GDBM_File", $path_portinfo, GDBM_WRCREAT
, 0600);
36 @e = split (':', $s{$portid});
40 $sessiontime = time() - $e[4];
46 # Generate the accounting entry, and hand it over to RADIUS.
48 open (H
, "| $prog_radacct -i $port");
51 "Acct-Session-ID = \"$sessionid\"\n" .
52 "User-Name = \"$username\"\n" .
53 "Acct-Status-Type = Stop\n" .
54 "Acct-Authentic = RADIUS\n" .
55 "Service-Type = Framed\n" .
56 "Framed-Protocol = PPP\n" .
57 "Framed-IP-Address = $ARGV[4]\n";
61 $cmd .= "Acct-Session-Time = $sessiontime\n";