{
switch (node->type) {
case XLAT_LITERAL:
+ case XLAT_CHILD:
return talloc_asprintf(ctx, "%s", node->fmt);
case XLAT_ONE_LETTER:
return result;
}
+
default:
return NULL;
}
*child = node->child;
xa = XLAT_ACTION_PUSH_CHILD;
goto finish;
+
+ case XLAT_CHILD:
+ XLAT_DEBUG("** [%i] %s(child) - %%{%s:...}", unlang_interpret_stack_depth(request), __FUNCTION__,
+ node->fmt);
+
+ /*
+ * Hand back the child node to the caller
+ * for evaluation.
+ */
+ *child = node->child;
+ xa = XLAT_ACTION_PUSH_CHILD;
+ goto finish;
}
}
XLAT_DEBUG("%.*sxlat_aprint LITERAL", lvl, xlat_spaces);
return talloc_typed_strdup(ctx, node->fmt);
+ case XLAT_CHILD:
+ XLAT_DEBUG("%.*sxlat_aprint CHILD", lvl, xlat_spaces);
+ return talloc_typed_strdup(ctx, node->fmt);
+
/*
* Do a one-character expansion.
*/
if (ret < 0) return ret;
break;
+ case XLAT_CHILD:
+ if (!type || (type & XLAT_CHILD)) {
+ ret = walker(node, uctx);
+ if (ret < 0) return ret;
+ }
+
+ /*
+ * Evaluate the child.
+ */
+ ret = xlat_eval_walk(node->child, walker, type, uctx);
+ if (ret < 0) return ret;
+ break;
+
default:
if (!type || (type & node->type)) {
ret = walker(node, uctx);
XLAT_REGEX = 0x20, //!< regex reference
#endif
XLAT_ALTERNATE = 0x40, //!< xlat conditional syntax :-
+ XLAT_CHILD = 0x80 //!< encapsulated string of xlats
} xlat_type_t;
/** An xlat expansion node
RDEBUG3("literal --> %s", node->fmt);
break;
+ case XLAT_CHILD:
+ RDEBUG3("child --> %s", node->fmt);
+ RDEBUG3("{");
+ RINDENT();
+ xlat_tokenize_debug(request, node->child);
+ REXDENT();
+ RDEBUG3("}");
+ break;
+
case XLAT_ONE_LETTER:
RDEBUG3("percent --> %c", node->fmt[0]);
break;
#define CHECK_SPACE(_p, _end) if (_p >= _end) goto oob
while (node) {
- if (node->type == XLAT_LITERAL) {
+ if ((node->type == XLAT_LITERAL) || (node->type == XLAT_CHILD)) {
p += strlcpy(p, node->fmt, end - p);
CHECK_SPACE(p, end);
goto next;