Don't add From: or Reply-To: to quota warning messages if they are
[users/heiko/exim.git] / test / scripts / 0000-Basic / 0002
1 # Common string expansions
2 #
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.
7
8 exim -be
9
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.
13
14 # Some fixed variables
15
16 exim_path: $exim_path
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
22 unknown: ${unknown}
23 h_subject: $h_subject:(should be empty)
24 h_subject:$h_subject (should be empty)
25 header in curlies: ${header_subject:} (should fail)
26
27 # \$message_headers should be empty
28 message_headers: >$message_headers<
29
30 # Continuation
31 x\
32 y
33 x\
34              y
35
36 # Overlong names and overbig numbers
37
38 +$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
39 +${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
40 +$11111111111111111111111111111111111
41 +${11111111111111111111111111111111111}
42
43 # Operators
44
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ò}
50 eval:   ${eval:1+1}
51 eval:   ${eval:1+2*3}
52 eval:   ${eval:(1+2)*3}
53 eval:   ${eval:3/2*4}
54 eval:   ${eval:3*4/2}
55 eval:   ${eval:42}
56 eval:   ${eval:}
57 eval:   ${eval:-2}
58 eval:   ${eval:-2 - -3}
59 eval:   ${eval:-2 - (-3)}
60 eval:   ${eval:-2 - (-3}
61 eval:   ${eval:-2 - -3)}
62 eval:   ${eval:-2 --3}
63 eval:   ${eval:-2 -+3}
64 eval:   ${eval:-2 -+-3}
65 eval:   ${eval:(2*(1+1))/2 + 40K}
66 eval:   ${eval:077}
67 eval:   ${eval:08}
68 eval10: ${eval10:077}
69 eval10: ${eval10:08}
70 expand: \$primary_hostname ${expand:\$primary_hostname}
71 hash:   ${hash_3:monty} ${hash_5:monty} ${hash_4_62:monty python}
72 hash:   ${hash_3:abc}X ${hash_3:ab}X ${hash_3:a}X ${hash_3:}X
73 hex2b64:${hex2b64:12345678}
74 hex2b64:${hex2b64:abcdef}
75 hex2b64:${hex2b64:ABCDEF}
76 hex2b64:${hex2b64:1a2b3c4d5e6f}
77 hex2b64:${hex2b64:1a2b3c4d5e6}
78 hex2b64:${hex2b64:1a2b3c4d5e6g}
79 hex2b64:${hex2b64:${md5:the quick brown fox}}
80 hex2b64:${hex2b64:${sha1:the quick brown fox}}
81
82 The base62 operator is actually a base36 operator in the Darwin and Cygwin
83 environments. Write cunning tests that produce the same output in both cases,
84 while doing a reasonable check.
85
86 base62:  ${if or {\
87                  {eq {${base62:12345}}{0003D7}}\
88                  {eq {${base62:12345}}{0009IX}}\
89                  }{OK}{NOT OK}} 
90 base62d: ${if or {\
91                  {eq {${base62d:0003D7}}{12345}}\
92                  {eq {${base62d:0009IX}}{12345}}\
93                  }{OK}{NOT OK}} 
94 base62d: ${if or {\
95                  {eq {${base62d:3D7}}{12345}}\
96                  {eq {${base62d:9IX}}{12345}}\
97                  }{OK}{NOT OK}} 
98 base62 error: ${base62:12345x}
99 base62d error:${base62d:0003D7.}
100
101 hmac:   ${hmac{md5}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
102 hmac:   ${hmac{sha1}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
103 md5:    ${md5:the quick brown fox jumps over the lazy dog}
104 sha1:   ${sha1:}
105 sha1:   ${sha1:abc}
106 mask:   ${mask:192.168.10.206/28}
107 mask:   ${mask:192.168.10.206/32}
108 mask:   ${mask:192.168.10.206/33}
109 mask:   ${mask:192.168.10.206/0}
110 mask:   ${mask:192.168.10.206}
111 mask:   ${mask:a.b.c.d}
112 nhash:  ${nhash_24:monty} ${nhash_8_63:monty python}
113 lc/uc:  ${lc:The Quick} ${uc: Brown Fox}
114 length: ${length_10:The quick brown fox} ${l_10:abc}
115 lclpt:  ${local_part:local-part@dom.ain}
116 lclpt:  ${local_part:Exim Person <local-part@dom.ain> (that's me)}
117 quote:  ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef}
118 quote:  ${quote:nl(\n)}
119 quote:  ${quote:cr(\r)}
120 quote:  ${quote:tab(\t)}
121 quote:  ${quote:xff(\xff)}
122 quote:  Empty>${quote:}<
123 quote_local_part: ${quote_local_part:abcd}
124 quote_local_part: ${quote_local_part:O'Reilly}
125 quote_local_part: ${quote_local_part:a space}
126 quote_local_part: ${quote_local_part:.something}
127 quote_local_part: ${quote_local_part:something.}
128 quote_local_part: ${quote_local_part:joe.bloggs}
129 quote_local_part: ${quote_local_part:a!b}
130 quote_local_part: ${quote_local_part:x@y}
131 quote_local_part: ${quote_local_part:ab*cd}
132 quote_local_part: ${quote_local_part:x:y}
133 quote_local_part: ${quote_local_part:ab\cd"ef}
134 quote_local_part: ${quote_local_part:}
135 rxquote:${rxquote:aZ09_,-Q} ${rxquote:ab*cd} ${rxquote:ab\cd"ef}
136 substr: ${substr_3_2:rhubarb} ${s_-5_2:1234567} ${s_-5_2:12} ${s_-3_2:12}
137 substr: ${s_3:rhubarb} ${s_-2:rhubarb}
138 substr: ${s_1:}
139 substr: ${substr_10:abc}
140 str2b64:${str2b64:abcd}
141 str2b64:${str2b64:The quick brown \n fox}
142 strlen: ${strlen:}
143 strlen: ${strlen:a}
144 strlen: ${strlen:abcdefgh}
145 time_interval: ${time_interval:0}
146 time_interval: ${time_interval:44}
147 time_interval: ${time_interval:999999}
148 time_interval: ${time_interval:-1}
149 time_interval: ${time_interval:rhubarb}
150
151 # stat is a bit tricky, but some of the fields of the aux-var directory
152 # should be the same on all systems
153
154 stat:   ${extract{mode}{${stat:DIR/aux-var}}}
155 stat:   ${extract{smode}{${stat:DIR/aux-var}}}
156 stat:   ${stat:/a/non/existent/file}
157
158 # "Operators" that have expanded arguments
159
160 hash:   ${hash{3}{monty}} ${hash{5}{monty}} ${hash{4}{62}{monty python}}
161 hash:   ${hash{3}{abc}}X ${hash{3}{ab}}X ${hash{3}{a}}X ${hash{3}{}}X
162 nhash:  ${nhash{24}{monty}} ${nhash{8}{63}{monty python}}
163 length: ${length{10}{The quick brown fox}} ${length{10}{abc}}
164 substr: ${substr{3}{2}{rhubarb}} ${substr{-5}{2}{1234567}} ${substr{-5}{2}{12}} ${substr{-3}{2}{12}}
165 substr: ${substr{${if eq{1}{1}{-8}}}{${if eq{1}{0}{25}{1}}}{abcde}}
166
167 # Error forms
168
169 ${hash{one}}
170 ${hash{nonnumber}{abcd}}
171 ${hash{3}{2}{4}{abcd}}
172 ${substr{-3}{-2}{abcd}}
173
174 # Skipped operators
175
176 addrss: ${if eq {1}{2}{${address:invalid}}{NO}}
177 domain: ${if eq {1}{2}{${domain:invalid}}{NO}}
178 escape: ${if eq {1}{2}{${escape:invalid}}{NO}}
179 expand: ${if eq {1}{2}{\$primary_hostname ${expand:\$invalid}}{NO}}
180 hash:   ${if eq {1}{2}{${hash_3:invalid}}{NO}}
181 md5:    ${if eq {1}{2}{${md5:invalid}}{NO}}
182 mask:   ${if eq {1}{2}{${mask:invalid}}{NO}}
183
184 # Conditions
185
186 2=2:    ${if ={2}{2}{y}{n}}
187 2==2:   ${if =={2}{2}{y}{n}}
188 3=2:    ${if ={3}{2}{y}{n}}
189 2==3:   ${if =={2}{3}{y}{n}}
190 !2=2:   ${if !={2}{2}{y}{n}}
191 !2==2:  ${if !=={2}{2}{y}{n}}
192 !3=2:   ${if !={3}{2}{y}{n}}
193 !2==3:  ${if !=={2}{3}{y}{n}}
194 2>3:    ${if >{2}{3}{y}{n}}
195 3>3:    ${if >{3}{3}{y}{n}}
196 4>3:    ${if >{4}{3}{y}{n}}
197 2>=3:   ${if >={2}{3}{y}{n}}
198 3>=3:   ${if >={3}{3}{y}{n}}
199 4>=3:   ${if >={4}{3}{y}{n}}
200 2<3:    ${if <{2}{3}{y}{n}}
201 3<3:    ${if <{3}{3}{y}{n}}
202 4<3:    ${if <{4}{3}{y}{n}}
203 2<=3:   ${if <={2}{3}{y}{n}}
204 3<=3:   ${if <={3}{3}{y}{n}}
205 4<=3:   ${if <={4}{3}{y}{n}}
206 5<=3:   ${if <={ 5 } { 3 } {y}{n}}
207
208 5>3k:   ${if >{5 } {3k }{y}{n}}
209 5>3m:   ${if >{5 } {3m }{y}{n}}
210 5>3z:   ${if >{5 } {3z }{y}{n}}
211 5>a:    ${if >{ 5 } {a}{y}{n}}
212
213 def:y   ${if def:tod_log{y}{n}}
214 def:n   ${if def:host{y}{n}}
215 def:f   ${if def:post{y}{n}}
216 def:h_f ${if def:h_xxx {y}{n}}
217 def:h_f ${if def:h_xxx:{y}{n}}
218 def:d:  ${if def:tod_log:{y}{n}}
219
220 exists: ${if exists{/etc/passwd}{y}{n}}
221 exists: ${if exists{/doesnt}{y}{n}}
222
223 eq:     ${if eq{abc}{abc}{y}{n}}
224 eq:     ${if eq{abc}{xyz}{y}{n}}
225 !eq:    ${if !eq{abc}{abc}{y}{n}}
226 !eq:    ${if !eq{abc}{xyz}{y}{n}}
227
228 eqi:    ${if eqi{abc}{abc}{y}{n}}
229 eqi:    ${if eqi{abc}{ABC}{y}{n}}
230 eqi:    ${if eqi{abc}{xyz}{y}{n}}
231 !eqi:   ${if !eqi{abc}{abc}{y}{n}}
232 !eqi:   ${if !eqi{abc}{aBc}{y}{n}}
233 !eqi:   ${if !eqi{abc}{xyz}{y}{n}}
234
235 lt:     ${if lt{ABC}{abc}{y}{n}}
236 lti:    ${if lti{ABC}{abc}{y}{n}}
237 le:     ${if le{ABC}{abc}{y}{n}}
238 lei:    ${if lei{ABC}{abc}{y}{n}}
239 gt:     ${if gt{ABC}{abc}{y}{n}}
240 gti:    ${if gti{ABC}{abc}{y}{n}}
241 ge:     ${if ge{ABC}{abc}{y}{n}}
242 gei:    ${if gei{ABC}{abc}{y}{n}}
243
244 isip:   ${if isip {1.2.3.4}{y}{n}}  1.2.3.4
245 isip4:  ${if isip4{1.2.3.4}{y}{n}}  1.2.3.4
246 isip6:  ${if isip6{1.2.3.4}{y}{n}}  1.2.3.4
247 isip:   ${if isip {1:2:3:4}{y}{n}}  1:2:3:4
248 isip4:  ${if isip4{1:2:3:4}{y}{n}}  1:2:3:4
249 isip6:  ${if isip6{1:2:3:4}{y}{n}}  1:2:3:4
250 isip:   ${if isip {::1}{y}{n}}      ::1
251 isip4:  ${if isip4{::1}{y}{n}}      ::1
252 isip6:  ${if isip6{::1}{y}{n}}      ::1
253 isip:   ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}}  fe80::a00:20ff:fe86:a061
254 isip4:  ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}}  fe80::a00:20ff:fe86:a061
255 isip6:  ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}}  fe80::a00:20ff:fe86:a061
256 isip:   ${if isip {rhubarb}{y}{n}}  rhubarb
257 isip4:  ${if isip4{rhubarb}{y}{n}}  rhubarb
258 isip6:  ${if isip6{rhubarb}{y}{n}}  rhubarb
259
260 match:  ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
261 match:  ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
262 match:  ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail}
263 match:  ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail}
264 match:  ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail}
265
266 match_domain:    ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
267 match_domain:    ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}}
268 match_domain:    ${if match_domain{5.aa.bb}{+dlist}{yes}{no}}
269 match_domain:    ${if match_domain{xxxyz}{+dlist}{yes}{no}}
270 match_domain:    ${if match_domain{xyz}{+dlist}{yes}{no}}
271
272 match_address:   ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}}
273 match_address:   ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}}
274
275 match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}}
276 match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}}
277
278 match_ip:        01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}}
279 match_ip:        02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}}
280 match_ip:        03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}}
281 match_ip:        04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}}
282 match_ip:        05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}}
283 match_ip:        06 ${if match_ip{1.2.3.4}{:4.5.6.7}}
284 match_ip:        07 ${if match_ip{}{:4.5.6.7}}
285 match_ip:        08 ${if match_ip{V4NET.11.12.13}{+hlist}}
286 match_ip:        09 ${if match_ip{V4NET.11.12.14}{+hlist}}
287 match_ip:        10 ${if match_ip{192.168.3.4}{+hlist}}
288 match_ip:        11 ${if match_ip{somename}{+hlist}}
289 match_ip:        12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
290 match_ip:        13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
291 match_ip:        14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
292
293 queue_running:  ${if queue_running{y}{n}}
294 first_delivery: ${if first_delivery{y}{n}}
295
296 queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}}
297 first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}}
298
299 # Default values for both if strings
300
301 \${if eq{1}{1}}  >${if eq{1}{1}}<
302 \${if eq{1}{2}}  >${if eq{1}{2}}<
303
304 # Lookups: DIR is the testing directory. In this test we can only use the
305 # lookups that are required in all cases.
306
307 ${lookup{postmaster}lsearch{DIR/aux-fixed/0002.aliases}{$value}fail}
308
309 ${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
310 ${lookup{x@z}lsearch*{DIR/aux-fixed/0002.starat}{$value}fail}
311 ${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
312 ${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
313
314 ${lookup{a.b.c.d}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
315 ${lookup{x.y.z}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
316 ${lookup{p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
317 ${lookup{o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
318 ${lookup{m.n.o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
319 ${lookup{x.y.z}partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
320 ${lookup{x.y.z}partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
321
322 q1:  ${lookup{abc}lsearch{DIR/aux-fixed/0002.quoted}}
323 q2:  ${lookup{xyz}lsearch{DIR/aux-fixed/0002.quoted}}
324 q3:  ${lookup{pqr}lsearch{DIR/aux-fixed/0002.quoted}}
325 q4:  ${lookup{a:b}lsearch{DIR/aux-fixed/0002.quoted}}
326 q5:  ${lookup{"quoted"}lsearch{DIR/aux-fixed/0002.quoted}}
327 q6:  ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}}
328 q7:  ${lookup{b\\s}lsearch{DIR/aux-fixed/0002.quoted}}
329
330 abc:   ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}}
331 a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}}
332 ab.c:  ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}}
333 xyz:   ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}}
334 Xyz:   ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}}
335 Zyz:   ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}}
336 a b:   ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
337 a  b:  ${lookup{a  b}wildlsearch{DIR/aux-var/0002.wild}}
338 a:b:   ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}}
339 a.b:   ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}}
340 a..b:  ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}}
341 a9b:   ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}}
342 a99b:  ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}}
343
344 # Should give the same results as above because expansion does nothing
345
346 abc:   ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}}
347 a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}}
348 ab.c:  ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}}
349 xyz:   ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}}
350 Xyz:   ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}}
351 Zyz:   ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}}
352 a b:   ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
353 a  b:  ${lookup{a  b}nwildlsearch{DIR/aux-var/0002.wild}}
354 a:b:   ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}}
355
356 # Should fail because of no expansion
357
358 a.b:   ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
359 a..b:  ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
360 a9b:   ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
361 a99b:  ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
362
363 # But these should succeed
364
365 a\\:b:  ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
366 a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}
367
368 # IP address (CIDR) lookups
369
370 1.2.3.4:      ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}
371 1.2.3.5:      ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}}
372 1.2.3.5:      ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}}
373 abcd::cdab:   ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}}
374 192.168.1.2:  ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}}
375 192.168.5.6:  ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}}
376 abcd:abcd::   ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
377 abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
378 abcd:abcd::3  ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}}
379 rhubarb       ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}}
380
381
382 # Nested Lookups - style 1
383
384 ${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
385 ${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
386
387 # Nested Lookups - style 2
388
389 ${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
390 ${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
391
392 # Other nesting tests
393
394 ${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}}}
395 ${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}}}
396 ${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}}}
397 ${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}}}
398
399 # Lookup quotes for standardly expected lookups
400
401 lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
402 xxx     ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
403
404 # Extract
405
406 ${extract{B}{A=1 B=2 C=3}}
407 ${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}}
408 ${extract{2}{:}{1:2:3}}
409 ${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}}
410 Empty:<${extract{D}{A=1 B=2 C=3}}>
411 Empty:<${extract{4}{:}{1:2:3}}>
412 ${extract{C}{A=1 B=2 C=3}{<$value>}}
413 ${extract{3}{:}{1:2:3}{<$value>}}
414 Empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}>
415 Empty:<${extract{4}{:}{1:2:3}{<$value>}}>
416 ${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}}
417 ${extract{4}{:}{1:2:3}{<$value>}{no 4}}
418 ${extract{Z}{A=1 B=2 C=3}{<$value>}fail}
419 ${extract{4}{:}{1:2:3}{<$value>}fail}
420 ${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}}
421 ${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}}
422 ${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}}
423 ${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}}
424 ${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}}
425 ${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}}
426 ${extract{-3}{:,}{a,,b::c}}
427 ${extract{2}{:,}{a,,b::c}}
428 ${extract{3}{:,}{a,,b::c}}
429 ${extract{a-b}{X = "one two" a-b "three four" 5=99}}
430 ${extract{}{X=3}}
431 ${extract{ }{X=3}}
432 ${extract{ 2 }{ }{a b c}}
433
434 # Translation
435
436 abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}}
437 abcdea a   z   ${tr{abcdea}{a}{z}}
438 abcdea a       ${tr{abcdea}{a}{}}
439 abcdea abc z   ${tr{abcdea}{abc}{z}}
440
441 # RFC 2047
442
443 abcd      ${rfc2047:abcd}
444 <:abcd:>  ${rfc2047:<:abcd:>}
445 <:ab cd:> ${rfc2047:<:ab cd:>}
446 Long:     ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
447 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}
448
449
450 # UTF-8
451
452 abcd      ${from_utf8:abcd}
453 aÀÿd      ${from_utf8:aÃ\80ÿd}
454 toobig    ${from_utf8:aĀd}
455
456 # Substitution
457
458 \${sg{abcdefabcdef}{abc}{xyz}}          =${sg{abcdefabcdef}{abc}{xyz}}
459 \${sg{ab:xy::z}{:}{::}}                 =${sg{ab:xy::z}{:}{::}}
460 \${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}    =${sg{abcdefabcdef}{(..)[^c]}{>$1<}}
461 \${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}}   =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}
462 \${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}
463 \${sg{abbab}{a*}{+}}                    =${sg{abbab}{a*}{+}}
464
465 # File insertion
466
467 ${readfile}
468 ${readfile{DIR/aux-fixed/0002.readfile}}
469 ${readfile{DIR/aux-fixed/0002.readfile}{}}
470 ${readfile{DIR/aux-fixed/0002.readfile}{:}}
471 ${readfile{DIR/aux-fixed/0002.readfile}{ - }}
472 ${readfile{/non/exist/file}}
473 ${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}}
474 >${readfile{DIR/aux-fixed/0002.readfile}{!}}\
475     <
476
477 # Calling a command
478
479 ${run{DIR/aux-fixed/0002.runfile 0}}
480 RC=$runrc
481 ${run{DIR/aux-fixed/0002.runfile 0}{1}{2}}
482 RC=$runrc
483 ${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}}
484 RC=$runrc
485 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}}
486 RC=$runrc
487 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}}
488 RC=$runrc
489 ${run{DIR/test-nonexist}{Y}{N}}
490 RC=$runrc
491 >>${run{DIR/bin/iefbr14}}<<
492 RC=$runrc
493 ${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
494 RC=$runrc
495
496 # PRVS
497
498 ${prvs{userx@test.ex}{secret}}
499 ${prvs{userx@test.ex}{secret}{1}}
500 ${prvs{userx@test.ex}{secret}{8}}
501
502 # Syntax errors
503
504 ${prvs{userx@test.ex}{secret}{12}}
505 ${prvs{userx@test.ex}{secret}{rhubarb}}
506 ${prvs{userx@test.ex}{secret}{}}
507
508 # Correct checks; can't put explicit addresses in the tests, because they
509 # will change over time. 
510
511 ${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}}
512 result=$prvscheck_result
513
514 ${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\
515 {>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}}
516 result=$prvscheck_result
517
518 ${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}}
519 result=$prvscheck_result
520
521 # Incorrect secret
522
523 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}}
524 result=$prvscheck_result
525
526 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}}
527 result=$prvscheck_result
528
529 # Non-prvs address
530
531 >>${prvscheck{userx@test.ex}{secret}}<<
532 result=$prvscheck_result
533
534 # Syntax errors
535
536 ${tod_log
537 ${tod_log+6
538 ${expand:abcd
539 ${expand:abcd${tod_log}
540 ${hmac{xxx}{a}{b}}
541 ${if and {xyz}{a}{b}}
542 ${if and {{xya}}{a}{b}}
543 ${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}}
544 ${if eq {$h_xyz}{1}{y}{n}}
545 ${if or {eq {}{}{yes}{no}}
546 ${if or {{eq {}{}{yes}{no}}
547 ${if or {{eq {}{}}{yes}{no}}
548 ${substr_1_:12345}
549 ${substr__3:12345}
550
551 # Miscellaneous (for bug fixes, etc)
552
553 ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
554
555 ****
556 # Test "escape" with print_topbitchars
557 exim -be -DPTBC=print_topbitchars
558 escape: ${escape:B7·F2ò}
559 ****
560 # Checkout expansion debugging
561 exim -d-all+expand -be
562 primary_hostname: $primary_hostname
563 match:  ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
564 match:  ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
565 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
566 match_address:   ${if match_address{a.b.c}{a.b.c}{yes}{no}}
567 ****
568 # Sender host name and address etc, all unset
569 exim -be
570 -oMa  sender_host_address = $sender_host_address
571       sender_host_port = $sender_host_port
572 -oMaa sender_host_authenticated = $sender_host_authenticated
573 -oMai authenticated_id = $authenticated_id
574 -oMas authenticated_sender = $authenticated_sender
575 -oMi  interface_address = $interface_address
576       interface_port = $interface_port
577 -oMr  received_protocol = $received_protocol
578 -oMs  sender_host_name = $sender_host_name
579 -oMt  sender_ident = $sender_ident
580 ****
581 # Sender host name and address etc, all set except host name.
582 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
583 -oMa  sender_host_address = $sender_host_address
584       sender_host_port = $sender_host_port
585 -oMaa sender_host_authenticated = $sender_host_authenticated
586 -oMai authenticated_id = $authenticated_id
587 -oMas authenticated_sender = $authenticated_sender
588 -oMi  interface_address = $interface_address
589       interface_port = $interface_port
590 -oMr  received_protocol = $received_protocol
591 -oMt  sender_ident = $sender_ident
592 ****
593 # Sender host name explicitly set
594 exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name
595 -oMa  sender_host_address = $sender_host_address
596       sender_host_port = $sender_host_port
597 -oMs  sender_host_name = $sender_host_name
598 ****
599 # Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
600 exim -be -oMa V4NET.11.12.13
601 -oMs  sender_host_name = $sender_host_name
602       host_lookup_failed = $host_lookup_failed
603 ****
604 # Sender host name and protocol set by Sendmail-compatible option
605 exim -be -pspecial:host.name
606 -p  received_protocol = $received_protocol
607 -p  sender_host_name = $sender_host_name
608 ****
609 # Sender host name and address etc, all set except host name,
610 # which should therefore be looked up from the address, but not if
611 # we are skipping. The debug output for this test will show when
612 # the lookup occurs.
613 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
614 -oMa  sender_host_address = $sender_host_address
615       sender_host_port = $sender_host_port
616 -oMaa sender_host_authenticated = $sender_host_authenticated
617 -oMai authenticated_id = $authenticated_id
618 -oMas authenticated_sender = $authenticated_sender
619 -oMi  interface_address = $interface_address
620       interface_port = $interface_port
621 -oMr  received_protocol = $received_protocol
622 ----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}}
623 -oMs  sender_host_name = $sender_host_name
624 -oMt  sender_ident = $sender_ident
625 ****
626 # Test no auto host name lookup for query-style lookups
627 exim -d -bh V4NET.0.0.1
628 ****
629 exim -d -bh V4NET.0.0.2
630 ****
631 # Test $reply_address
632 exim -bh V4NET.0.0.0
633 mail from:<>
634 rcpt to:<some@body>
635 data
636 .
637 mail from:<>
638 rcpt to:<some@body>
639 data
640 From: a@b
641 .
642 mail from:<>
643 rcpt to:<some@body>
644 data
645 From: a@b
646 Reply-to: c@d
647 .
648 mail from:<>
649 rcpt to:<some@body>
650 data
651 Reply-to:
652 .
653 mail from:<>
654 rcpt to:<some@body>
655 data
656 Reply-to:
657 From: x@y
658 .
659 quit
660 ****
661 # Check RFC 2047 decoding with (default) length check
662 exim -bh V4NET.0.0.0
663 mail from:<>
664 rcpt to:<some@body>
665 data
666 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?=
667 .
668 quit
669 ****
670 # Check RFC 2047 decoding with length check disabled
671 exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0
672 mail from:<>
673 rcpt to:<some@body>
674 data
675 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?=
676 .
677 quit
678 ****