/*
* Print data as integer, not as VALUE.
*/
-static size_t xlat_integer(void *instance, REQUEST *request,
+static size_t xlat_integer(UNUSED void *instance, REQUEST *request,
char *fmt, char *out, size_t outlen,
- RADIUS_ESCAPE_STRING func)
+ UNUSED RADIUS_ESCAPE_STRING func)
{
VALUE_PAIR *vp;
while (isspace((int) *fmt)) fmt++;
- if (!radius_get_vp(request, fmt, &vp)) {
+ if (!radius_get_vp(request, fmt, &vp) || !vp) {
*out = '\0';
return 0;
}
/*
* Print data as string, if possible.
*/
-static size_t xlat_string(void *instance, REQUEST *request,
- char *fmt, char *out, size_t outlen,
- RADIUS_ESCAPE_STRING func)
+static size_t xlat_string(UNUSED void *instance, REQUEST *request,
+ char *fmt, char *out, size_t outlen,
+ UNUSED RADIUS_ESCAPE_STRING func)
{
int len;
VALUE_PAIR *vp;
if (!radius_get_vp(request, fmt, &vp)) goto nothing;
+ if (!vp) goto nothing;
+
if (vp->type != PW_TYPE_OCTETS) goto nothing;
*out++ = '"';
- len = fr_print_string(vp->vp_octets, vp->length, out + 1, outlen - 3);
+ len = fr_print_string(vp->vp_strvalue, vp->length, out + 1, outlen - 3);
out[len] = '"';
out[len + 1] = '\0';
RADIUS_ESCAPE_STRING func)
{
int do_length = 0;
- char *xlat_name, *xlat_string;
+ char *xlat_name, *xlat_str;
char *p, *q, *l, *next = NULL;
int retlen=0;
const xlat_t *c;
* or regex reference.
*/
if (!xlat_name) {
- xlat_name = xlat_string = p;
+ xlat_name = xlat_str = p;
goto do_xlat;
}
RDEBUG2("WARNING: Deprecated conditional expansion \":-\". See \"man unlang\" for details");
p++;
- xlat_string = xlat_name;
+ xlat_str = xlat_name;
next = p;
goto do_xlat;
}
*/
/* module name, followed by (possibly) per-module string */
- xlat_string = p;
+ xlat_str = p;
do_xlat:
if ((c = xlat_find(xlat_name)) != NULL) {
if (!c->internal) RDEBUG3("radius_xlat: Running registered xlat function of module %s for string \'%s\'",
- c->module, xlat_string);
- retlen = c->do_xlat(c->instance, request, xlat_string,
+ c->module, xlat_str);
+ retlen = c->do_xlat(c->instance, request, xlat_str,
q, freespace, func);
if (retlen > 0) {
if (do_length) {