]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
xlat for home server pool state
authorAlan T. DeKok <aland@freeradius.org>
Thu, 10 Mar 2016 16:49:06 +0000 (11:49 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 10 Mar 2016 16:49:27 +0000 (11:49 -0500)
src/main/realms.c

index c70e3bbacbd651d9f136a65e4fffda8b71799f08..e6e48ff60d4504000be7d7024b67be7f25224fb8 100644 (file)
@@ -276,6 +276,20 @@ static ssize_t CC_HINT(nonnull) xlat_server_pool(UNUSED void *instance, REQUEST
                return 0;
        }
 
+       if (strcmp(fmt, "state") == 0) {
+               char const *state;
+
+               if (request->home_pool->in_fallback) {
+                       state = "fallback";
+
+               } else {
+                       state = "alive";
+               }
+
+               strlcpy(out, state, outlen);
+               return strlen(out);
+       }
+
        return xlat_cs(request->home_pool->cs, fmt, out, outlen);
 }
 #endif