Commit | Line | Data |
---|---|---|
59371ea7 PH |
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} | |
af561417 PH |
70 | eval10: ${eval10:0x1234} |
71 | eval: ${eval:2+42%5} | |
72 | eval: ${eval:0xc&5} | |
73 | eval: ${eval:0xc & 5 } | |
74 | eval: ${eval:0x0c|5} | |
75 | eval: ${eval:0xc^5} | |
76 | eval: ${eval:0xc>>1} | |
77 | eval: ${eval:0xc >> 2} | |
78 | eval: ${eval:0xc >> 4 } | |
79 | eval: ${eval:0xc<<1} | |
80 | eval: ${eval:~255&0x1234} | |
81 | eval: ${eval:~ 255&0x1234} | |
82 | eval: ${eval: -(~255&0x1234)} | |
83 | ||
59371ea7 PH |
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}} | |
95 | ||
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. | |
99 | ||
100 | base62: ${if or {\ | |
101 | {eq {${base62:12345}}{0003D7}}\ | |
102 | {eq {${base62:12345}}{0009IX}}\ | |
103 | }{OK}{NOT OK}} | |
104 | base62d: ${if or {\ | |
105 | {eq {${base62d:0003D7}}{12345}}\ | |
106 | {eq {${base62d:0009IX}}{12345}}\ | |
107 | }{OK}{NOT OK}} | |
108 | base62d: ${if or {\ | |
109 | {eq {${base62d:3D7}}{12345}}\ | |
110 | {eq {${base62d:9IX}}{12345}}\ | |
111 | }{OK}{NOT OK}} | |
112 | base62 error: ${base62:12345x} | |
113 | base62d error:${base62d:0003D7.} | |
114 | ||
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} | |
118 | sha1: ${sha1:} | |
119 | sha1: ${sha1:abc} | |
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} | |
152 | substr: ${s_1:} | |
153 | substr: ${substr_10:abc} | |
154 | str2b64:${str2b64:abcd} | |
155 | str2b64:${str2b64:The quick brown \n fox} | |
156 | strlen: ${strlen:} | |
157 | strlen: ${strlen:a} | |
158 | strlen: ${strlen:abcdefgh} | |
f90d018c PH |
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} | |
59371ea7 PH |
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} | |
170 | ||
171 | # stat is a bit tricky, but some of the fields of the aux-var directory | |
172 | # should be the same on all systems | |
173 | ||
174 | stat: ${extract{mode}{${stat:DIR/aux-var}}} | |
175 | stat: ${extract{smode}{${stat:DIR/aux-var}}} | |
176 | stat: ${stat:/a/non/existent/file} | |
177 | ||
178 | # "Operators" that have expanded arguments | |
179 | ||
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}} | |
186 | ||
187 | # Error forms | |
188 | ||
189 | ${hash{one}} | |
190 | ${hash{nonnumber}{abcd}} | |
191 | ${hash{3}{2}{4}{abcd}} | |
192 | ${substr{-3}{-2}{abcd}} | |
193 | ||
194 | # Skipped operators | |
195 | ||
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}} | |
203 | ||
d45b1de8 PH |
204 | # Numeric overflow |
205 | ||
206 | 4096M ${if >{1}{4096M}{y}{n}} | |
207 | 4096000000 ${if >{1}{4096000000}{y}{n}} | |
208 | ||
59371ea7 PH |
209 | # Conditions |
210 | ||
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}} | |
d45b1de8 | 222 | 1>-1: ${if >{1}{-1}{y}{n}} |
59371ea7 PH |
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}} | |
d45b1de8 | 233 | -3<=1: ${if <={-3}{1}{y}{n}} |
59371ea7 PH |
234 | |
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}} | |
239 | ||
240 | def:y ${if def:tod_log{y}{n}} | |
241 | def:n ${if def:host{y}{n}} | |
242 | def:f ${if def:post{y}{n}} | |
243 | def:h_f ${if def:h_xxx {y}{n}} | |
244 | def:h_f ${if def:h_xxx:{y}{n}} | |
245 | def:d: ${if def:tod_log:{y}{n}} | |
246 | ||
247 | exists: ${if exists{/etc/passwd}{y}{n}} | |
248 | exists: ${if exists{/doesnt}{y}{n}} | |
249 | ||
250 | eq: ${if eq{abc}{abc}{y}{n}} | |
251 | eq: ${if eq{abc}{xyz}{y}{n}} | |
252 | !eq: ${if !eq{abc}{abc}{y}{n}} | |
253 | !eq: ${if !eq{abc}{xyz}{y}{n}} | |
254 | ||
255 | eqi: ${if eqi{abc}{abc}{y}{n}} | |
256 | eqi: ${if eqi{abc}{ABC}{y}{n}} | |
257 | eqi: ${if eqi{abc}{xyz}{y}{n}} | |
258 | !eqi: ${if !eqi{abc}{abc}{y}{n}} | |
259 | !eqi: ${if !eqi{abc}{aBc}{y}{n}} | |
260 | !eqi: ${if !eqi{abc}{xyz}{y}{n}} | |
261 | ||
262 | lt: ${if lt{ABC}{abc}{y}{n}} | |
263 | lti: ${if lti{ABC}{abc}{y}{n}} | |
264 | le: ${if le{ABC}{abc}{y}{n}} | |
265 | lei: ${if lei{ABC}{abc}{y}{n}} | |
266 | gt: ${if gt{ABC}{abc}{y}{n}} | |
267 | gti: ${if gti{ABC}{abc}{y}{n}} | |
268 | ge: ${if ge{ABC}{abc}{y}{n}} | |
269 | gei: ${if gei{ABC}{abc}{y}{n}} | |
270 | ||
271 | isip: ${if isip {1.2.3.4}{y}{n}} 1.2.3.4 | |
272 | isip4: ${if isip4{1.2.3.4}{y}{n}} 1.2.3.4 | |
273 | isip6: ${if isip6{1.2.3.4}{y}{n}} 1.2.3.4 | |
274 | isip: ${if isip {1:2:3:4}{y}{n}} 1:2:3:4 | |
275 | isip4: ${if isip4{1:2:3:4}{y}{n}} 1:2:3:4 | |
276 | isip6: ${if isip6{1:2:3:4}{y}{n}} 1:2:3:4 | |
277 | isip: ${if isip {::1}{y}{n}} ::1 | |
278 | isip4: ${if isip4{::1}{y}{n}} ::1 | |
279 | isip6: ${if isip6{::1}{y}{n}} ::1 | |
280 | isip: ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061 | |
281 | isip4: ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061 | |
282 | isip6: ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061 | |
283 | isip: ${if isip {rhubarb}{y}{n}} rhubarb | |
284 | isip4: ${if isip4{rhubarb}{y}{n}} rhubarb | |
285 | isip6: ${if isip6{rhubarb}{y}{n}} rhubarb | |
286 | ||
287 | match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail} | |
288 | match: ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail} | |
289 | match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail} | |
290 | match: ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail} | |
291 | match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail} | |
292 | ||
293 | match_domain: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}} | |
294 | match_domain: ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}} | |
295 | match_domain: ${if match_domain{5.aa.bb}{+dlist}{yes}{no}} | |
296 | match_domain: ${if match_domain{xxxyz}{+dlist}{yes}{no}} | |
297 | match_domain: ${if match_domain{xyz}{+dlist}{yes}{no}} | |
298 | ||
f78eb7c6 PH |
299 | ${if match{x@zz.aa.bb}{^(.*)} \ |
300 | { \ | |
301 | >$1< \ | |
302 | ${if match_domain{${domain:$1}}{+dlist}{[$1]}} \ | |
303 | >$1< \ | |
304 | } \ | |
305 | { CAN'T HAPPEN}} | |
306 | ||
307 | ${if match{x@xxxabc}{^(.*)} \ | |
308 | { \ | |
309 | >$1< \ | |
310 | ${if match_domain{${domain:$1}}{^\Nxxx(.*)\N}{[$1]}} \ | |
311 | >$1< \ | |
312 | } \ | |
313 | { CAN'T HAPPEN}} | |
314 | ||
59371ea7 PH |
315 | match_address: ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}} |
316 | match_address: ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}} | |
317 | ||
318 | match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}} | |
319 | match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}} | |
320 | ||
321 | match_ip: 01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}} | |
322 | match_ip: 02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}} | |
323 | match_ip: 03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}} | |
324 | match_ip: 04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}} | |
325 | match_ip: 05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}} | |
326 | match_ip: 06 ${if match_ip{1.2.3.4}{:4.5.6.7}} | |
327 | match_ip: 07 ${if match_ip{}{:4.5.6.7}} | |
328 | match_ip: 08 ${if match_ip{V4NET.11.12.13}{+hlist}} | |
329 | match_ip: 09 ${if match_ip{V4NET.11.12.14}{+hlist}} | |
330 | match_ip: 10 ${if match_ip{192.168.3.4}{+hlist}} | |
331 | match_ip: 11 ${if match_ip{somename}{+hlist}} | |
332 | match_ip: 12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}} | |
333 | match_ip: 13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}} | |
334 | match_ip: 14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}} | |
335 | ||
336 | queue_running: ${if queue_running{y}{n}} | |
337 | first_delivery: ${if first_delivery{y}{n}} | |
338 | ||
339 | queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}} | |
340 | first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}} | |
341 | ||
342 | # Default values for both if strings | |
343 | ||
344 | \${if eq{1}{1}} >${if eq{1}{1}}< | |
345 | \${if eq{1}{2}} >${if eq{1}{2}}< | |
346 | ||
347 | # Lookups: DIR is the testing directory. In this test we can only use the | |
348 | # lookups that are required in all cases. | |
349 | ||
350 | ${lookup{postmaster}lsearch{DIR/aux-fixed/0002.aliases}{$value}fail} | |
351 | ||
352 | ${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail} | |
353 | ${lookup{x@z}lsearch*{DIR/aux-fixed/0002.starat}{$value}fail} | |
354 | ${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail} | |
355 | ${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail} | |
356 | ||
357 | ${lookup{a.b.c.d}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail} | |
358 | ${lookup{x.y.z}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}} | |
359 | ${lookup{p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail} | |
360 | ${lookup{o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail} | |
361 | ${lookup{m.n.o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail} | |
362 | ${lookup{x.y.z}partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail} | |
363 | ${lookup{x.y.z}partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail} | |
364 | ||
365 | q1: ${lookup{abc}lsearch{DIR/aux-fixed/0002.quoted}} | |
366 | q2: ${lookup{xyz}lsearch{DIR/aux-fixed/0002.quoted}} | |
367 | q3: ${lookup{pqr}lsearch{DIR/aux-fixed/0002.quoted}} | |
368 | q4: ${lookup{a:b}lsearch{DIR/aux-fixed/0002.quoted}} | |
369 | q5: ${lookup{"quoted"}lsearch{DIR/aux-fixed/0002.quoted}} | |
370 | q6: ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}} | |
371 | q7: ${lookup{b\\s}lsearch{DIR/aux-fixed/0002.quoted}} | |
372 | ||
373 | abc: ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}} | |
374 | a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}} | |
375 | ab.c: ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}} | |
376 | xyz: ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}} | |
377 | Xyz: ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}} | |
378 | Zyz: ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}} | |
379 | a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}} | |
380 | a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}} | |
381 | a:b: ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}} | |
382 | a.b: ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}} | |
383 | a..b: ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}} | |
384 | a9b: ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}} | |
385 | a99b: ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}} | |
386 | ||
387 | # Should give the same results as above because expansion does nothing | |
388 | ||
389 | abc: ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}} | |
390 | a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}} | |
391 | ab.c: ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}} | |
392 | xyz: ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}} | |
393 | Xyz: ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}} | |
394 | Zyz: ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}} | |
395 | a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}} | |
396 | a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}} | |
397 | a:b: ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}} | |
398 | ||
399 | # Should fail because of no expansion | |
400 | ||
401 | a.b: ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}} | |
402 | a..b: ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}} | |
403 | a9b: ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}} | |
404 | a99b: ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}} | |
405 | ||
406 | # But these should succeed | |
407 | ||
408 | a\\:b: ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}} | |
409 | a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}} | |
410 | ||
366fc9f0 PH |
411 | # Some tests of case-(in)dependence |
412 | ||
413 | MiXeD-CD: ${lookup{MiXeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}} | |
414 | MixeD-CD: ${lookup{MixeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}} | |
415 | MiXeD-Ncd: ${lookup{MiXeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}} | |
416 | MixeD-Ncd: ${lookup{MixeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}} | |
417 | ||
59371ea7 PH |
418 | # IP address (CIDR) lookups |
419 | ||
420 | 1.2.3.4: ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
421 | 1.2.3.5: ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
422 | 1.2.3.5: ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}} | |
423 | abcd::cdab: ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
424 | 192.168.1.2: ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
425 | 192.168.5.6: ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
426 | abcd:abcd:: ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
427 | abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
428 | abcd:abcd::3 ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
429 | rhubarb ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}} | |
430 | ||
431 | ||
432 | # Nested Lookups - style 1 | |
433 | ||
434 | ${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail} | |
435 | ${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail} | |
436 | ||
437 | # Nested Lookups - style 2 | |
438 | ||
439 | ${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}} | |
440 | ${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}} | |
441 | ||
442 | # Other nesting tests | |
443 | ||
444 | ${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}}} | |
445 | ${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}}} | |
446 | ${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}}} | |
447 | ${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}}} | |
448 | ||
449 | # Lookup quotes for standardly expected lookups | |
450 | ||
451 | lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm} | |
452 | xxx ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm} | |
453 | ||
454 | # Extract | |
455 | ||
456 | ${extract{B}{A=1 B=2 C=3}} | |
457 | ${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}} | |
458 | ${extract{2}{:}{1:2:3}} | |
459 | ${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}} | |
460 | Empty:<${extract{D}{A=1 B=2 C=3}}> | |
461 | Empty:<${extract{4}{:}{1:2:3}}> | |
462 | ${extract{C}{A=1 B=2 C=3}{<$value>}} | |
463 | ${extract{3}{:}{1:2:3}{<$value>}} | |
464 | Empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}> | |
465 | Empty:<${extract{4}{:}{1:2:3}{<$value>}}> | |
466 | ${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}} | |
467 | ${extract{4}{:}{1:2:3}{<$value>}{no 4}} | |
468 | ${extract{Z}{A=1 B=2 C=3}{<$value>}fail} | |
469 | ${extract{4}{:}{1:2:3}{<$value>}fail} | |
470 | ${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}} | |
471 | ${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}} | |
472 | ${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}} | |
473 | ${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}} | |
474 | ${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}} | |
475 | ${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}} | |
476 | ${extract{-3}{:,}{a,,b::c}} | |
477 | ${extract{2}{:,}{a,,b::c}} | |
478 | ${extract{3}{:,}{a,,b::c}} | |
479 | ${extract{a-b}{X = "one two" a-b "three four" 5=99}} | |
480 | ${extract{}{X=3}} | |
481 | ${extract{ }{X=3}} | |
482 | ${extract{ 2 }{ }{a b c}} | |
483 | ||
484 | # Translation | |
485 | ||
486 | abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}} | |
487 | abcdea a z ${tr{abcdea}{a}{z}} | |
488 | abcdea a ${tr{abcdea}{a}{}} | |
489 | abcdea abc z ${tr{abcdea}{abc}{z}} | |
490 | ||
491 | # RFC 2047 | |
492 | ||
493 | abcd ${rfc2047:abcd} | |
494 | <:abcd:> ${rfc2047:<:abcd:>} | |
495 | <:ab cd:> ${rfc2047:<:ab cd:>} | |
496 | Long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit} | |
497 | 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} | |
498 | ||
499 | ||
500 | # UTF-8 | |
501 | ||
502 | abcd ${from_utf8:abcd} | |
503 | aÀÿd ${from_utf8:aÀÿd} | |
504 | toobig ${from_utf8:aĀd} | |
505 | ||
506 | # Substitution | |
507 | ||
508 | \${sg{abcdefabcdef}{abc}{xyz}} =${sg{abcdefabcdef}{abc}{xyz}} | |
509 | \${sg{ab:xy::z}{:}{::}} =${sg{ab:xy::z}{:}{::}} | |
510 | \${sg{abcdefabcdef}{(..)[^c]}{>\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>$1<}} | |
511 | \${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}} | |
512 | \${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}} | |
513 | \${sg{abbab}{a*}{+}} =${sg{abbab}{a*}{+}} | |
514 | ||
515 | # File insertion | |
516 | ||
517 | ${readfile} | |
518 | ${readfile{DIR/aux-fixed/0002.readfile}} | |
519 | ${readfile{DIR/aux-fixed/0002.readfile}{}} | |
520 | ${readfile{DIR/aux-fixed/0002.readfile}{:}} | |
521 | ${readfile{DIR/aux-fixed/0002.readfile}{ - }} | |
522 | ${readfile{/non/exist/file}} | |
523 | ${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}} | |
524 | >${readfile{DIR/aux-fixed/0002.readfile}{!}}\ | |
525 | < | |
526 | ||
527 | # Calling a command | |
528 | ||
529 | ${run{DIR/aux-fixed/0002.runfile 0}} | |
530 | RC=$runrc | |
531 | ${run{DIR/aux-fixed/0002.runfile 0}{1}{2}} | |
532 | RC=$runrc | |
533 | ${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}} | |
534 | RC=$runrc | |
535 | ${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}} | |
536 | RC=$runrc | |
537 | ${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}} | |
538 | RC=$runrc | |
539 | ${run{DIR/test-nonexist}{Y}{N}} | |
540 | RC=$runrc | |
541 | >>${run{DIR/bin/iefbr14}}<< | |
542 | RC=$runrc | |
543 | ${if eq{1}{2}{${run{/non/exist}}}{1!=2}} | |
544 | RC=$runrc | |
545 | ||
546 | # PRVS | |
547 | ||
548 | ${prvs{userx@test.ex}{secret}} | |
549 | ${prvs{userx@test.ex}{secret}{1}} | |
550 | ${prvs{userx@test.ex}{secret}{8}} | |
551 | ||
552 | # Syntax errors | |
553 | ||
554 | ${prvs{userx@test.ex}{secret}{12}} | |
555 | ${prvs{userx@test.ex}{secret}{rhubarb}} | |
556 | ${prvs{userx@test.ex}{secret}{}} | |
557 | ||
558 | # Correct checks; can't put explicit addresses in the tests, because they | |
559 | # will change over time. | |
560 | ||
561 | ${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}} | |
562 | result=$prvscheck_result | |
563 | ||
564 | ${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\ | |
565 | {>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}} | |
566 | result=$prvscheck_result | |
567 | ||
568 | ${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}} | |
569 | result=$prvscheck_result | |
570 | ||
571 | # Incorrect secret | |
572 | ||
573 | ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}} | |
574 | result=$prvscheck_result | |
575 | ||
576 | ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}} | |
577 | result=$prvscheck_result | |
578 | ||
579 | # Non-prvs address | |
580 | ||
581 | >>${prvscheck{userx@test.ex}{secret}}<< | |
582 | result=$prvscheck_result | |
583 | ||
584 | # Syntax errors | |
585 | ||
586 | ${tod_log | |
587 | ${tod_log+6 | |
588 | ${expand:abcd | |
589 | ${expand:abcd${tod_log} | |
590 | ${hmac{xxx}{a}{b}} | |
591 | ${if and {xyz}{a}{b}} | |
592 | ${if and {{xya}}{a}{b}} | |
593 | ${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}} | |
594 | ${if eq {$h_xyz}{1}{y}{n}} | |
0d85fa3f PH |
595 | ${if eq {$h_xyz:}{1}{y}{n} |
596 | ${if def:h_xyz}{y}{n}} | |
59371ea7 PH |
597 | ${if or {eq {}{}{yes}{no}} |
598 | ${if or {{eq {}{}{yes}{no}} | |
599 | ${if or {{eq {}{}}{yes}{no}} | |
600 | ${substr_1_:12345} | |
601 | ${substr__3:12345} | |
602 | ||
603 | # Miscellaneous (for bug fixes, etc) | |
604 | ||
605 | ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}} | |
606 | ||
607 | **** | |
608 | # Test "escape" with print_topbitchars | |
609 | exim -be -DPTBC=print_topbitchars | |
610 | escape: ${escape:B7·F2ò} | |
611 | **** | |
612 | # Checkout expansion debugging | |
613 | exim -d-all+expand -be | |
614 | primary_hostname: $primary_hostname | |
615 | match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail} | |
616 | match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail} | |
617 | ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}} | |
618 | match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}} | |
619 | **** | |
620 | # Sender host name and address etc, all unset | |
621 | exim -be | |
622 | -oMa sender_host_address = $sender_host_address | |
623 | sender_host_port = $sender_host_port | |
624 | -oMaa sender_host_authenticated = $sender_host_authenticated | |
625 | -oMai authenticated_id = $authenticated_id | |
626 | -oMas authenticated_sender = $authenticated_sender | |
627 | -oMi interface_address = $interface_address | |
628 | interface_port = $interface_port | |
629 | -oMr received_protocol = $received_protocol | |
630 | -oMs sender_host_name = $sender_host_name | |
631 | -oMt sender_ident = $sender_ident | |
632 | **** | |
633 | # Sender host name and address etc, all set except host name. | |
634 | 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 | |
635 | -oMa sender_host_address = $sender_host_address | |
636 | sender_host_port = $sender_host_port | |
637 | -oMaa sender_host_authenticated = $sender_host_authenticated | |
638 | -oMai authenticated_id = $authenticated_id | |
639 | -oMas authenticated_sender = $authenticated_sender | |
640 | -oMi interface_address = $interface_address | |
641 | interface_port = $interface_port | |
642 | -oMr received_protocol = $received_protocol | |
643 | -oMt sender_ident = $sender_ident | |
644 | **** | |
645 | # Sender host name explicitly set | |
646 | exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name | |
647 | -oMa sender_host_address = $sender_host_address | |
648 | sender_host_port = $sender_host_port | |
649 | -oMs sender_host_name = $sender_host_name | |
650 | **** | |
651 | # Sender host name lookup fails (V4NET.11.12.13 is not reverse registered) | |
652 | exim -be -oMa V4NET.11.12.13 | |
653 | -oMs sender_host_name = $sender_host_name | |
654 | host_lookup_failed = $host_lookup_failed | |
655 | **** | |
656 | # Sender host name and protocol set by Sendmail-compatible option | |
657 | exim -be -pspecial:host.name | |
658 | -p received_protocol = $received_protocol | |
659 | -p sender_host_name = $sender_host_name | |
660 | **** | |
661 | # Sender host name and address etc, all set except host name, | |
662 | # which should therefore be looked up from the address, but not if | |
663 | # we are skipping. The debug output for this test will show when | |
664 | # the lookup occurs. | |
665 | 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 | |
666 | -oMa sender_host_address = $sender_host_address | |
667 | sender_host_port = $sender_host_port | |
668 | -oMaa sender_host_authenticated = $sender_host_authenticated | |
669 | -oMai authenticated_id = $authenticated_id | |
670 | -oMas authenticated_sender = $authenticated_sender | |
671 | -oMi interface_address = $interface_address | |
672 | interface_port = $interface_port | |
673 | -oMr received_protocol = $received_protocol | |
674 | ----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}} | |
675 | -oMs sender_host_name = $sender_host_name | |
676 | -oMt sender_ident = $sender_ident | |
677 | **** | |
678 | # Test no auto host name lookup for query-style lookups | |
679 | exim -d -bh V4NET.0.0.1 | |
680 | **** | |
681 | exim -d -bh V4NET.0.0.2 | |
682 | **** | |
683 | # Test $reply_address | |
684 | exim -bh V4NET.0.0.0 | |
685 | mail from:<> | |
686 | rcpt to:<some@body> | |
687 | data | |
688 | . | |
689 | mail from:<> | |
690 | rcpt to:<some@body> | |
691 | data | |
692 | From: a@b | |
693 | . | |
694 | mail from:<> | |
695 | rcpt to:<some@body> | |
696 | data | |
697 | From: a@b | |
698 | Reply-to: c@d | |
699 | . | |
700 | mail from:<> | |
701 | rcpt to:<some@body> | |
702 | data | |
703 | Reply-to: | |
704 | . | |
705 | mail from:<> | |
706 | rcpt to:<some@body> | |
707 | data | |
708 | Reply-to: | |
709 | From: x@y | |
710 | . | |
711 | quit | |
712 | **** | |
713 | # Check RFC 2047 decoding with (default) length check | |
714 | exim -bh V4NET.0.0.0 | |
715 | mail from:<> | |
716 | rcpt to:<some@body> | |
717 | data | |
718 | 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?= | |
719 | . | |
720 | quit | |
721 | **** | |
722 | # Check RFC 2047 decoding with length check disabled | |
723 | exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0 | |
724 | mail from:<> | |
725 | rcpt to:<some@body> | |
726 | data | |
727 | 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?= | |
728 | . | |
729 | quit | |
730 | **** | |
1688f43b PH |
731 | # Certain kind of error |
732 | exim -d -be | |
733 | match_ip: 15 ${if match_ip{1.2.3.4}{1.2.3}} | |
734 | match_ip: 16 ${if match_ip{1.2.3.4}{1.2.3.4/abc}} | |
735 | **** |