Check query strings of query-style lookups for quoting. Bug 2850
[exim.git] / test / confs / 2620
1 # Exim test configuration 2620
2
3 PARTIAL=localhost::PORT_N
4 SERVERS=PARTIAL/test/CALLER/
5
6 .include DIR/aux-var/std_conf_prefix
7
8 primary_hostname = myhost.test.ex
9
10 # ----- Main settings -----
11
12 domainlist local_domains = @
13 hostlist   relay_hosts = net-pgsql;select * from them where \
14                                      id='$sender_host_address'
15
16 acl_smtp_rcpt = check_recipient
17
18 pgsql_servers = SERVERS
19
20
21 # ----- ACL -----
22
23 begin acl
24
25 check_recipient:
26           # Tainted-data checks
27   warn
28           # taint only in lookup string, properly quoted
29           set acl_m0 =  ok:   ${lookup pgsql                    {select name from them where id = '${quote_pgsql:$local_part}'}}
30           # taint only in lookup string, but not quoted
31           set acl_m0 =  FAIL: ${lookup pgsql,cache=no_rd        {select name from them where id = '$local_part'}}
32   warn
33           # option on lookup type unaffected
34           set acl_m0 =  ok:   ${lookup pgsql,servers=SERVERS      {select name from them where id = '${quote_pgsql:$local_part}'}}
35           # partial server-spec, indexing main-option, works
36           set acl_m0 =  ok:   ${lookup pgsql,servers=PARTIAL    {select name from them where id = '${quote_pgsql:$local_part}'}}
37           # oldstyle server spec, prepended to lookup string, fails with taint
38           set acl_m0 =  FAIL: ${lookup pgsql     {servers=SERVERS; select name from them where id = '${quote_pgsql:$local_part}'}}
39
40           # In list-style lookup, tainted lookup string is ok if server spec comes from main-option
41   warn    set acl_m0 =  ok:   hostlist
42           hosts =       net-pgsql;select * from them where id='${quote_pgsql:$local_part}'
43           # ... but setting a per-query servers spec fails due to the taint
44   warn    set acl_m0 =  FAIL: hostlist
45           hosts =       <& net-pgsql;servers=SERVERS; select * from them where id='${quote_pgsql:$local_part}'
46
47           # The newer server-list-as-option-to-lookup-type is not a solution to tainted data in the lookup, because
48           # string-expansion is done before list-expansion so the taint contaminates the entire list.
49   warn    set acl_m0 =  FAIL: hostlist
50           hosts =       <& net-pgsql,servers=SERVERS; select * from them where id='${quote_pgsql:$local_part}'
51
52   accept  domains = +local_domains
53   accept  hosts = +relay_hosts
54   deny    message = relay not permitted
55
56
57 # ----- Routers -----
58
59 begin routers
60
61 r1:
62   driver = accept
63   address_data = ${lookup pgsql{select name from them where id='ph10'}}
64   transport = t1
65
66
67 # ----- Transports -----
68
69 begin transports
70
71 t1:
72   driver = appendfile
73   file = DIR/test-mail/\
74     ${lookup pgsql{select id from them where id='ph10'}{$value}fail}
75   user = CALLER
76
77
78 # End