Check for overflow in numeric expansion conditions; forbid negative
[exim.git] / test / stdout / 0002
1
2 > # These expansions can test variables in the configuration, but as there
3 > # is no message being processed, there is no message-related data. But
4 > # that of course gets tested in plenty of other places.
5
6 > # Some fixed variables
7
8 > exim_path: TESTSUITE/eximdir/exim
9 > primary_hostname: myhost.test.ex
10 > primary_hostname: myhost.test.ex
11 > qualify_domain: myhost.test.ex
12 > bounce_return_size_limit: 102400
13 > spool_directory: TESTSUITE/spool
14 > Failed: unknown variable in "${unknown}"
15 > h_subject: (should be empty)
16 > h_subject: (should be empty)
17 > Failed: unknown expansion operator "header_subject"
18
19 > # $message_headers should be empty
20 > message_headers: ><
21
22 > # Continuation
23 > xy
24 > xy
25
26 > # Overlong names and overbig numbers
27
28 > Failed: unknown variable name "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
29 > Failed: unknown variable in "${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}"
30 > +
31 > +
32
33 > # Operators
34
35 > addrss: local-part@dom.ain
36 > addrss: local-part@dom.ain
37 > domain: dom.ain
38 > domain: dom.ain
39 > escape: B7\267F2\362
40 > eval:   2
41 > eval:   7
42 > eval:   9
43 > eval:   4
44 > eval:   6
45 > eval:   42
46 > Failed: error in expression evaluation: expecting number or opening parenthesis (after processing "")
47 > eval:   -2
48 > eval:   1
49 > eval:   1
50 > Failed: error in expression evaluation: expecting closing parenthesis (after processing "-2 - (-3")
51 > Failed: error in expression evaluation: expecting + or - (after processing "-2 - -3")
52 > eval:   1
53 > eval:   -5
54 > Failed: error in expression evaluation: expecting number or opening parenthesis (after processing "-2 -")
55 > eval:   40962
56 > eval:   63
57 > Failed: error in expression evaluation: expecting + or - (after processing "0")
58 > eval10: 77
59 > eval10: 8
60 > expand: $primary_hostname myhost.test.ex
61 > hash:   jmg monty fbWx
62 > hash:   abcX abX aX X
63 > hex2b64:EjRWeA==
64 > hex2b64:q83v
65 > hex2b64:q83v
66 > hex2b64:Gis8TV5v
67 > Failed: "1a2b3c4d5e6" contains an odd number of characters
68 > Failed: "1a2b3c4d5e6g" is not a hex string
69 > hex2b64:MPPJPkZDbetYunCBao7BJA==
70 > hex2b64:ztcfpyNSMb7Tg/rP3EHE3cwi7PE=
71
72 > The base62 operator is actually a base36 operator in the Darwin and Cygwin
73 > environments. Write cunning tests that produce the same output in both cases,
74 > while doing a reasonable check.
75
76 > base62:  OK
77 > base62d: OK
78 > base62d: OK
79 > Failed: argument for base62 operator is "12345x", which is not a decimal number
80 > Failed: argument for base62d operator is "0003D7.", which is not a base 36/62 number
81
82 > hmac:   dd97e3ba5d1a61b5006108f8c8252953
83 > hmac:   0210cf9d274b53f1550f657c378b29e8bfed1064
84 > md5:    77add1d5f41223d5582fca736a5cb335
85 > sha1:   DA39A3EE5E6B4B0D3255BFEF95601890AFD80709
86 > sha1:   A9993E364706816ABA3E25717850C26C9CD0D89D
87 > mask:   192.168.10.192/28
88 > mask:   192.168.10.206/32
89 > Failed: mask value too big in "192.168.10.206/33"
90 > mask:   0.0.0.0/0
91 > Failed: missing mask value in "192.168.10.206"
92 > Failed: "a.b.c.d" is not an IP address
93 > nhash:  19 0/61
94 > lc/uc:  the quick  BROWN FOX
95 > length: The quick  abc
96 > lclpt:  local-part
97 > lclpt:  local-part
98 > quote:  aZ09_.-Q "ab*cd" "abcd\"ef"
99 > quote:  "nl(\n)"
100 > quote:  "cr(\r)"
101 > quote:  "tab( )"
102 > quote:  "xff(ÿ)"
103 > quote:  Empty>""<
104 > quote_local_part: abcd
105 > quote_local_part: O'Reilly
106 > quote_local_part: "a space"
107 > quote_local_part: ".something"
108 > quote_local_part: "something."
109 > quote_local_part: joe.bloggs
110 > quote_local_part: a!b
111 > quote_local_part: "x@y"
112 > quote_local_part: ab*cd
113 > quote_local_part: "x:y"
114 > quote_local_part: "abcd\"ef"
115 > quote_local_part: ""
116 > rxquote:aZ09\_\,\-Q ab\*cd abcd\"ef
117 > substr: ba 34  1
118 > substr: barb rhuba
119 > substr: 
120 > substr: 
121 > str2b64:YWJjZA==
122 > str2b64:VGhlIHF1aWNrIGJyb3duIAogZm94
123 > strlen: 0
124 > strlen: 1
125 > strlen: 8
126 > time_eval:     10
127 > time_eval:     7200
128 > time_eval:     86700
129 > time_eval:     788645
130 > Failed: string "14" is not an Exim time interval in "time_eval" operator
131 > Failed: string "rhubarb" is not an Exim time interval in "time_eval" operator
132 > time_interval: 0s
133 > time_interval: 44s
134 > time_interval: 1w4d13h46m39s
135 > Failed: string "-1" is not a positive number in "time_interval" operator
136 > Failed: string "rhubarb" is not a positive number in "time_interval" operator
137
138 > # stat is a bit tricky, but some of the fields of the aux-var directory
139 > # should be the same on all systems
140
141 > stat:   40755
142 > stat:   drwxr-xr-x
143 > Failed: stat(/a/non/existent/file) failed: No such file or directory
144
145 > # "Operators" that have expanded arguments
146
147 > hash:   jmg monty fbWx
148 > hash:   abcX abX aX X
149 > nhash:  19 0/61
150 > length: The quick  abc
151 > substr: ba 34  1
152 > substr: 
153
154 > # Error forms
155
156 > Failed: missing or misplaced { or }
157 > Failed: "nonnumber" is not a number (in "hash" expansion)
158 > Failed: Too many arguments for "hash" (max is 3)
159 > Failed: "-2" is not a positive number (in "substr" expansion)
160
161 > # Skipped operators
162
163 > addrss: NO
164 > domain: NO
165 > escape: NO
166 > expand: NO
167 > hash:   NO
168 > md5:    NO
169 > mask:   NO
170
171 > # Numeric overflow
172
173 > Failed: absolute value of integer "4096M" is too large (overflow)
174 > Failed: absolute value of integer "4096000000" is too large (overflow)
175
176 > # Conditions
177
178 > 2=2:    y
179 > 2==2:   y
180 > 3=2:    n
181 > 2==3:   n
182 > !2=2:   n
183 > !2==2:  n
184 > !3=2:   y
185 > !2==3:  y
186 > 2>3:    n
187 > 3>3:    n
188 > 4>3:    y
189 > 1>-1:   y
190 > 2>=3:   n
191 > 3>=3:   y
192 > 4>=3:   y
193 > 2<3:    y
194 > 3<3:    n
195 > 4<3:    n
196 > 2<=3:   y
197 > 3<=3:   y
198 > 4<=3:   n
199 > 5<=3:   n
200 > -3<=1:  y
201
202 > 5>3k:   n
203 > 5>3m:   n
204 > Failed: invalid integer "3z "
205 > Failed: integer expected but "a" found
206
207 > def:y   y
208 > def:n   n
209 > Failed: unknown variable "post" after "def:"
210 > def:h_f n
211 > def:h_f n
212 > Failed: missing or misplaced { or }
213
214 > exists: y
215 > exists: n
216
217 > eq:     y
218 > eq:     n
219 > !eq:    n
220 > !eq:    y
221
222 > eqi:    y
223 > eqi:    y
224 > eqi:    n
225 > !eqi:   n
226 > !eqi:   n
227 > !eqi:   y
228
229 > lt:     y
230 > lti:    n
231 > le:     y
232 > lei:    y
233 > gt:     n
234 > gti:    n
235 > ge:     n
236 > gei:    y
237
238 > isip:   y  1.2.3.4
239 > isip4:  y  1.2.3.4
240 > isip6:  n  1.2.3.4
241 > isip:   n  1:2:3:4
242 > isip4:  n  1:2:3:4
243 > isip6:  n  1:2:3:4
244 > isip:   y      ::1
245 > isip4:  n      ::1
246 > isip6:  y      ::1
247 > isip:   y  fe80::a00:20ff:fe86:a061
248 > isip4:  n  fe80::a00:20ff:fe86:a061
249 > isip6:  y  fe80::a00:20ff:fe86:a061
250 > isip:   n  rhubarb
251 > isip4:  n  rhubarb
252 > isip6:  n  rhubarb
253
254 > match:  cdab
255 > match:  cdab
256 > match:  cdab
257 > Failed: "if" failed and "fail" requested
258 > match:  cd[xyz]ab
259
260 > match_domain:    yes
261 > match_domain:    no
262 > match_domain:    yes
263 > match_domain:    yes
264 > match_domain:    no
265
266 >  >x@zz.aa.bb< [] >x@zz.aa.bb< 
267
268 >  >x@xxxabc< [] >x@xxxabc< 
269
270 > match_address:   yes
271 > match_address:   yes
272
273 > match_local_part:yes
274 > match_local_part:yes
275
276 > match_ip:        01 true
277 > match_ip:        02 
278 > match_ip:        03 true
279 > match_ip:        04 true
280 > match_ip:        05 
281 > match_ip:        06 
282 > match_ip:        07 true
283 > match_ip:        08 true
284 > match_ip:        09 
285 > match_ip:        10 true
286 > Failed: "somename" is not an IP address
287 > match_ip:        12 true
288 > match_ip:        13 true
289 > match_ip:        14 true
290
291 > queue_running:  n
292 > first_delivery: n
293
294 > queue_running after or: y
295 > first_delivery after or: y
296
297 > # Default values for both if strings
298
299 > ${if eq{1}{1}}  >true<
300 > ${if eq{1}{2}}  ><
301
302 > # Lookups: DIR is the testing directory. In this test we can only use the
303 > # lookups that are required in all cases.
304
305 > CALLER
306
307 > ==X@Y
308 > ==*
309 > ==*@Z
310 > ==*
311
312 > data for a.b.c.d
313 > failed x.y.z
314 > data for *.p.q
315 > data for *.p.q
316 > data for *.p.q
317 > Failed: "lookup" failed and "fail" requested
318 > data for *
319
320 > q1:  "abc"
321 > q2:  "xyz":
322 > q3:  "pqr"  :
323 > q4:  "a:b" abc continued data (make sure not key)
324 > q5:  "\"quoted\""
325 > q6:  "white space"
326 > q7:  "b\\s"
327
328 > abc:   abc
329 > a.b.c: *.b.c
330 > ab.c:  *b.c
331 > xyz:   ^X
332 > Xyz:   ^X
333 > Zyz:   ^Z
334 > a b:   "^a +b"
335 > a  b:  "^a +b"
336 > a:b:   lookup succeeded
337 > a.b:   ^a\\.+b
338 > a..b:  ^a\\.+b
339 > a9b:   \N^a\d+b
340 > a99b:  \N^a\d+b
341
342 > # Should give the same results as above because expansion does nothing
343
344 > abc:   abc
345 > a.b.c: *.b.c
346 > ab.c:  *b.c
347 > xyz:   ^X
348 > Xyz:   ^X
349 > Zyz:   ^Z
350 > a b:   "^a +b"
351 > a  b:  "^a +b"
352 > a:b:   lookup succeeded
353
354 > # Should fail because of no expansion
355
356 > a.b:   NO
357 > a..b:  NO
358 > a9b:   NO
359 > a99b:  NO
360
361 > # But these should succeed
362
363 > a\:b:  ^a\\.+b
364 > a\:Xb: ^a\\.+b
365
366 > # Some tests of case-(in)dependence
367
368 > MiXeD-CD:  Data found for case-dependent MiXeD-CD
369 > MixeD-CD:  NOT FOUND
370 > MiXeD-Ncd: Data found for case-independent MiXeD-nCD
371 > MixeD-Ncd: Data found for case-independent MiXeD-nCD
372
373 > # IP address (CIDR) lookups
374
375 > 1.2.3.4:      data for 1.2.3.4
376 > 1.2.3.5:      
377 > 1.2.3.5:      data for *
378 > abcd::cdab:   data for abcd::cdab
379 > 192.168.1.2:  data for 192.168.0.0/16
380 > 192.168.5.6:  data for 192.168.0.0/16
381 > abcd:abcd::   data for abcd:abcd::/32
382 > abcd:abcd:1:: data for abcd:abcd::/32
383 > abcd:abcd::3  data for abcd:abcd::/32
384 > Failed: lookup of "rhubarb" gave DEFER: "rhubarb" is not a valid iplsearch key (an IP address, with optional CIDR mask, is wanted): in a host list, use net-iplsearch as the search type
385
386
387 > # Nested Lookups - style 1
388
389 > The data for key1->key2
390 > Failed: "lookup" failed and "fail" requested
391
392 > # Nested Lookups - style 2
393
394 > The data for key1->key2
395 > failed for key4
396
397 > # Other nesting tests
398
399 > 1-in-1
400 > 2-in-2
401 > both-in-1,both-in-2
402 > Failed: "lookup" failed and "fail" requested
403
404 > # Lookup quotes for standardly expected lookups
405
406 > lsearch  !@#$%^&*()_-+=|\~`1234567890{[}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm
407 > Failed: unknown lookup type "xxx"
408
409 > # Extract
410
411 > 2
412 > 2
413 > 2
414 > 2
415 > Empty:<>
416 > Empty:<>
417 > <3>
418 > <3>
419 > Empty:<>
420 > Empty:<>
421 > no Z
422 > no 4
423 > Failed: "extract" failed and "fail" requested
424 > Failed: "extract" failed and "fail" requested
425 > D
426 > a:b:c:d:e
427 > a
428 > e
429 > a
430 > FAIL
431 > b
432
433 > b
434 > three four
435 > Failed: first argument of "extract" must not be empty
436 > Failed: first argument of "extract" must not be empty
437 > b
438
439 > # Translation
440
441 > abcdea aaa xyz zbcdez
442 > abcdea a   z   zbcdez
443 > abcdea a       abcdea
444 > abcdea abc z   zzzdez
445
446 > # RFC 2047
447
448 > abcd      abcd
449 > <:abcd:>  =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=
450 > <:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=
451 > 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?=
452 > 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?=
453
454
455 > # UTF-8
456
457 > abcd      abcd
458 > aÀÿd      aÀÿd
459 > toobig    a_d
460
461 > # Substitution
462
463 > ${sg{abcdefabcdef}{abc}{xyz}}          =xyzdefxyzdef
464 > ${sg{ab:xy::z}{:}{::}}                 =ab::xy::::z
465 > ${sg{abcdefabcdef}{(..)[^c]}{>$1<}}    =a><><><ef
466 > ${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}   =a>bc<>ef<>bc<ef
467 > ${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}=a>bc<>ef<>bc<ef
468 > ${sg{abbab}{a*}{+}}                    =++b+b++b+
469
470 > # File insertion
471
472 > Failed: missing or misplaced { or }
473 > abcde
474 12345
475
476 xyz
477
478 > abcde12345xyz
479 > abcde:12345::xyz:
480 > abcde - 12345 -  - xyz - 
481 > Failed: failed to open /non/exist/file: No such file or directory
482 > non-exist
483 > >abcde!12345!!xyz!<
484
485 > # Calling a command
486
487 > abcd
488 1234
489
490 > RC=0
491 > 1
492 > RC=0
493 > abcd
494 1234
495
496 > RC=0
497 > 2
498 > RC=1
499 > abcd
500 1234
501
502 > RC=1
503 > N
504 > RC=127
505 > >><<
506 > RC=0
507 > 1!=2
508 > RC=0
509
510 > # PRVS
511
512 > prvs=userx/xxxxxxxxxx@test.ex
513 > prvs=userx/xxxxxxxxxx@test.ex
514 > prvs=userx/xxxxxxxxxx@test.ex
515
516 > # Syntax errors
517
518 > Failed: prvs second argument must be a single digit
519 > Failed: prvs second argument must be a single digit
520 > Failed: prvs second argument must be a single digit
521
522 > # Correct checks; can't put explicit addresses in the tests, because they
523 > # will change over time.
524
525 > userx@test.ex
526 > result=1
527
528 > >1< >userx@test.ex< >1<
529 > result=1
530
531 > userx@test.ex
532 > result=1
533
534 > # Incorrect secret
535
536 > userx@test.ex
537 > result=
538
539 > 0
540 > result=
541
542 > # Non-prvs address
543
544 > >><<
545 > result=
546
547 > # Syntax errors
548
549 > Failed: "${tod_log" is not a known operator (or a } is missing in a variable reference)
550 > Failed: "${tod_log" is not a known operator (or a } is missing in a variable reference)
551 > Failed: missing } at end of string
552 > Failed: missing } at end of string
553 > Failed: hmac algorithm "xxx" is not recognised
554 > Failed: each subcondition inside an "and{...}" condition must be in its own {}
555 > Failed: unknown condition "xya" inside "and{...}" condition
556 > Failed: condition name expected, but found "${lookup{x}lsear" inside "and{...}" condition
557 > Failed: missing } at end of string - could be header name not terminated by colon
558 > Failed: each subcondition inside an "or{...}" condition must be in its own {}
559 > Failed: missing } at end of condition inside "or" group
560 > Failed: unknown condition "yes" inside "or{...}" condition
561 > Failed: non-digit after underscore in "substr_1_"
562 > Failed: non-digit after underscore in "substr__3"
563
564 > # Miscellaneous (for bug fixes, etc)
565
566 > true
567
568
569 > escape: B7·F2ò
570
571 > primary_hostname: myhost.test.ex
572 > match:  cdab
573 > Failed: "if" failed and "fail" requested
574 > yes
575 > match_address:   no
576
577 > -oMa  sender_host_address = 
578 >       sender_host_port = 0
579 > -oMaa sender_host_authenticated = 
580 > -oMai authenticated_id = CALLER
581 > -oMas authenticated_sender = CALLER@myhost.test.ex
582 > -oMi  interface_address = 
583 >       interface_port = -1
584 > -oMr  received_protocol = 
585 > -oMs  sender_host_name = 
586 > -oMt  sender_ident = CALLER
587
588 > -oMa  sender_host_address = V4NET.0.0.1
589 >       sender_host_port = 1234
590 > -oMaa sender_host_authenticated = AAA
591 > -oMai authenticated_id = philip
592 > -oMas authenticated_sender = xx@yy.zz
593 > -oMi  interface_address = 1.1.1.1
594 >       interface_port = 99
595 > -oMr  received_protocol = special
596 > -oMt  sender_ident = me
597
598 > -oMa  sender_host_address = V4NET.0.0.1
599 >       sender_host_port = 1234
600 > -oMs  sender_host_name = my.host.name
601
602 > -oMs  sender_host_name = 
603 >       host_lookup_failed = 1
604
605 > -p  received_protocol = special
606 > -p  sender_host_name = host.name
607
608 > -oMa  sender_host_address = V4NET.0.0.1
609 >       sender_host_port = 1234
610 > -oMaa sender_host_authenticated = AAA
611 > -oMai authenticated_id = philip
612 > -oMas authenticated_sender = xx@yy.zz
613 > -oMi  interface_address = 1.1.1.1
614 >       interface_port = 99
615 > -oMr  received_protocol = special
616 > ----> No lookup yet: No
617 > -oMs  sender_host_name = ten-1.test.ex
618 > -oMt  sender_ident = me
619
620
621 **** SMTP testing session as if from host V4NET.0.0.1
622 **** but without any ident (RFC 1413) callback.
623 **** This is not for real!
624
625 550 Administrative prohibition\r
626
627 **** SMTP testing session as if from host V4NET.0.0.2
628 **** but without any ident (RFC 1413) callback.
629 **** This is not for real!
630
631 550 Administrative prohibition\r
632
633 **** SMTP testing session as if from host V4NET.0.0.0
634 **** but without any ident (RFC 1413) callback.
635 **** This is not for real!
636
637 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
638 250 OK\r
639 250 Accepted\r
640 354 Enter message, ending with "." on a line by itself\r
641 550 reply_address=<>\r
642 250 OK\r
643 250 Accepted\r
644 354 Enter message, ending with "." on a line by itself\r
645 550 reply_address=<a@b>\r
646 250 OK\r
647 250 Accepted\r
648 354 Enter message, ending with "." on a line by itself\r
649 550 reply_address=<c@d>\r
650 250 OK\r
651 250 Accepted\r
652 354 Enter message, ending with "." on a line by itself\r
653 550 reply_address=<>\r
654 250 OK\r
655 250 Accepted\r
656 354 Enter message, ending with "." on a line by itself\r
657 550 reply_address=<x@y>\r
658 221 myhost.test.ex closing connection\r
659
660 **** SMTP testing session as if from host V4NET.0.0.0
661 **** but without any ident (RFC 1413) callback.
662 **** This is not for real!
663
664 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
665 250 OK\r
666 250 Accepted\r
667 354 Enter message, ending with "." on a line by itself\r
668 550 reply_address=<>\r
669 221 myhost.test.ex closing connection\r
670
671 **** SMTP testing session as if from host V4NET.0.0.0
672 **** but without any ident (RFC 1413) callback.
673 **** This is not for real!
674
675 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
676 250 OK\r
677 250 Accepted\r
678 354 Enter message, ending with "." on a line by itself\r
679 550 reply_address=<>\r
680 221 myhost.test.ex closing connection\r
681 > match_ip:        15 
682 > match_ip:        16 
683