* Ensure the format string is valid... At this point
* they should all be talloc'd strings.
*/
- MEM(node = xlat_exp_alloc(ctx, p->type,
- talloc_get_type_abort_const(p->fmt, char), talloc_array_length(p->fmt) - 1));
+ if (p->type == XLAT_ALTERNATE) {
+ /* Alternates don't have format strings */
+ MEM(node = xlat_exp_alloc_null(ctx));
+ xlat_exp_set_type(node, XLAT_ALTERNATE);
+ } else {
+ MEM(node = xlat_exp_alloc(ctx, p->type,
+ talloc_get_type_abort_const(p->fmt, char), talloc_array_length(p->fmt) - 1));
+ }
+
node->quote = p->quote;
node->flags = p->flags;
--- /dev/null
+#
+# PRE:
+#
+
+&Tmp-String-0 := "foo"
+&Tmp-String-1 := "bar"
+
+if (!(%{%(test.passthrough:%{Tmp-String-0}):-%{Tmp-String-1}} == 'foo')) {
+ test_fail
+}
+
+if (!(%{%(test.passthrough:%{Tmp-String-2}):-%{Tmp-String-1}} == 'bar')) {
+ test_fail
+}
+
+if (!(%{%{Tmp-String-0}:-%(test.passthrough:%{Tmp-String-1})} == 'foo')) {
+ test_fail
+}
+
+if (!(%{%{Tmp-String-2}:-%(test.passthrough:%{Tmp-String-1})} == 'bar')) {
+ test_fail
+}
+
+if (!(%{%(test.passthrough:%{Tmp-String-0}):-%(test.passthrough:%{Tmp-String-1})} == 'foo')) {
+ test_fail
+}
+
+if (!(%{%(test.passthrough:%{Tmp-String-2}):-%(test.passthrough:%{Tmp-String-1})} == 'bar')) {
+ test_fail
+}
+
+success