New LDAP default URI

This commit is contained in:
Ralf Ramsauer 2015-05-24 19:15:47 +02:00
parent 218e273c26
commit 567b0999f2
4 changed files with 9 additions and 9 deletions

View File

@ -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"

View File

@ -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));

View File

@ -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

View File

@ -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<unsigned int>(&timeout)->default_value(DEFAULT_TOKEN_TIMEOUT), "Token timeout in seconds")
("port,p", po::value<short>(&port)->default_value(DEFAULT_PORT), "Port")
("ldap,s", po::value<string>(&ldapServer)->default_value(DEFAULT_LDAP_SERVER), "Ldap Server")
("ldap,s", po::value<string>(&ldapUri)->default_value(DEFAULT_LDAP_URI), "Ldap Server")
("bidndn,b", po::value<string>(&bindDN)->default_value(DEFAULT_BINDDN), "Bind DN, %s means username")
("web,w", po::value<string>(&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<Logic>(new Logic(tokenTimeout,
ldapServer,
ldapUri,
bindDN,
lockPagePrefix));