From 438518509deb7965e931e2760d2898a96f218df2 Mon Sep 17 00:00:00 2001 From: Igor Ippolitov Date: Wed, 2 Nov 2016 15:12:08 +0300 Subject: [PATCH] ensure required parameters are set at the time of a request --- nginx-ldap-auth-daemon.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nginx-ldap-auth-daemon.py b/nginx-ldap-auth-daemon.py index 91fa42e..ac53578 100755 --- a/nginx-ldap-auth-daemon.py +++ b/nginx-ldap-auth-daemon.py @@ -180,6 +180,15 @@ class LDAPAuthHandler(AuthHandler): return try: + # check that uri and baseDn are set + # either from cli or a request + if not ctx['url']: + self.log_message('LDAP URL is not set!') + return + if not ctx['basedn']: + self.log_message('LDAP baseDN is not set!') + return + ctx['action'] = 'initializing LDAP connection' ldap_obj = ldap.initialize(ctx['url']);