1 # LDAP lookups - expects specific data
3 LDAPTLS_REQCERT=never exim -be
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}
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}
15 ${lookup ldap {X=y ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=Philip%20Hazel)}{$value}fail}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
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}
70 Expect too many results error
71 ${lookup ldapdn {ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=*)}{$value}fail}
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}}
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}}
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}}
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}}
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}}
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}}
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}}
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}
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}}
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}}
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}}
117 Expect "FAILED" because no such object
118 \${lookup ldap {ldap:///o=JUNK}{$value}{FAILED}}
119 ${lookup ldap {ldap:///o=JUNK}{$value}{FAILED}}
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}
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}
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}}
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}}
141 LDAPTLS_REQCERT=never exim -d-all+lookup -be
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}
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}
154 exim -DLDAPSERVERS=ldap_default_servers=127.0.0.1 -d-all+lookup -be
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}
159 LDAPTLS_REQCERT=never exim -DLDAPSERVERS=ldap_default_servers=/tmp/ldap.sock -d-all+lookup -be
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}
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}
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}
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}
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}