Move certificate name checking to mainline, default enabled
[users/heiko/exim.git] / test / scripts / 9000-LDAP / 9000
1 # LDAP lookups - expects specific data
2 #
3 LDAPTLS_REQCERT=never exim -be
4 Expect "Hazel"
5 \${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{\$value}fail}
6 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
7
8 DN is: $ldap_dn
9
10 Expect "Hazel" (Unix socket interface)
11 \${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
12 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
13
14 Expect syntax failure
15 ${lookup ldap {X=y ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
16
17 Expect "Hazel"
18 \${lookup ldap {time=1 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{\$value}fail}
19 ${lookup ldap {time=1 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
20
21 Expect "manager" followed by "Hazel" 5 times
22 \${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{\$value}fail}
23 ${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
24
25 DN is: $ldap_dn
26
27 Expect  "manager" followed by "Hazel"
28 \${lookup ldapm {Size=2 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{\$value}fail}
29 ${lookup ldapm {Size=2 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
30
31 Expect "manager" followed by "Hazel" 5 times
32 \${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{\$value}fail}
33 ${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
34
35 Expect "manager"
36 \${lookup ldap {size=1 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{\$value}fail}
37 ${lookup ldap {size=1 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
38
39 Expect too many results error
40 ${lookup ldap {size=0 time=0 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
41
42 Expect "manager"
43 \${lookup ldap {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{\$value}fail}
44 ${lookup ldap {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
45
46 Expect invalid credentials
47 \${lookup ldap {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{\$value}fail}
48 ${lookup ldap {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
49
50 cn="Philip Hazel" sn=Hazel
51 \${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn,cn?sub?(cn=Philip%20Hazel)}{\$value}fail}
52 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn,cn?sub?(cn=Philip%20Hazel)}{$value}fail}
53
54 cn="Philip Hazel" sn=Hazel objectClass=person
55 \${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK??sub?(cn=Philip%20Hazel)}{\$value}fail}
56 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK??sub?(cn=Philip%20Hazel)}{$value}fail}
57
58 P Hazel, Phil Hazel
59 \${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK?cn?sub?(cn=Phil%20Hazel)}{\$value}fail}
60 ${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK?cn?sub?(cn=Phil%20Hazel)}{$value}fail}
61
62 cn="P Hazel" cn="Phil Hazel" sn=Hazel objectClass=person
63 \${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK??sub?(cn=Phil%20Hazel)}{\$value}fail}
64 ${lookup ldapm {ldap:///o=University%20of%20Cambridge,c=UK??sub?(cn=Phil%20Hazel)}{$value}fail}
65
66 cn=P Hazel, o=University of Cambridge, c=UK
67 \${lookup ldapdn {ldap:///o=University%20of%20Cambridge,c=UK??sub?(cn=manager)}{\$value}fail}
68 ${lookup ldapdn {ldap:///o=University%20of%20Cambridge,c=UK??sub?(cn=manager)}{$value}fail}
69
70 Expect too many results error
71 ${lookup ldapdn {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
72
73 Expect "yes"
74 \${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
75 ${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
76
77 Expect "no"
78 \${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
79 ${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
80
81 Expect "no"
82 \${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass= ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
83 ${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass= ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
84
85 Expect "no"
86 \${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
87 ${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
88
89 Expect failure to contact server
90 \${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldaps://127.0.0.1:9999/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
91 ${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=known ldaps://127.0.0.1:9999/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
92
93 Expect "yes"
94 \${if ldapauth { size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
95 ${if ldapauth { size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
96
97 Expect "yes"
98 \${if ldapauth { size=1 time=0 user=cn%3dmanager%2co%3DUniversity%20of%20Cambridge%2Cc%3dUK pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
99 ${if ldapauth { size=1 time=0 user=cn%3dmanager%2co%3DUniversity%20of%20Cambridge%2Cc%3dUK pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
100
101 Expect syntax error
102 \${lookup ldap {ldapz:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
103 ${lookup ldap {ldapz:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
104
105 Expect error for missing user
106 \${if ldapauth {size=1 time=0 pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
107 ${if ldapauth {size=1 time=0 pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
108
109 Expect error for missing password
110 \${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
111 ${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
112
113 Expect "no" because of empty password
114 \${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass="" ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
115 ${if ldapauth {size=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass="" ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
116
117 Expect "FAILED" because no such object
118 \${lookup ldap {ldap:///o=JUNK}{$value}{FAILED}}
119 ${lookup ldap {ldap:///o=JUNK}{$value}{FAILED}}
120
121 Expect "P*Hazel (starry)"
122 \${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?cn?sub?(cn=P%5C2AHazel*)}{\$value}fail}
123 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?cn?sub?(cn=P%5C2AHazel*)}{$value}fail}
124
125 DN is: $ldap_dn
126
127 Expect "P\,Hazel"
128 \${lookup ldap {ldap:///cn=P%5C%2CHazel,o=University%20of%20Cambridge,c=UK?cn?sub?(cn=*)}{\$value}fail}
129 ${lookup ldap {ldap:///cn=P%5C%2CHazel,o=University%20of%20Cambridge,c=UK?cn?sub?(cn=*)}{$value}fail}
130 ****
131 exim -d -be
132 Expect syntax error
133 \${if ldapauth { soze=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
134 ${if ldapauth { soze=1 time=0 user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
135 ****
136 exim -d -be
137 Expect syntax error
138 \${if ldapauth { size=1 time=0 user"cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
139 ${if ldapauth { size=1 time=0 user"cn=manager,o=University of Cambridge,c=UK" pass=secret ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{yes}{no}}
140 ****
141 LDAPTLS_REQCERT=never exim -d-all+lookup -be
142 Expect 5 x "Hazel"
143 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
144 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
145 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
146 ${lookup ldap {ldap://%2Ftmp%2Fldap.sock/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
147 ${lookup ldap {ldaps://%2Ftmp%2Fldap.sock/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
148
149 Expect 2 x "Hazel" (using ldaps)
150 \${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
151 ${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass=secret ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
152 ${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass="secret" ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
153 ****
154 exim -DLDAPSERVERS=ldap_default_servers=127.0.0.1 -d-all+lookup -be
155 Expect 2 x "Hazel"
156 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
157 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
158 ****
159 LDAPTLS_REQCERT=never exim -DLDAPSERVERS=ldap_default_servers=/tmp/ldap.sock -d-all+lookup -be
160 Expect 3 x "Hazel"
161 ${lookup ldap {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
162 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
163 ${lookup ldap {dereference=always ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
164
165 Expect errors
166 \${lookup ldap {ldapi://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
167 ${lookup ldap {ldapi://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
168
169 \${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass="se\"cret" ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
170 ${lookup ldap {user="cn=manager,o=University of Cambridge,c=UK" pass=${quote:se"cret} ldaps://127.0.0.1/o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
171 ****
172 exim -be
173 Expect ldap_search to fail
174 ${lookup ldap {ldap:///o=top?mailRoutingAddress,mailHost,objectClass?sub?(&(mailLocalAddress=3-1546081-domain.net?wendling@stderr.efficientimpacte.com)(objectClass=inetLocalMailRecipient))}{$value}fail}
175 ****
176 exim -d -be
177 Expect "Hazel" - checking referrals syntax
178 \${lookup ldap {time=1 referrals=nofollow ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{\$value}fail}
179 ${lookup ldap {time=1 referrals=nofollow ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
180 ****