Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix issue where field nas_type would not be accessible via
the %{client:} xlat, for clients loaded from SQL.
  • Loading branch information
jpereira authored and arr2036 committed Oct 8, 2015
1 parent 663c281 commit c34c748
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/mainconfig.c
Expand Up @@ -385,11 +385,15 @@ static ssize_t xlat_client(char **out, size_t outlen,

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;
}
return 0;
}

strlcpy(*out, value, outlen);
Expand Down

0 comments on commit c34c748

Please sign in to comment.