diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2015-12-30 18:12:19 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2015-12-30 20:37:55 +0000 |
commit | 9aa35e9ce70bb9bf61e4e4dbc7089e49eeded1b3 (patch) | |
tree | 46f6fc29a2223f01dc60872723ec8f3d14d75629 /src | |
parent | f4d091fbe1f4cc0a6a7c11c174eaca32402290ec (diff) |
New expansion operator base64d, and base64 as synonym for str2b64. Bug 1746
Diffstat (limited to 'src')
-rw-r--r-- | src/src/expand.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/src/expand.c b/src/src/expand.c index d707c2cdb..fad8cc7c7 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -201,6 +201,8 @@ static uschar *op_table_main[] = { US"addresses", US"base62", US"base62d", + US"base64", + US"base64d", US"domain", US"escape", US"eval", @@ -241,6 +243,8 @@ enum { EOP_ADDRESSES, EOP_BASE62, EOP_BASE62D, + EOP_BASE64, + EOP_BASE64D, EOP_DOMAIN, EOP_ESCAPE, EOP_EVAL, @@ -6883,12 +6887,27 @@ while (*s != 0) /* Convert string to base64 encoding */ case EOP_STR2B64: + case EOP_BASE64: { uschar *encstr = b64encode(sub, Ustrlen(sub)); yield = string_cat(yield, &size, &ptr, encstr, Ustrlen(encstr)); continue; } + case EOP_BASE64D: + { + uschar *s; + int len = b64decode(sub, &s); + if (len < 0) + { + expand_string_message = string_sprintf("string \"%s\" is not " + "well-formed for \"%s\" operator", sub, name); + goto EXPAND_FAILED; + } + yield = string_cat(yield, &size, &ptr, s, Ustrlen(s)); + continue; + } + /* strlen returns the length of the string */ case EOP_STRLEN: |