~ubuntu-branches/ubuntu/natty/freeradius/natty-updates

« back to all changes in this revision

Viewing changes to raddb/modules/sql_log

  • Committer: Bazaar Package Importer
  • Author(s): Josip Rodin
  • Date: 2009-11-23 03:57:37 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20091123035737-zsgtzhfych8hir68
Tags: 2.1.7+dfsg-1
* Adopting the package, closes: #536623.
* New upstream version, closes: #513484.
  + Fixes the blooper in unlang evaluation logic, closes: #526175.
* Used quilt (and added README.source), and moved upstream file patching
  into debian/patches/. The source is no longer in collab-maint git
  (to make it simpler for me to finally get this out the door), but
  kept the .gitignore should we need that again.
* Dropped the dialup_admin/bin/backup_radacct patch (integrated upstream).
* Dropped the raddb/Makefile patch (problem no longer exists upstream).
* Dropped the lib/packet.c lib/radius.c main/listen.c patches (was from
  upstream 2.0.5 anyway).
* Dropped references to otp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Dropped references to snmp.conf, it no longer exists upstream.
  Keep removing the conffile statoverride in prerm.
* Ship /etc/freeradius/modules/* in the freeradius package.
* Stop shipping sites-enabled symlinks in the package and instead create
  them only on initial install, thanks to Matej Vela, closes: #533396.
* Add export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" to the init script
  at the request of John Morrissey, closes: #550143.
* Stop installing /var/run/freeradius in the package to silence Lintian.
  The init script already recreates it at will.
* Remove executable bit from example.pl to silence Lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- text -*-
 
2
#
 
3
#  $Id$
 
4
 
 
5
#
 
6
#  The rlm_sql_log module appends the SQL queries in a log
 
7
#  file which is read later by the radsqlrelay program.
 
8
#
 
9
#  This module only performs the dynamic expansion of the
 
10
#  variables found in the SQL statements. No operation is
 
11
#  executed on the database server. (this could be done
 
12
#  later by an external program) That means the module is
 
13
#  useful only with non-"SELECT" statements.
 
14
#
 
15
#  See rlm_sql_log(5) manpage.
 
16
#
 
17
#  This same functionality could also be implemented by logging
 
18
#  to a "detail" file, reading that, and then writing to SQL.
 
19
#  See raddb/sites-available/buffered-sql for an example.
 
20
#
 
21
sql_log {
 
22
        path = "${radacctdir}/sql-relay"
 
23
        acct_table = "radacct"
 
24
        postauth_table = "radpostauth"
 
25
        sql_user_name = "%{%{User-Name}:-DEFAULT}"
 
26
 
 
27
        #
 
28
        #  Setting this to "yes" will allow UTF-8 characters to be
 
29
        #  written to the log file.  Otherwise, they are escaped
 
30
        #  as being potentially invalid.
 
31
        #
 
32
        utf8 = no
 
33
 
 
34
        Start = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
 
35
         NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
 
36
         AcctSessionTime, AcctTerminateCause) VALUES                 \
 
37
         ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
 
38
         '%{Framed-IP-Address}', '%S', '0', '0', '');"
 
39
        Stop = "INSERT INTO ${acct_table} (AcctSessionId, UserName,  \
 
40
         NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
 
41
         AcctSessionTime, AcctTerminateCause) VALUES                 \
 
42
         ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
 
43
         '%{Framed-IP-Address}', '0', '%S', '%{Acct-Session-Time}',  \
 
44
         '%{Acct-Terminate-Cause}');"
 
45
        Alive = "INSERT INTO ${acct_table} (AcctSessionId, UserName, \
 
46
         NASIPAddress, FramedIPAddress, AcctStartTime, AcctStopTime, \
 
47
         AcctSessionTime, AcctTerminateCause) VALUES                 \
 
48
         ('%{Acct-Session-Id}', '%{User-Name}', '%{NAS-IP-Address}', \
 
49
         '%{Framed-IP-Address}', '0', '0', '%{Acct-Session-Time}','');"
 
50
 
 
51
        Post-Auth = "INSERT INTO ${postauth_table}                   \
 
52
         (username, pass, reply, authdate) VALUES                    \
 
53
         ('%{User-Name}', '%{User-Password:-Chap-Password}',         \
 
54
         '%{reply:Packet-Type}', '%S');"
 
55
}
 
56