mainly for edit assignments and debug outputs.
Note that %pairs.print() will still print all of the data, even if
they're secret. And any error messages will still print the data
if (WIFEXITED(status)) {
status = WEXITSTATUS(status);
if (status != 0) {
- RERROR("Program returned code (%d) and output \"%pV\"", status,
+ RERROR("Program returned code (%d) and output %pV", status,
fr_box_strvalue_len(answer, len));
} else {
- RDEBUG2("Program returned code (%d) and output \"%pV\"", status,
+ RDEBUG2("Program returned code (%d) and output %pV", status,
fr_box_strvalue_len(answer, len));
}
return;
}
- fprintf(fp, "tmpl_t %s (%.8x) \"%pV\" (%p)\n",
+ fprintf(fp, "tmpl_t %s (%.8x) %pV (%p)\n",
tmpl_type_to_str(vpt->type),
vpt->type,
fr_box_strvalue_len(vpt->name, vpt->len), vpt);
switch (box->type) {
case FR_TYPE_QUOTED:
- RDEBUG2("%s %s \"%pV\"", attr, fr_tokens[op], box);
+ RDEBUG2("%s %s %pR", attr, fr_tokens[op], box);
break;
case FR_TYPE_INTERNAL:
break;
}
- RDEBUG2("%s %s %pV", attr, fr_tokens[op], box);
+ RDEBUG2("%s %s %pR", attr, fr_tokens[op], box);
break;
}
}
relative = (fr_pair_parse_t) { };
if (fr_pair_list_afrom_substr(&root, &relative, &FR_SBUFF_IN(box->vb_strvalue, box->vb_length)) < 0) {
- RPEDEBUG("Failed parsing string '%pV' as attribute list", box);
+ RPEDEBUG("Failed parsing string %pV as attribute list", box);
return -1;
}
fr_value_box_clear_value(&state->value->data);
if (fr_value_box_cast(state->value, &state->value->data, state->value->vp_type, state->value->da, box) < 0) {
- RDEBUG("Failed casting 'foreach' iteration variable '%s' from %pV", state->value->da->name, box);
+ RPEDEBUG("Failed casting 'foreach' iteration variable '%s' from %pV", state->value->da->name, box);
goto next;
}
next:
if (fr_value_box_cast(state->value, &state->value->data, state->value->vp_type, state->value->da, box) < 0) {
- RDEBUG("Failed casting 'foreach' iteration variable '%s' from %pV", state->value->da->name, box);
+ RPEDEBUG("Failed casting 'foreach' iteration variable '%s' from %pV", state->value->da->name, box);
box = fr_dcursor_next(&state->cursor);
if (!box) goto done;
}
#ifndef NDEBUG
- RDEBUG2("# looping with: %s = %pV", state->value->da->name, &vp->data);
+ RDEBUG2("# looping with: %s = %pR", state->value->da->name, &vp->data);
#endif
}
if (!vp) return -1;
if (fr_value_box_cast(vp, &vp->data, vp->data.type, vp->da, value) < 0) {
- RPEDEBUG("Failed casting \"%pV\" for attribute %s", value, vp->da->name);
+ RPEDEBUG("Failed casting %pR for attribute %s", value, vp->da->name);
talloc_free(vp);
return -1;
}
switch (in_vb->type) {
default:
error:
- RPEDEBUG("Failed converting %pV (%s) to an integer", in_vb,
+ RPEDEBUG("Failed converting %pR (%s) to an integer", in_vb,
fr_type_to_str(in_vb->type));
talloc_free(in_vb);
return XLAT_ACTION_FAIL;
a = fr_value_box_list_head(args);
b = fr_value_box_list_next(args, a);
- RDEBUG2("| (%pV %s %pV)", a, fr_tokens[node->call.func->token], b);
+ RDEBUG2("| (%pR %s %pR)", a, fr_tokens[node->call.func->token], b);
#ifndef NDEBUG
if (a && b) {
a = fr_value_box_list_next(args, b);
if (a) {
- RDEBUG2("| ... ??? %pV", a);
+ RDEBUG2("| ... ??? %pR", a);
fr_assert(0);
}
}
if (!RDEBUG_ENABLED2) return;
- RDEBUG2("| --> %pV", result);
+ RDEBUG2("| --> %pR", result);
}
static int xlat_arg_stringify(request_t *request, xlat_arg_parser_t const *arg, xlat_exp_t const *node, fr_value_box_t *vb)
fr_dcursor_next(out); /* Wind to the start of this functions output */
if (node->call.func) {
- RDEBUG2("| --> %pV", fr_dcursor_current(out));
+ RDEBUG2("| --> %pR", fr_dcursor_current(out));
if (!xlat_process_return(request, node->call.func, (fr_value_box_list_t *)out->dlist,
fr_dcursor_current(out))) return XLAT_ACTION_FAIL;
}
rcode = fr_value_calc_binary_op(dst, dst, default_type, a, op, b);
if (rcode < 0) {
- RPEDEBUG("Failed calculating '%pV %s %pV'", a, fr_tokens[op], b);
+ RPEDEBUG("Failed calculating '%pR %s %pR'", a, fr_tokens[op], b);
talloc_free(dst);
return XLAT_ACTION_FAIL;
}
ssize_t len;
if (vb->type != FR_TYPE_OCTETS) {
- RWDEBUG("Skipping value \"%pV\", expected value of type %s, got type %s",
+ RWDEBUG("Skipping value \"%pR\", expected value of type %s, got type %s",
vb,
fr_type_to_str(FR_TYPE_OCTETS),
fr_type_to_str(vb->type));
* FIXME - Produce proper error with marker
*/
if (!xr_rules->allow_unresolved) {
- fr_strerror_printf("Failed resolving function \"%pV\"",
+ fr_strerror_printf("Failed resolving function %pV",
fr_box_strvalue_buffer(node->fmt));
return -1;
}
* subst types
*/
switch (*(p + 1)) {
+ case 'R':
+ /*
+ * If the caller explicitly asks to suppress secrets via '%pR', then we
+ * do that.
+ */
+ suppress_secrets = true;
+ FALL_THROUGH;
+
case 'V':
{
fr_value_box_t const *in = va_arg(ap_q, fr_value_box_t const *);
- fr_sbuff_escape_rules_t const *e_rules = NULL;
-
- /*
- * Value boxes get escaped as double-quoted strings.
- */
- e_rules = &fr_value_escape_double;
/*
* Allocations that are not part of the output
subst = talloc_typed_strdup(NULL, "<<< secret >>>");
} else if (in) {
- fr_value_box_aprint(NULL, &subst, in, e_rules);
+ /*
+ * Value boxes get escaped as double-quoted strings.
+ */
+ fr_value_box_aprint(NULL, &subst, in, &fr_value_escape_double);
+
} else {
subst = talloc_typed_strdup(NULL, "(null)");
}