@@ -172,6 +172,7 @@ class LDAPAuthHandler(AuthHandler):
172
172
' realm' : (' X-Ldap-Realm' , ' Restricted' ),
173
173
' url' : (' X-Ldap-URL' , None),
174
174
' starttls' : (' X-Ldap-Starttls' , ' false' ),
175
+ ' disable_referrals' : (' X-Ldap-DisableReferrals' , ' false' ),
175
176
' basedn' : (' X-Ldap-BaseDN' , None),
176
177
' template' : (' X-Ldap-Template' , ' (cn=%(username)s)' ),
177
178
' binddn' : (' X-Ldap-BindDN' , ' ' ),
@@ -233,9 +234,9 @@ def do_GET(self):
233
234
if ctx[' starttls' ] == ' true' :
234
235
ldap_obj.start_tls_s ()
235
236
236
- # See http ://www.python-ldap.org/faq.shtml
237
- # uncomment, if required
238
- # ldap_obj.set_option(ldap.OPT_REFERRALS, 0)
237
+ # See https ://www.python-ldap.org/en/latest/ faq.html
238
+ if ctx[ ' disable_referrals ' ] == ' true ' :
239
+ ldap_obj.set_option(ldap.OPT_REFERRALS, 0)
239
240
240
241
ctx[' action' ] = ' binding as search user'
241
242
ldap_obj.bind_s(ctx[' binddn' ], ctx[' bindpasswd' ], ldap.AUTH_SIMPLE)
@@ -328,6 +329,7 @@ def exit_handler(signal, frame):
328
329
' realm' : (' X-Ldap-Realm' , args.realm),
329
330
' url' : (' X-Ldap-URL' , args.url),
330
331
' starttls' : (' X-Ldap-Starttls' , args.starttls),
332
+ ' disable_referrals' : (' X-Ldap-DisableReferrals' , args.disable_referrals),
331
333
' basedn' : (' X-Ldap-BaseDN' , args.basedn),
332
334
' template' : (' X-Ldap-Template' , args.filter),
333
335
' binddn' : (' X-Ldap-BindDN' , args.binddn),
0 commit comments