Alan DeKok wrote:
Joe Maimon wrote:
It doesnt work with Home-Server-Pool, but it does work with Proxy-To-Realm.
Hmm... what does that mean? If you put the "update" section inside of an "if" statement that never matches... it won't work.
The Home-Server-Pool code *should* work in 2.1.7. I can double-check it tomorrow.
src/main/acct.c needed a patch to handle PW_HOME_SERVER_POOL similar to PW_PROXY_TO_REALM Seems like it is working, but I am still testing. My patch duplicates the LOCAL functionality, but is that purposeless? #! /bin/sh /usr/share/dpatch/dpatch-run ## 440-proxy-home-server-pool.dpatch by <joe@debian09> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad freeradius-server~/src/main/acct.c freeradius-server/src/main/acct.c --- freeradius-server~/src/main/acct.c 2009-09-24 16:38:44.000000000 -0400 +++ freeradius-server/src/main/acct.c 2009-09-24 16:38:47.000000000 -0400 @@ -122,6 +122,29 @@ * Maybe one of the preacct modules has decided * that a proxy should be used. */ + + if ((vp = pairfind(request->config_items, PW_HOME_SERVER_POOL))) { + home_pool_t *home_pool; + + /* + * Check whether Home-Server-Pool is + * a LOCAL pool. + */ + home_pool = home_pool_byname(vp->vp_strvalue, HOME_TYPE_ACCT); + if (home_pool && !home_pool->servers) { + DEBUG("rad_accounting: Cancelling proxy to home_pool %s, as it is a LOCAL home pool.", + home_pool->name); + pairdelete(&request->config_items, PW_HOME_SERVER_POOL); + } else { + /* + * Don't reply to the NAS now because + * we have to send the proxied packet + * before that. + */ + return result; + } + } + if ((vp = pairfind(request->config_items, PW_PROXY_TO_REALM))) { REALM *realm; diff -urNad freeradius-server~/src/main/realms.c freeradius-server/src/main/realms.c --- freeradius-server~/src/main/realms.c 2009-09-24 16:38:44.000000000 -0400 +++ freeradius-server/src/main/realms.c 2009-09-24 16:39:31.000000000 -0400 @@ -932,7 +932,8 @@ } } - if (num_home_servers == 0) { + /* LOCAL pools have no servers */ + if (num_home_servers == 0 && strcmp(name2, "LOCAL")) { cf_log_err(cf_sectiontoitem(cs), "No home servers defined in pool %s", name2); @@ -1468,6 +1469,11 @@ mypool.name = name; mypool.server_type = server_type; + if (strcmp(name, "LOCAL") == 0) { + cf_log_err(cf_sectiontoitem(cs), "\"%s\" pool cannot be used with realms", name); + return 0; + } + pool = rbtree_finddata(home_pools_byname, &mypool); if (!pool) { CONF_SECTION *pool_cs; @@ -1728,10 +1734,15 @@ static int pool_peek_type(CONF_SECTION *config, CONF_SECTION *cs) { int home; - const char *name, *type; + const char *name, *name2, *type; CONF_PAIR *cp; CONF_SECTION *server_cs; + name2 = cf_section_name2(cs); + if (name2 && strcmp(name2, "LOCAL") == 0) { + /* LOCAL Home server pool has no home_server */ + return HOME_TYPE_AUTH; + } cp = cf_pair_find(cs, "home_server"); if (!cp) { cf_log_err(cf_sectiontoitem(cs), "Pool does not contain a \"home_server\" entry");