From c9de352b7f7c5690ddf4d07b7ca7268df96466e7 Mon Sep 17 00:00:00 2001 From: Jorge Pereira Date: Thu, 8 Oct 2015 19:39:48 -0300 Subject: [PATCH] Fix issue where field nas_type would not be accessible via the %{client:} xlat, for clients loaded from SQL. --- doc/ChangeLog | 2 ++ src/main/mainconfig.c | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index a30963b9b17..6ecbac18d10 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -2,6 +2,8 @@ FreeRADIUS 3.0.11 Mon 05 Oct 2015 15:00:00 EDT urgency=medium Feature improvements Bug fixes + * Fix issue where field nas_type would not be accessible via + the %{client:} xlat, for clients loaded from SQL. FreeRADIUS 3.0.10 Mon 05 Oct 2015 15:00:00 EDT urgency=medium Feature improvements diff --git a/src/main/mainconfig.c b/src/main/mainconfig.c index 3046906cb83..fca72214466 100644 --- a/src/main/mainconfig.c +++ b/src/main/mainconfig.c @@ -384,12 +384,15 @@ static ssize_t xlat_client(UNUSED void *instance, REQUEST *request, char const * cp = cf_pair_find(request->client->cs, fmt); if (!cp || !(value = cf_pair_value(cp))) { - if (strcmp(fmt, "shortname") == 0) { - strlcpy(out, request->client->shortname, outlen); - return strlen(out); + if (strcmp(fmt, "shortname") == 0 && request->client->shortname) { + value = request->client->shortname; + } + else if (strcmp(fmt, "nas_type") == 0 && request->client->nas_type) { + value = request->client->nas_type; + } else { + *out = '\0'; + return 0; } - *out = '\0'; - return 0; } strlcpy(out, value, outlen); -- 2.47.3