Merge pull request #1316 from jpereira/debug/map
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 9 Oct 2015 00:35:53 +0000 (20:35 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 9 Oct 2015 00:35:53 +0000 (20:35 -0400)
Adding #ifdef DEBUG_MAP for map_dump()

doc/ChangeLog
src/main/mainconfig.c

index a30963b..6ecbac1 100644 (file)
@@ -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
index 3046906..fca7221 100644 (file)
@@ -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);