Update the default configuration to specify sql-group in a saner way.
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 Jun 2015 18:54:41 +0000 (14:54 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 26 Jun 2015 18:54:58 +0000 (14:54 -0400)
raddb/mods-available/sql
raddb/mods-config/sql/main/mysql/queries.conf
raddb/mods-config/sql/main/postgresql/queries.conf
raddb/mods-config/sql/main/sqlite/queries.conf
src/tests/modules/sql_mysql/module.conf
src/tests/modules/sql_postgresql/module.conf
src/tests/modules/sql_sqlite/module.conf

index a005045..272d7d0 100644 (file)
@@ -230,6 +230,18 @@ sql {
        # Table to keep radius client info
        client_table = "nas"
 
+       #
+       # The group attribute specific to this instance of rlm_sql
+       #
+
+       # This entry should be used for additional instances (sql foo {})
+       # of the SQL module.
+#      group_attr = "${.:instance}-SQL-Group"
+
+       # This entry should be used for the default instance (sql {})
+       # of the SQL module.
+       group_attr = "SQL-Group"
+
        # Read database-specific queries
        $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf
 }
index 8268abd..ecd2f32 100644 (file)
@@ -141,14 +141,14 @@ authorize_group_check_query = "\
        SELECT id, groupname, attribute, \
        Value, op \
        FROM ${groupcheck_table} \
-       WHERE groupname = '%{Sql-Group}' \
+       WHERE groupname = '%{${group_attr}}' \
        ORDER BY id"
 
 authorize_group_reply_query = "\
        SELECT id, groupname, attribute, \
        value, op \
        FROM ${groupreply_table} \
-       WHERE groupname = '%{Sql-Group}' \
+       WHERE groupname = '%{${group_attr}}' \
        ORDER BY id"
 
 #######################################################################
index 8496e49..429814f 100644 (file)
@@ -146,13 +146,13 @@ authorize_reply_query = "\
 authorize_group_check_query = "\
        SELECT id, GroupName, Attribute, Value, op \
        FROM ${groupcheck_table} \
-       WHERE GroupName = '%{Sql-Group}' \
+       WHERE GroupName = '%{${group_attr}}' \
        ORDER BY id"
 
 authorize_group_reply_query = "\
        SELECT id, GroupName, Attribute, Value, op \
        FROM ${groupreply_table} \
-       WHERE GroupName = '%{Sql-Group}' \
+       WHERE GroupName = '%{${group_attr}}' \
        ORDER BY id"
 
 #######################################################################
index 320604f..86c1380 100644 (file)
@@ -131,14 +131,14 @@ authorize_group_check_query = "\
        SELECT id, groupname, attribute, \
        Value, op \
        FROM ${groupcheck_table} \
-       WHERE groupname = '%{Sql-Group}' \
+       WHERE groupname = '%{${group_attr}}' \
        ORDER BY id"
 
 authorize_group_reply_query = "\
        SELECT id, groupname, attribute, \
        value, op \
        FROM ${groupreply_table} \
-       WHERE groupname = '%{Sql-Group}' \
+       WHERE groupname = '%{${group_attr}}' \
        ORDER BY id"
 
 #######################################################################
@@ -166,7 +166,7 @@ simul_verify_query = "\
        SELECT radacctid, acctsessionid, username, nasipaddress, nasportid, framedipaddress, \
                callingstationid, framedprotocol \
        FROM ${acct_table1} \
-       WHERE username = '%{SQL-User-Name}' \
+       WHERE username = '%{${group_attr}}' \
        AND acctstoptime IS NULL"
 
 #######################################################################
index 08a3270..6511d9d 100644 (file)
@@ -45,6 +45,9 @@ sql {
        # Table to keep radius client info
        client_table = "nas"
 
+       # The group attribute specific to this instance of rlm_sql
+       group_attr = "SQL-Group"
+
        # Read database-specific queries
        $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf
 }
index 2d2c82c..0b28c11 100644 (file)
@@ -44,6 +44,9 @@ sql {
        # Table to keep radius client info
        client_table = "nas"
 
+       # The group attribute specific to this instance of rlm_sql
+       group_attr = "SQL-Group"
+
        # Read database-specific queries
        $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf
 }
index 2dbeb57..bc5f277 100644 (file)
@@ -44,6 +44,9 @@ sql {
        # Table to keep radius client info
        client_table = "nas"
 
+       # The group attribute specific to this instance of rlm_sql
+       group_attr = "SQL-Group"
+
        # Read database-specific queries
        $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf
 }