update to some SQL activities

Alan Buxey A.L.M.Buxey at lboro.ac.uk
Mon Oct 12 13:48:33 CEST 2009


hi,

I noted recently that the postgres schema has 2 extra fields in its postauth table..
very usful if used...so heres a small patch to ensure that the values get populated
in the postauth call (if used) and likewise adjustment to the MySQL side of things
so these 2 engines can do the same things.....

diff --git a/raddb/sql/mysql/dialup.conf b/raddb/sql/mysql/dialup.conf
index 6020196..c7b80a0 100644
--- a/raddb/sql/mysql/dialup.conf
+++ b/raddb/sql/mysql/dialup.conf
@@ -294,9 +294,11 @@
        #######################################################################

        postauth_query = "INSERT INTO ${postauth_table} \
-                          (username, pass, reply, authdate) \
+                          (username, pass, reply, calledstationid, callingstationid, authdate) \
                           VALUES ( \
                           '%{User-Name}', \
                           '%{%{User-Password}:-%{Chap-Password}}', \
-                          '%{reply:Packet-Type}', '%S')"
+                          '%{reply:Packet-Type}', \
+                          '%{Called-Station-Id}', '%{Calling-Station-Id}', \
+                          '%S')"

diff --git a/raddb/sql/mysql/schema.sql b/raddb/sql/mysql/schema.sql
index 0634584..40df808 100644
--- a/raddb/sql/mysql/schema.sql
+++ b/raddb/sql/mysql/schema.sql
@@ -129,6 +129,8 @@ CREATE TABLE radpostauth (
   username varchar(64) NOT NULL default '',
   pass varchar(64) NOT NULL default '',
   reply varchar(32) NOT NULL default '',
+  calledstationid varchar(50) NOT NULL default '',
+  callingstationid varchar(50) NOT NULL default '',
   authdate timestamp NOT NULL,
   PRIMARY KEY  (id)
 ) ;
diff --git a/raddb/sql/ndb/schema.sql b/raddb/sql/ndb/schema.sql
index 9016bc2..a97f9c5 100644
--- a/raddb/sql/ndb/schema.sql
+++ b/raddb/sql/ndb/schema.sql
@@ -131,6 +131,8 @@ CREATE TABLE radpostauth (
   username varchar(64) NOT NULL default '',
   pass varchar(64) NOT NULL default '',
   reply varchar(32) NOT NULL default '',
+  calledstationid varchar(50) NOT NULL default '',
+  callingstationid varchar(50) NOT NULL default '',
   authdate timestamp NOT NULL,
   PRIMARY KEY  (id)
 ) ENGINE=ndbcluster;
diff --git a/raddb/sql/postgresql/dialup.conf b/raddb/sql/postgresql/dialup.conf
index 144d7f8..fb2a252 100644
--- a/raddb/sql/postgresql/dialup.conf
+++ b/raddb/sql/postgresql/dialup.conf
@@ -278,6 +278,6 @@ group_membership_query = "SELECT GroupName FROM ${usergroup_table} WHERE UserNam
 #######################################################################
 # postauth_query                - Insert some info after authentication
 #######################################################################
-postauth_query = "INSERT INTO ${postauth_table} (username, pass, reply, authdate) \
-  VALUES ('%{User-Name}', '%{%{User-Password}:-Chap-Password}', '%{reply:Packet-Type}', NOW())"
+postauth_query = "INSERT INTO ${postauth_table} (username, pass, reply, calledstationid, callingstationid, authdate) \
+  VALUES ('%{User-Name}', '%{%{User-Password}:-Chap-Password}','%{reply:Packet-Type}','%{Called-Station-Id}','%{Calling-Station-Id}', NOW())"





More information about the Freeradius-Devel mailing list