Fix $regex<n> use-after-free. Bug 2915
[exim.git] / test / confs / 2610
1 # Exim test configuration 2610
2
3 .include DIR/aux-var/std_conf_prefix
4
5 primary_hostname = myhost.test.ex
6
7 # ----- Main settings -----
8
9 domainlist local_domains = @
10 hostlist   relay_hosts = net-mysql;select * from them where id='$sender_host_address'
11
12 acl_smtp_rcpt = check_recipient
13 acl_not_smtp = check_notsmtp
14
15 PARTIAL = 127.0.0.1::PORT_N
16 SSPEC = PARTIAL/test/root/pass
17 mysql_servers = SSPEC
18
19
20 # ----- ACL -----
21
22 begin acl
23
24 check_recipient:
25           # Tainted-data checks
26   warn
27           # taint only in lookup string, properly quoted
28           set acl_m0 =  ok:   ${lookup mysql                    {select name from them where id = '${quote_mysql:$local_part}'}}
29           # taint only in lookup string, but not quoted
30           set acl_m0 =  FAIL: ${lookup mysql,no_rd              {select name from them where id = '$local_part'}}
31   warn
32           # option on lookup type unaffected
33           set acl_m0 =  ok:   ${lookup mysql,servers=SSPEC      {select name from them where id = '${quote_mysql:$local_part}'}}
34           # partial server-spec, indexing main-option, works
35           set acl_m0 =  ok:   ${lookup mysql,servers=PARTIAL    {select name from them where id = '${quote_mysql:$local_part}'}}
36           # oldstyle server spec, prepended to lookup string, fails with taint
37           set acl_m0 =  FAIL: ${lookup mysql     {servers=SSPEC; select name from them where id = '${quote_mysql:$local_part}'}}
38
39           # In list-style lookup, tainted lookup string is ok if server spec comes from main-option
40   warn    set acl_m0 =  ok:   hostlist
41           hosts =       net-mysql;select * from them where id='${quote_mysql:$local_part}'
42           # ... but setting a per-query servers spec fails due to the taint
43   warn    set acl_m0 =  FAIL: hostlist
44           hosts =       <& net-mysql;servers=SSPEC; select * from them where id='${quote_mysql:$local_part}'
45
46           # The newer server-list-as-option-to-lookup-type is not a solution to tainted data in the lookup, because
47           # string-expansion is done before list-expansion so the taint contaminates the entire list.
48   warn    set acl_m0 =  FAIL: hostlist
49           hosts =       <& net-mysql,servers=SSPEC; select * from them where id='${quote_mysql:$local_part}'
50
51   accept  domains = +local_domains
52           # the quoted status of this var should survive being passed via spoolfile
53           set acl_m_qtest = ${quote_mysql:$local_part}
54   accept  hosts = +relay_hosts
55   deny    message = relay not permitted
56
57 check_notsmtp:
58   accept
59           # the quoted status of this var should survive being passed via spoolfile
60           set acl_m_qtest = ${quote_mysql:$recipients}
61
62 # ----- Routers -----
63
64 begin routers
65
66 r1:
67   driver = accept
68   debug_print = acl_m_qtest: <$acl_m_qtest> lkup: <${lookup mysql{select name from them where id='$acl_m_qtest'}}>
69
70   # this tests the unquoted case, but will need enhancement when we enforce (vs. just logging), else no transport call
71   address_data = ${lookup mysql{select name from them where id='$local_part'}}
72   transport = t1
73
74
75 # ----- Transports -----
76
77 begin transports
78
79 t1:
80   driver = appendfile
81   file = DIR/test-mail/\
82     ${lookup mysql{select id from them where id='$local_part'}{$value}fail}
83   user = CALLER
84
85
86 # End