Skip to content

Commit

Permalink
%% is a LITERAL, not a PERCENT expansion
Browse files Browse the repository at this point in the history
PERCENT expansions are escaped.  LITERALs are not.
  • Loading branch information
alandekok committed Mar 19, 2014
1 parent f4c1478 commit 8c830c6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/xlat.c
Expand Up @@ -1239,11 +1239,17 @@ static ssize_t xlat_tokenize_literal(TALLOC_CTX *ctx, char *fmt, xlat_exp_t **he
return - (p - fmt);
}

XLAT_DEBUG("PERCENT: %s --> %c", node->fmt, p[1]);
next = talloc_zero(node, xlat_exp_t);
next->fmt = p + 1;
next->len = 1;
next->type = XLAT_PERCENT;

if (p[1] == '%') {
XLAT_DEBUG("LITERAL: %s --> %c", node->fmt, p[1]);
next->type = XLAT_LITERAL;
} else {
XLAT_DEBUG("PERCENT: %s --> %c", node->fmt, p[1]);
next->type = XLAT_PERCENT;
}

node->next = next;
*p = '\0';
Expand Down

0 comments on commit 8c830c6

Please sign in to comment.