updated ini port to int, logged server uri, moved exit

This commit is contained in:
2021-10-12 13:25:52 -04:00
parent dd29eb1e90
commit fffae4cc3e

View File

@@ -40,25 +40,25 @@ cwd = os.path.dirname(os.path.realpath(__file__))
# import the config file
logger.debug("Starting to read the ini config.")
logger.debug("Using file {}/config.ini.".format(cwd))
logger.debug("Using file {0}/config.ini.".format(cwd))
config = configparser.ConfigParser()
config.read(cwd + '/config.ini')
serverDNS = config['LDAP SERVER']['server']
serverPort = config['LDAP SERVER']['port']
serverPort = config['LDAP SERVER'].getint('port')
serverSSL = config['LDAP SERVER'].getboolean('ssl')
logger.debug("Server: {}, Server Port: {}, Using SSL: {}".format(serverDNS, serverPort, serverSSL))
logger.debug("Server: {0}, Server Port: {1}, Using SSL: {2}".format(serverDNS, serverPort, serverSSL))
bindAccount = config['Bind Account']['username']
bindPassword = config['Bind Account']['password']
logger.debug("Bind Account: {}, Bind Password: <hidden>".format(bindAccount))
logger.debug("Bind Account: {0}, Bind Password: <hidden>".format(bindAccount))
logger.debug("Finished reading the ini config.")
exit()
# setup the server
server = Server(serverDNS, port=serverPort, use_ssl=serverSSL)
logger.debug("Setup server connection uri: {0}".format(server))
exit()
#Create a connection object, and bind with the given DN and password.
try:
conn = Connection(server, bindAccount, bindPassword, auto_bind=True)