nas-list from db vs. vserver
Hi, we found a small issue, when reading the naslist/client-list from a sql-db, it's not possible to get the vserver-name like in the clients.conf. Here's small patch whitch solves the problem: --- rlm_sql.c.orig 2008-04-28 11:49:06.000000000 +0200 +++ rlm_sql.c 2008-04-28 11:49:11.000000000 +0200 @@ -221,6 +221,7 @@ RADCLIENT *c; char *prefix_ptr = NULL; unsigned int i = 0; + int numf = 0; DEBUG("rlm_sql (%s): Processing generate_sql_clients", inst->config->xlat_name); @@ -254,6 +255,7 @@ * 2. Shortname * 3. Type * 4. Secret + * 5. Virtual Server (optional) */ if (!row[0]){ radlog(L_ERR, "rlm_sql (%s): No row id found on pass %d",inst->config->xlat_name,i); @@ -322,16 +324,21 @@ } /* - * Other values (secret, shortname, nastype) + * Other values (secret, shortname, nastype, virtual_server) */ c->secret = strdup(row[4]); c->shortname = strdup(row[2]); if(row[3] != NULL) c->nastype = strdup(row[3]); - DEBUG("rlm_sql (%s): Adding client %s (%s) to clients list", + numf = (inst->module->sql_num_fields)(sqlsocket, inst->config); + if (numf > 5) + if (row[5] != NULL) + c->server = strdup(row[5]); + + DEBUG("rlm_sql (%s): Adding client %s (%s, server=%s) to clients list", inst->config->xlat_name, - c->longname,c->shortname); + c->longname,c->shortname, c->server ? c->server : "<none>"); if (!client_add(NULL, c)) { DEBUG("rlm_sql (%s): Failed to add client %s (%s) to clients list. Maybe there's a duplicate?", inst->config->xlat_name, the NASquery could then look like: nas_query = "SELECT id, nasname, shortname, type, secret, virtual_server FROM ${nas_table}" The additional vserver field is optional, so it's backwards-compatible. any chance to get it commited? thanx, bye, Michi
Michael Bretterklieber wrote:
we found a small issue, when reading the naslist/client-list from a sql-db, it's not possible to get the vserver-name like in the clients.conf. Here's small patch whitch solves the problem:
Thanks.
any chance to get it commited?
Yes. Can you add it as an attachment, or post it to bugs.freeradius.org? When the patch is sent in-line to the list, it gets mangled... this makes easy patching impossible. Alan DeKok.
THANX! Alan DeKok wrote:
Michael Bretterklieber wrote:
see attachement
Added, thanks.
I've also updated the default schemas to note that it's possible to refer to a virtual server.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
participants (2)
-
Alan DeKok -
Michael Bretterklieber