Testsuite: tidying
[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 hide 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 =  FAIL1: ${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 =  FAIL2: ${lookup mysql     {servers=SSPEC; select name from them where id = '${quote_mysql:$local_part}'}}
38           # oldstyle partial server spec, prepended to lookup string, indexing main-option, but not quoted
39   warn    set acl_m0 =  FAIL3: ${lookup mysql     {servers=PARTIAL; select name from them where id = '$local_part'}}
40
41           # In list-style lookup, tainted lookup string is ok if server spec comes from main-option
42   warn    set acl_m0 =  ok:    hostlist
43           hosts =       net-mysql;select * from them where id='${quote_mysql:$local_part}'
44           # ... but setting a per-query servers spec fails due to the taint
45   warn    set acl_m0 =  FAIL4: hostlist
46           hosts =       <& net-mysql;servers=SSPEC; select * from them where id='${quote_mysql:$local_part}'
47
48           # The newer server-list-as-option-to-lookup-type is not a solution to tainted data in the lookup, because
49           # string-expansion is done before list-expansion so the taint contaminates the entire list.
50   warn    set acl_m0 =  FAIL5: hostlist
51           hosts =       <& net-mysql,servers=SSPEC; select * from them where id='${quote_mysql:$local_part}'
52
53   accept  domains = +local_domains
54           # the quoted status of this var should survive being passed via spoolfile
55           set acl_m_qtest = ${quote_mysql:$local_part}
56   accept  hosts = +relay_hosts
57   deny    message = relay not permitted
58
59 check_notsmtp:
60   accept
61           # the quoted status of this var should survive being passed via spoolfile
62           set acl_m_qtest = ${quote_mysql:$recipients}
63
64 # ----- Routers -----
65
66 begin routers
67
68 r1:
69   driver = accept
70   # this tests that quoting survived being passed via spoolfile
71   debug_print = acl_m_qtest: <$acl_m_qtest> lkup: <${lookup mysql{select name from them where id='$acl_m_qtest'}}>
72
73   # this tests the unquoted case, but will need enhancement when we enforce (vs. just logging), else no transport call
74   address_data = ${lookup mysql{select name from them where id='$local_part' limit 1}}
75   transport = t1
76
77
78 # ----- Transports -----
79
80 begin transports
81
82 t1:
83   driver = appendfile
84   file = DIR/test-mail/\
85     ${lookup mysql{select id from them where id='$local_part'}{$value}fail}
86   user = CALLER
87
88
89 # End