virtual server and clients from sql
Norbert Wegener
norbert.wegener at siemens.com
Tue Jul 8 09:44:25 CEST 2008
Alan DeKok wrote:
> Norbert Wegener wrote:
>
>> where those changes alone did not seem to help...
>>
>
> See raddb/sql/mysql/nas.sql
>
> The field name is "server", not "virtual_server". And it's commented
> out by default.
>
>
>> So in 2.0.5 something seems to be missing.....
>>
>
> The SQL tables have to be updated to contain the right information,
> too. Once that's done, and the queries updated, it should work.
>
I took today's cvs/git, modified the nas table:
mysql> select * from nas;
+----+-----------------+-----------+-------+-------+------------+--------+-----------+----------------+
| id | nasname | shortname | type | ports | secret | server
| community | description |
+----+-----------------+-----------+-------+-------+------------+--------+-----------+----------------+
| 1 | 149.246.185.169 | testbox | linux | 123 | testing123 | cisco
| none | no description |
+----+-----------------+-----------+-------+-------+------------+--------+-----------+----------------+
1 row in set (0.00 sec)
Modified nas_query:
{"nas_query", PW_TYPE_STRING_PTR,
offsetof(SQL_CONFIG,nas_query), NULL, "SELECT
id,nasname,shortname,type,secret,server FROM nas"},
rebuild the server.
...
rlm_sql (sql) in generate_sql_clients: query is SELECT id, nasname,
shortname, type, secret FROM nas^M
rlm_sql (sql): Reserving sql socket id: 4^M
rlm_sql (sql): Read entry
nasname=149.246.185.169,shortname=testbox,secret=testing123^M
rlm_sql (sql): Adding client 149.246.185.169 (testbox, server=<none>) to
clients list^M
so the server does not seem to arrive.
So I changed in rlm_sql.c:
/* NAS query isn't xlat'ed */
/*strlcpy(querystr, inst->config->nas_query, sizeof(querystr));*/
strlcpy(querystr, "SELECT
id,nasname,shortname,type,secret,server FROM nas", sizeof(querystr));
Which is probably not how it is expected to be done, but it works:
....
rlm_sql (sql) in generate_sql_clients: query is SELECT
id,nasname,shortname,type,secret,server FROM nas
rlm_sql (sql): Reserving sql socket id: 4
rlm_sql (sql): Read entry
nasname=149.246.185.169,shortname=testbox,secret=testing123
rlm_sql (sql): Adding client 149.246.185.169 (testbox, server=cisco) to
clients list
rlm_sql (sql): Released sql socket id: 4
Norbert Wegener
> Alan DeKok.
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>
More information about the Freeradius-Users
mailing list