1 # Common string expansions
3 # This is the main string expansion test that tests those expansions that will
4 # be present in the basic Exim binary which we require in order to run these
5 # tests at all. Specialized expansion tests also exist for optional features
6 # in other test scripts.
10 # These expansions can test variables in the configuration, but as there
11 # is no message being processed, there is no message-related data. But
12 # that of course gets tested in plenty of other places.
14 # Some fixed variables
17 primary_hostname: $primary_hostname
18 primary_hostname: ${primary_hostname}
19 qualify_domain: $qualify_domain
20 bounce_return_size_limit: ${bounce_return_size_limit}
21 spool_directory: $spool_directory
23 h_subject: $h_subject:(should be empty)
24 h_subject:$h_subject (should be empty)
25 header in curlies: ${header_subject:} (should fail)
27 # \$message_headers should be empty
28 message_headers: >$message_headers<
36 # Overlong names and overbig numbers
38 +$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
39 +${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
40 +$11111111111111111111111111111111111
41 +${11111111111111111111111111111111111}
45 addrss: ${address:local-part@dom.ain}
46 addrss: ${address:Exim Person <local-part@dom.ain> (that's me)}
47 domain: ${domain:local-part@dom.ain}
48 domain: ${domain:Exim Person <local-part@dom.ain> (that's me)}
49 escape: ${escape:B7·F2ò}
59 eval: ${eval:-2 - (-3)}
60 eval: ${eval:-2 - (-3}
61 eval: ${eval:-2 - -3)}
65 eval: ${eval:(2*(1+1))/2 + 40K}
70 eval10: ${eval10:0x1234}
73 eval: ${eval:0xc & 5 }
77 eval: ${eval:0xc >> 2}
78 eval: ${eval:0xc >> 4 }
80 eval: ${eval:~255&0x1234}
81 eval: ${eval:~ 255&0x1234}
82 eval: ${eval: -(~255&0x1234)}
84 expand: \$primary_hostname ${expand:\$primary_hostname}
85 hash: ${hash_3:monty} ${hash_5:monty} ${hash_4_62:monty python}
86 hash: ${hash_3:abc}X ${hash_3:ab}X ${hash_3:a}X ${hash_3:}X
87 hex2b64:${hex2b64:12345678}
88 hex2b64:${hex2b64:abcdef}
89 hex2b64:${hex2b64:ABCDEF}
90 hex2b64:${hex2b64:1a2b3c4d5e6f}
91 hex2b64:${hex2b64:1a2b3c4d5e6}
92 hex2b64:${hex2b64:1a2b3c4d5e6g}
93 hex2b64:${hex2b64:${md5:the quick brown fox}}
94 hex2b64:${hex2b64:${sha1:the quick brown fox}}
96 The base62 operator is actually a base36 operator in the Darwin and Cygwin
97 environments. Write cunning tests that produce the same output in both cases,
98 while doing a reasonable check.
101 {eq {${base62:12345}}{0003D7}}\
102 {eq {${base62:12345}}{0009IX}}\
105 {eq {${base62d:0003D7}}{12345}}\
106 {eq {${base62d:0009IX}}{12345}}\
109 {eq {${base62d:3D7}}{12345}}\
110 {eq {${base62d:9IX}}{12345}}\
112 base62 error: ${base62:12345x}
113 base62d error:${base62d:0003D7.}
115 hmac: ${hmac{md5}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
116 hmac: ${hmac{sha1}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
117 md5: ${md5:the quick brown fox jumps over the lazy dog}
120 mask: ${mask:192.168.10.206/28}
121 mask: ${mask:192.168.10.206/32}
122 mask: ${mask:192.168.10.206/33}
123 mask: ${mask:192.168.10.206/0}
124 mask: ${mask:192.168.10.206}
125 mask: ${mask:a.b.c.d}
126 nhash: ${nhash_24:monty} ${nhash_8_63:monty python}
127 lc/uc: ${lc:The Quick} ${uc: Brown Fox}
128 length: ${length_10:The quick brown fox} ${l_10:abc}
129 lclpt: ${local_part:local-part@dom.ain}
130 lclpt: ${local_part:Exim Person <local-part@dom.ain> (that's me)}
131 quote: ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef}
132 quote: ${quote:nl(\n)}
133 quote: ${quote:cr(\r)}
134 quote: ${quote:tab(\t)}
135 quote: ${quote:xff(\xff)}
136 quote: Empty>${quote:}<
137 quote_local_part: ${quote_local_part:abcd}
138 quote_local_part: ${quote_local_part:O'Reilly}
139 quote_local_part: ${quote_local_part:a space}
140 quote_local_part: ${quote_local_part:.something}
141 quote_local_part: ${quote_local_part:something.}
142 quote_local_part: ${quote_local_part:joe.bloggs}
143 quote_local_part: ${quote_local_part:a!b}
144 quote_local_part: ${quote_local_part:x@y}
145 quote_local_part: ${quote_local_part:ab*cd}
146 quote_local_part: ${quote_local_part:x:y}
147 quote_local_part: ${quote_local_part:ab\cd"ef}
148 quote_local_part: ${quote_local_part:}
149 rxquote:${rxquote:aZ09_,-Q} ${rxquote:ab*cd} ${rxquote:ab\cd"ef}
150 substr: ${substr_3_2:rhubarb} ${s_-5_2:1234567} ${s_-5_2:12} ${s_-3_2:12}
151 substr: ${s_3:rhubarb} ${s_-2:rhubarb}
153 substr: ${substr_10:abc}
154 str2b64:${str2b64:abcd}
155 str2b64:${str2b64:The quick brown \n fox}
158 strlen: ${strlen:abcdefgh}
159 time_eval: ${time_eval:10s}
160 time_eval: ${time_eval:2h}
161 time_eval: ${time_eval:1d5m}
162 time_eval: ${time_eval:1w2d3h4m5s}
163 time_eval: ${time_eval:14}
164 time_eval: ${time_eval:rhubarb}
165 time_interval: ${time_interval:0}
166 time_interval: ${time_interval:44}
167 time_interval: ${time_interval:999999}
168 time_interval: ${time_interval:-1}
169 time_interval: ${time_interval:rhubarb}
171 # stat is a bit tricky, but some of the fields of the aux-var directory
172 # should be the same on all systems
174 stat: ${extract{mode}{${stat:DIR/aux-var}}}
175 stat: ${extract{smode}{${stat:DIR/aux-var}}}
176 stat: ${stat:/a/non/existent/file}
178 # "Operators" that have expanded arguments
180 hash: ${hash{3}{monty}} ${hash{5}{monty}} ${hash{4}{62}{monty python}}
181 hash: ${hash{3}{abc}}X ${hash{3}{ab}}X ${hash{3}{a}}X ${hash{3}{}}X
182 nhash: ${nhash{24}{monty}} ${nhash{8}{63}{monty python}}
183 length: ${length{10}{The quick brown fox}} ${length{10}{abc}}
184 substr: ${substr{3}{2}{rhubarb}} ${substr{-5}{2}{1234567}} ${substr{-5}{2}{12}} ${substr{-3}{2}{12}}
185 substr: ${substr{${if eq{1}{1}{-8}}}{${if eq{1}{0}{25}{1}}}{abcde}}
190 ${hash{nonnumber}{abcd}}
191 ${hash{3}{2}{4}{abcd}}
192 ${substr{-3}{-2}{abcd}}
196 addrss: ${if eq {1}{2}{${address:invalid}}{NO}}
197 domain: ${if eq {1}{2}{${domain:invalid}}{NO}}
198 escape: ${if eq {1}{2}{${escape:invalid}}{NO}}
199 expand: ${if eq {1}{2}{\$primary_hostname ${expand:\$invalid}}{NO}}
200 hash: ${if eq {1}{2}{${hash_3:invalid}}{NO}}
201 md5: ${if eq {1}{2}{${md5:invalid}}{NO}}
202 mask: ${if eq {1}{2}{${mask:invalid}}{NO}}
206 4096M ${if >{1}{4096M}{y}{n}}
207 4096000000 ${if >{1}{4096000000}{y}{n}}
211 2=2: ${if ={2}{2}{y}{n}}
212 2==2: ${if =={2}{2}{y}{n}}
213 3=2: ${if ={3}{2}{y}{n}}
214 2==3: ${if =={2}{3}{y}{n}}
215 !2=2: ${if !={2}{2}{y}{n}}
216 !2==2: ${if !=={2}{2}{y}{n}}
217 !3=2: ${if !={3}{2}{y}{n}}
218 !2==3: ${if !=={2}{3}{y}{n}}
219 2>3: ${if >{2}{3}{y}{n}}
220 3>3: ${if >{3}{3}{y}{n}}
221 4>3: ${if >{4}{3}{y}{n}}
222 1>-1: ${if >{1}{-1}{y}{n}}
223 2>=3: ${if >={2}{3}{y}{n}}
224 3>=3: ${if >={3}{3}{y}{n}}
225 4>=3: ${if >={4}{3}{y}{n}}
226 2<3: ${if <{2}{3}{y}{n}}
227 3<3: ${if <{3}{3}{y}{n}}
228 4<3: ${if <{4}{3}{y}{n}}
229 2<=3: ${if <={2}{3}{y}{n}}
230 3<=3: ${if <={3}{3}{y}{n}}
231 4<=3: ${if <={4}{3}{y}{n}}
232 5<=3: ${if <={ 5 } { 3 } {y}{n}}
233 -3<=1: ${if <={-3}{1}{y}{n}}
235 5>3k: ${if >{5 } {3k }{y}{n}}
236 5>3m: ${if >{5 } {3m }{y}{n}}
237 5>3z: ${if >{5 } {3z }{y}{n}}
238 5>a: ${if >{ 5 } {a}{y}{n}}
240 >0: ${if > {}{0}{y}{n}}
241 =: ${if = {}{}{y}{n}}
242 -2<: ${if < {-2}{}{y}{n}}
243 08>07: ${if > {08}{07}{y}{n}}
244 011=11: ${if = {011}{11}{y}{n}}
246 def:y ${if def:tod_log{y}{n}}
247 def:n ${if def:host{y}{n}}
248 def:f ${if def:post{y}{n}}
249 def:h_f ${if def:h_xxx {y}{n}}
250 def:h_f ${if def:h_xxx:{y}{n}}
251 def:d: ${if def:tod_log:{y}{n}}
253 exists: ${if exists{/etc/passwd}{y}{n}}
254 exists: ${if exists{/doesnt}{y}{n}}
256 eq: ${if eq{abc}{abc}{y}{n}}
257 eq: ${if eq{abc}{xyz}{y}{n}}
258 !eq: ${if !eq{abc}{abc}{y}{n}}
259 !eq: ${if !eq{abc}{xyz}{y}{n}}
261 eqi: ${if eqi{abc}{abc}{y}{n}}
262 eqi: ${if eqi{abc}{ABC}{y}{n}}
263 eqi: ${if eqi{abc}{xyz}{y}{n}}
264 !eqi: ${if !eqi{abc}{abc}{y}{n}}
265 !eqi: ${if !eqi{abc}{aBc}{y}{n}}
266 !eqi: ${if !eqi{abc}{xyz}{y}{n}}
268 lt: ${if lt{ABC}{abc}{y}{n}}
269 lti: ${if lti{ABC}{abc}{y}{n}}
270 le: ${if le{ABC}{abc}{y}{n}}
271 lei: ${if lei{ABC}{abc}{y}{n}}
272 gt: ${if gt{ABC}{abc}{y}{n}}
273 gti: ${if gti{ABC}{abc}{y}{n}}
274 ge: ${if ge{ABC}{abc}{y}{n}}
275 gei: ${if gei{ABC}{abc}{y}{n}}
277 isip: ${if isip {1.2.3.4}{y}{n}} 1.2.3.4
278 isip4: ${if isip4{1.2.3.4}{y}{n}} 1.2.3.4
279 isip6: ${if isip6{1.2.3.4}{y}{n}} 1.2.3.4
280 isip: ${if isip {1:2:3:4}{y}{n}} 1:2:3:4
281 isip4: ${if isip4{1:2:3:4}{y}{n}} 1:2:3:4
282 isip6: ${if isip6{1:2:3:4}{y}{n}} 1:2:3:4
283 isip: ${if isip {::1}{y}{n}} ::1
284 isip4: ${if isip4{::1}{y}{n}} ::1
285 isip6: ${if isip6{::1}{y}{n}} ::1
286 isip: ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
287 isip4: ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
288 isip6: ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
289 isip: ${if isip {rhubarb}{y}{n}} rhubarb
290 isip4: ${if isip4{rhubarb}{y}{n}} rhubarb
291 isip6: ${if isip6{rhubarb}{y}{n}} rhubarb
293 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
294 match: ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
295 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail}
296 match: ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail}
297 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail}
299 match_domain: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
300 match_domain: ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}}
301 match_domain: ${if match_domain{5.aa.bb}{+dlist}{yes}{no}}
302 match_domain: ${if match_domain{xxxyz}{+dlist}{yes}{no}}
303 match_domain: ${if match_domain{xyz}{+dlist}{yes}{no}}
305 ${if match{x@zz.aa.bb}{^(.*)} \
308 ${if match_domain{${domain:$1}}{+dlist}{[$1]}} \
313 ${if match{x@xxxabc}{^(.*)} \
316 ${if match_domain{${domain:$1}}{^\Nxxx(.*)\N}{[$1]}} \
321 match_address: ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}}
322 match_address: ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}}
324 match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}}
325 match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}}
327 match_ip: 01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}}
328 match_ip: 02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}}
329 match_ip: 03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}}
330 match_ip: 04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}}
331 match_ip: 05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}}
332 match_ip: 06 ${if match_ip{1.2.3.4}{:4.5.6.7}}
333 match_ip: 07 ${if match_ip{}{:4.5.6.7}}
334 match_ip: 08 ${if match_ip{V4NET.11.12.13}{+hlist}}
335 match_ip: 09 ${if match_ip{V4NET.11.12.14}{+hlist}}
336 match_ip: 10 ${if match_ip{192.168.3.4}{+hlist}}
337 match_ip: 11 ${if match_ip{somename}{+hlist}}
338 match_ip: 12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
339 match_ip: 13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
340 match_ip: 14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
342 queue_running: ${if queue_running{y}{n}}
343 first_delivery: ${if first_delivery{y}{n}}
345 queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}}
346 first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}}
348 # Default values for both if strings
350 \${if eq{1}{1}} >${if eq{1}{1}}<
351 \${if eq{1}{2}} >${if eq{1}{2}}<
353 # Lookups: DIR is the testing directory. In this test we can only use the
354 # lookups that are required in all cases.
356 ${lookup{postmaster}lsearch{DIR/aux-fixed/0002.aliases}{$value}fail}
358 ${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
359 ${lookup{x@z}lsearch*{DIR/aux-fixed/0002.starat}{$value}fail}
360 ${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
361 ${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
363 ${lookup{a.b.c.d}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
364 ${lookup{x.y.z}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
365 ${lookup{p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
366 ${lookup{o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
367 ${lookup{m.n.o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
368 ${lookup{x.y.z}partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
369 ${lookup{x.y.z}partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
371 q1: ${lookup{abc}lsearch{DIR/aux-fixed/0002.quoted}}
372 q2: ${lookup{xyz}lsearch{DIR/aux-fixed/0002.quoted}}
373 q3: ${lookup{pqr}lsearch{DIR/aux-fixed/0002.quoted}}
374 q4: ${lookup{a:b}lsearch{DIR/aux-fixed/0002.quoted}}
375 q5: ${lookup{"quoted"}lsearch{DIR/aux-fixed/0002.quoted}}
376 q6: ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}}
377 q7: ${lookup{b\\s}lsearch{DIR/aux-fixed/0002.quoted}}
379 abc: ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}}
380 a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}}
381 ab.c: ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}}
382 xyz: ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}}
383 Xyz: ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}}
384 Zyz: ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}}
385 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
386 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
387 a:b: ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}}
388 a.b: ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}}
389 a..b: ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}}
390 a9b: ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}}
391 a99b: ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}}
393 # Should give the same results as above because expansion does nothing
395 abc: ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}}
396 a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}}
397 ab.c: ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}}
398 xyz: ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}}
399 Xyz: ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}}
400 Zyz: ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}}
401 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
402 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
403 a:b: ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}}
405 # Should fail because of no expansion
407 a.b: ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
408 a..b: ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
409 a9b: ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
410 a99b: ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
412 # But these should succeed
414 a\\:b: ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
415 a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}
417 # Some tests of case-(in)dependence
419 MiXeD-CD: ${lookup{MiXeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
420 MixeD-CD: ${lookup{MixeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
421 MiXeD-Ncd: ${lookup{MiXeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
422 MixeD-Ncd: ${lookup{MixeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
424 # IP address (CIDR) lookups
426 1.2.3.4: ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}
427 1.2.3.5: ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}}
428 1.2.3.5: ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}}
429 abcd::cdab: ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}}
430 192.168.1.2: ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}}
431 192.168.5.6: ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}}
432 abcd:abcd:: ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
433 abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
434 abcd:abcd::3 ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}}
435 rhubarb ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}}
438 # Nested Lookups - style 1
440 ${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
441 ${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
443 # Nested Lookups - style 2
445 ${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
446 ${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
448 # Other nesting tests
450 ${lookup{one}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{one}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{one}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
451 ${lookup{two}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{two}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{two}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
452 ${lookup{both}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{both}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{both}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
453 ${lookup{neither}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{neither}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{neither}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
455 # Lookup quotes for standardly expected lookups
457 lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
458 xxx ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
462 ${extract{B}{A=1 B=2 C=3}}
463 ${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}}
464 ${extract{2}{:}{1:2:3}}
465 ${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}}
466 Empty:<${extract{D}{A=1 B=2 C=3}}>
467 Empty:<${extract{4}{:}{1:2:3}}>
468 ${extract{C}{A=1 B=2 C=3}{<$value>}}
469 ${extract{3}{:}{1:2:3}{<$value>}}
470 Empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}>
471 Empty:<${extract{4}{:}{1:2:3}{<$value>}}>
472 ${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}}
473 ${extract{4}{:}{1:2:3}{<$value>}{no 4}}
474 ${extract{Z}{A=1 B=2 C=3}{<$value>}fail}
475 ${extract{4}{:}{1:2:3}{<$value>}fail}
476 ${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}}
477 ${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}}
478 ${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}}
479 ${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}}
480 ${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}}
481 ${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}}
482 ${extract{-3}{:,}{a,,b::c}}
483 ${extract{2}{:,}{a,,b::c}}
484 ${extract{3}{:,}{a,,b::c}}
485 ${extract{a-b}{X = "one two" a-b "three four" 5=99}}
488 ${extract{ 2 }{ }{a b c}}
492 abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}}
493 abcdea a z ${tr{abcdea}{a}{z}}
494 abcdea a ${tr{abcdea}{a}{}}
495 abcdea abc z ${tr{abcdea}{abc}{z}}
500 <:abcd:> ${rfc2047:<:abcd:>}
501 <:ab cd:> ${rfc2047:<:ab cd:>}
502 Long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
503 Long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit by a long way; in fact this one will go over the 150 character limit}
507 ${rfc2047d:abcd abcd}
508 ${rfc2047d:<:abcd:> =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=}
509 ${rfc2047d:<:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=}
510 ${rfc2047d:Long: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit?=}
511 ${rfc2047d:Long: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fac?= =?iso-8859-8?Q?t_this_one_will_go_over_the_150_character_limit?=}
515 abcd ${from_utf8:abcd}
516 aÀÿd ${from_utf8:aÃ
\80ÿd}
517 toobig ${from_utf8:aĀd}
521 \${sg{abcdefabcdef}{abc}{xyz}} =${sg{abcdefabcdef}{abc}{xyz}}
522 \${sg{ab:xy::z}{:}{::}} =${sg{ab:xy::z}{:}{::}}
523 \${sg{abcdefabcdef}{(..)[^c]}{>\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>$1<}}
524 \${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}
525 \${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}
526 \${sg{abbab}{a*}{+}} =${sg{abbab}{a*}{+}}
531 ${readfile{DIR/aux-fixed/0002.readfile}}
532 ${readfile{DIR/aux-fixed/0002.readfile}{}}
533 ${readfile{DIR/aux-fixed/0002.readfile}{:}}
534 ${readfile{DIR/aux-fixed/0002.readfile}{ - }}
535 ${readfile{/non/exist/file}}
536 ${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}}
537 >${readfile{DIR/aux-fixed/0002.readfile}{!}}\
542 ${run{DIR/aux-fixed/0002.runfile 0}}
544 ${run{DIR/aux-fixed/0002.runfile 0}{1}{2}}
546 ${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}}
548 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}}
550 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}}
552 ${run{DIR/test-nonexist}{Y}{N}}
554 >>${run{DIR/bin/iefbr14}}<<
556 ${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
561 ${prvs{userx@test.ex}{secret}}
562 ${prvs{userx@test.ex}{secret}{1}}
563 ${prvs{userx@test.ex}{secret}{8}}
567 ${prvs{userx@test.ex}{secret}{12}}
568 ${prvs{userx@test.ex}{secret}{rhubarb}}
569 ${prvs{userx@test.ex}{secret}{}}
571 # Correct checks; can't put explicit addresses in the tests, because they
572 # will change over time.
574 ${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}}
575 result=$prvscheck_result
577 ${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\
578 {>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}}
579 result=$prvscheck_result
581 ${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}}
582 result=$prvscheck_result
586 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}}
587 result=$prvscheck_result
589 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}}
590 result=$prvscheck_result
594 >>${prvscheck{userx@test.ex}{secret}}<<
595 result=$prvscheck_result
602 ${expand:abcd${tod_log}
604 ${if and {xyz}{a}{b}}
605 ${if and {{xya}}{a}{b}}
606 ${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}}
607 ${if eq {$h_xyz}{1}{y}{n}}
608 ${if eq {$h_xyz:}{1}{y}{n}
609 ${if def:h_xyz}{y}{n}}
610 ${if or {eq {}{}{yes}{no}}
611 ${if or {{eq {}{}{yes}{no}}
612 ${if or {{eq {}{}}{yes}{no}}
616 # Iterations: forany and forall
618 ${if forany{a:b:c}{eq{$item}{a}}{yes}{no}}
619 ${if forany{a:b:c}{eq{$item}{b}}{yes}{no}}
620 ${if forany{a:b:c}{eq{$item}{c}}{yes}{no}}
621 ${if forany {a:b:c} {eq {$item} {z}} {yes} {no}}
622 ${if !forany{a:b:c}{eq{$item}{z}}{yes}{no}}
623 ${if !forany{a:b:c}{eq{$item}{a}}{yes}{no}}
624 ${if forany{}{eq{$item}{a}}{yes}{no}}
625 ${if !forany{}{eq{$item}{a}}{yes}{no}}
626 ${if forany{<, $primary_hostname,foo,bar}{eq{$item}{$primary_hostname}}{yes}{no}}
628 ${if forany{}{yes}{no}}
629 ${if forany{a:b:c}{gt{$item}{a}{yes}{no}}
631 ${if forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
632 ${if forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
633 ${if forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
634 ${if forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
636 ${if !forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
637 ${if !forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
638 ${if !forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
639 ${if !forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
645 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
648 {outer=yes}{outer=no}} item='$item' (unset)
654 {$item: ${if !forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
657 {outer=yes}{outer=no}}
659 # Error inside nest - check message is helpful
663 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}{true}{false}}}\
666 {outer=yes}{outer=no}}
669 # Miscellaneous (for bug fixes, etc)
671 ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
674 # Test "escape" with print_topbitchars
675 exim -be -DPTBC=print_topbitchars
676 escape: ${escape:B7·F2ò}
678 # Checkout expansion debugging
679 exim -d-all+expand -be
680 primary_hostname: $primary_hostname
681 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
682 match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
683 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
684 match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}}
686 # Sender host name and address etc, all unset
688 -oMa sender_host_address = $sender_host_address
689 sender_host_port = $sender_host_port
690 -oMaa sender_host_authenticated = $sender_host_authenticated
691 -oMai authenticated_id = $authenticated_id
692 -oMas authenticated_sender = $authenticated_sender
693 -oMi interface_address = $interface_address
694 interface_port = $interface_port
695 -oMr received_protocol = $received_protocol
696 -oMs sender_host_name = $sender_host_name
697 -oMt sender_ident = $sender_ident
699 # Sender host name and address etc, all set except host name.
700 exim -d-all+expand -be -oMa V4NET.0.0.1.1234 -oMaa AAA -oMai philip -oMas xx@yy.zz -oMi 1.1.1.1.99 -oMr special -oMt me
701 -oMa sender_host_address = $sender_host_address
702 sender_host_port = $sender_host_port
703 -oMaa sender_host_authenticated = $sender_host_authenticated
704 -oMai authenticated_id = $authenticated_id
705 -oMas authenticated_sender = $authenticated_sender
706 -oMi interface_address = $interface_address
707 interface_port = $interface_port
708 -oMr received_protocol = $received_protocol
709 -oMt sender_ident = $sender_ident
711 # Sender host name explicitly set
712 exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name
713 -oMa sender_host_address = $sender_host_address
714 sender_host_port = $sender_host_port
715 -oMs sender_host_name = $sender_host_name
717 # Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
718 exim -be -oMa V4NET.11.12.13
719 -oMs sender_host_name = $sender_host_name
720 host_lookup_failed = $host_lookup_failed
722 # Sender host name and protocol set by Sendmail-compatible option
723 exim -be -pspecial:host.name
724 -p received_protocol = $received_protocol
725 -p sender_host_name = $sender_host_name
727 # Sender host name and address etc, all set except host name,
728 # which should therefore be looked up from the address, but not if
729 # we are skipping. The debug output for this test will show when
731 exim -d-all+host_lookup+expand -be -oMa V4NET.0.0.1.1234 -oMaa AAA -oMai philip -oMas xx@yy.zz -oMi 1.1.1.1.99 -oMr special -oMt me
732 -oMa sender_host_address = $sender_host_address
733 sender_host_port = $sender_host_port
734 -oMaa sender_host_authenticated = $sender_host_authenticated
735 -oMai authenticated_id = $authenticated_id
736 -oMas authenticated_sender = $authenticated_sender
737 -oMi interface_address = $interface_address
738 interface_port = $interface_port
739 -oMr received_protocol = $received_protocol
740 ----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}}
741 -oMs sender_host_name = $sender_host_name
742 -oMt sender_ident = $sender_ident
744 # Test no auto host name lookup for query-style lookups
745 exim -d -bh V4NET.0.0.1
747 exim -d -bh V4NET.0.0.2
749 # Test $reply_address
779 # Check RFC 2047 decoding with (default) length check
784 Subject: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_it_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fact_this_one_will_go_over_the_150_character_limit?=
788 # Check RFC 2047 decoding with length check disabled
789 exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0
793 Subject: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_it_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fact_this_one_will_go_over_the_150_character_limit?=
797 # Certain kind of error
799 match_ip: 15 ${if match_ip{1.2.3.4}{1.2.3}}
800 match_ip: 16 ${if match_ip{1.2.3.4}{1.2.3.4/abc}}