From e21f1aa9e4ec61b4bc292afb50cabd9f9ce63b26 Mon Sep 17 00:00:00 2001 From: Dmitriy Lyalyuev Date: Tue, 28 Jun 2016 13:41:24 +0300 Subject: [PATCH] Anonymous bind more simple --- nginx-ldap-auth-daemon.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nginx-ldap-auth-daemon.py b/nginx-ldap-auth-daemon.py index 2cc91ce..be288b3 100755 --- a/nginx-ldap-auth-daemon.py +++ b/nginx-ldap-auth-daemon.py @@ -144,7 +144,7 @@ class LDAPAuthHandler(AuthHandler): 'url': ('X-Ldap-URL', None), 'basedn': ('X-Ldap-BaseDN', None), 'template': ('X-Ldap-Template', '(cn=%(username)s)'), - 'binddn': ('X-Ldap-BindDN', 'cn=anonymous'), + 'binddn': ('X-Ldap-BindDN', ''), 'bindpasswd': ('X-Ldap-BindPass', ''), 'cookiename': ('X-CookieName', '') } @@ -176,10 +176,7 @@ class LDAPAuthHandler(AuthHandler): # ldap_obj.set_option(ldap.OPT_REFERRALS, 0) ctx['action'] = 'binding as search user' - if ctx['binddn'] == 'cn=anonymous': - ldap_obj.simple_bind_s() - else: - ldap_obj.bind_s(ctx['binddn'], ctx['bindpasswd'], ldap.AUTH_SIMPLE) + ldap_obj.bind_s(ctx['binddn'], ctx['bindpasswd'], ldap.AUTH_SIMPLE) ctx['action'] = 'preparing search filter' searchfilter = ctx['template'] % { 'username': ctx['user'] }