diff --git a/doorlockd/config.h.in b/doorlockd/config.h.in index bc9a7e5..392cc19 100644 --- a/doorlockd/config.h.in +++ b/doorlockd/config.h.in @@ -12,7 +12,7 @@ #define DEFAULT_TOKEN_TIMEOUT (60*5) #define DEFAULT_PORT 5555 #define DEFAULT_WEB_PREFIX "https://lock.binary.kitchen/" -#define DEFAULT_LDAP_SERVER "ldaps://ldap.binary.kitchen" +#define DEFAULT_LDAP_URI "ldaps://ldap1.binary.kitchen/ ldaps://ldap2.binary.kitchen/ ldaps://ldapm.binary.kitchen/" #define DEFAULT_BINDDN "cn=%s,ou=Users,dc=binary-kitchen,dc=de" #define DEFAULT_LOG_FILE "/var/log/doorlockd.log" #define DEFAULT_PID_FILE "/var/run/doorlockd.pid" diff --git a/doorlockd/logic.cpp b/doorlockd/logic.cpp index 05a1971..ab810ca 100644 --- a/doorlockd/logic.cpp +++ b/doorlockd/logic.cpp @@ -14,14 +14,14 @@ using namespace std; Logic::Logic(const chrono::seconds tokenTimeout, - const string &ldapServer, + const string &ldapUri, const string &bindDN, const string &webPrefix) : _logger(Logger::get()), _door(Door::get()), _epaper(Epaper::get()), _tokenTimeout(tokenTimeout), - _ldapServer(ldapServer), + _ldapUri(ldapUri), _bindDN(bindDN), _webPrefix(webPrefix) { @@ -175,7 +175,7 @@ Logic::Response Logic::_checkLDAP(const string &user, const string &password) _logger(LogLevel::notice, "Trying to authenticate as user \"%s\"", user.c_str()); snprintf(buffer, BUFFERSIZE, _bindDN.c_str(), user.c_str()); - rc = ldap_initialize(&ld, _ldapServer.c_str()); + rc = ldap_initialize(&ld, _ldapUri.c_str()); if(rc != LDAP_SUCCESS) { _logger(LogLevel::error, "LDAP initialize error: %s", ldap_err2string(rc)); diff --git a/doorlockd/logic.h b/doorlockd/logic.h index 2097631..73c5899 100644 --- a/doorlockd/logic.h +++ b/doorlockd/logic.h @@ -23,7 +23,7 @@ class Logic public: Logic(const std::chrono::seconds tokenTimeout, - const std::string &ldapServer, + const std::string &ldapUri, const std::string &bindDN, const std::string &webPrefix); ~Logic(); @@ -92,7 +92,7 @@ private: std::mutex _mutex = {}; // The URI of the ldap server - const std::string _ldapServer; + const std::string _ldapUri; // LDAP bindDN const std::string _bindDN; // Prefix of the website diff --git a/doorlockd/main.cpp b/doorlockd/main.cpp index e974921..ba92257 100644 --- a/doorlockd/main.cpp +++ b/doorlockd/main.cpp @@ -108,7 +108,7 @@ int main(int argc, char** argv) int retval = -1; short port; std::chrono::seconds tokenTimeout; - string ldapServer; + string ldapUri; string bindDN; string lockPagePrefix; string logfile; @@ -128,7 +128,7 @@ int main(int argc, char** argv) ("help,h", "print help") ("tokentimeout,t", po::value(&timeout)->default_value(DEFAULT_TOKEN_TIMEOUT), "Token timeout in seconds") ("port,p", po::value(&port)->default_value(DEFAULT_PORT), "Port") - ("ldap,s", po::value(&ldapServer)->default_value(DEFAULT_LDAP_SERVER), "Ldap Server") + ("ldap,s", po::value(&ldapUri)->default_value(DEFAULT_LDAP_URI), "Ldap Server") ("bidndn,b", po::value(&bindDN)->default_value(DEFAULT_BINDDN), "Bind DN, %s means username") ("web,w", po::value(&lockPagePrefix)->default_value(DEFAULT_WEB_PREFIX), "Prefix of the webpage") ("foreground,f", po::bool_switch(&foreground)->default_value(false), "Run in foreground") @@ -169,7 +169,7 @@ int main(int argc, char** argv) signal(SIGUSR2, signal_handler); logic = unique_ptr(new Logic(tokenTimeout, - ldapServer, + ldapUri, bindDN, lockPagePrefix));