Loading CMakeLists.txt +1 −1 Changes for CMakeLists.txt: 1 added line, 1 removed line. Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.16) project(adconnect VERSION 0.2.1 LANGUAGES CXX) project(adconnect VERSION 0.2.2 LANGUAGES CXX) # adconnect: the users and groups of an Active Directory domain for # systempp's user lookups (getpwnam(), getgrouplist(), ... -- see Loading src/directory.h +2 −0 Changes for src/directory.h: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ public: int pageSize) override; /* connects and binds now; throws ldap::Error */ void check(); /* the server of the current (or last) connection */ const std::string ¤tServer() const { return _cfg.servers[_server]; } /* our account's long-term key of etype (Kerberos only), to accept * tickets for its services; false without Kerberos */ bool ownKey(int etype, krb5::Key &key); Loading src/join.cpp +8 −1 Changes for src/join.cpp: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -143,6 +143,11 @@ JoinResult joinWith(const Config &admin, const std::string &hostname, const std: LdapSource src(admin); src.check(); /* the DC that answered first in the list: the account is made there, * the others may be unreachable (or not have it yet) */ std::vector<std::string> servers = { src.currentServer() }; for (const std::string &s : admin.servers) if (s != servers.front()) servers.push_back(s); std::string dn; src.search(admin.base, ldap::Subtree, "(&(objectClass=computer)(sAMAccountName=" + ldap::escape(sam) + "))", { "sAMAccountName" }, [&](const ldap::Entry &e) { dn = e.dn; }, 0); Loading Loading @@ -183,6 +188,8 @@ JoinResult joinWith(const Config &admin, const std::string &hostname, const std: m.krbPrincipal = sam; m.bindPassword = password; m.keytab.clear(); m.servers = servers; m.kdcs = servers; for (int attempt = 0;; attempt++) { try { LdapSource ms(m); Loading @@ -198,7 +205,7 @@ JoinResult joinWith(const Config &admin, const std::string &hostname, const std: r.domain = admin.domain; r.realm = admin.auth == Auth::Kerberos ? admin.krbRealm : upper(admin.domain); r.base = admin.base; r.servers = admin.servers; r.servers = servers; r.principal = sam; r.secretFile = secretFile; return r; Loading src/krb5.cpp +4 −1 Changes for src/krb5.cpp: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -411,7 +411,9 @@ Key Client::longTermKey(int etype, const std::string &salt, const Bytes &s2kpara Bytes Client::exchange(const Bytes &request) { std::string errors; for (const std::string &kdc : _kdcs) { for (size_t k = 0; k < _kdcs.size(); k++) { size_t index = (_kdc + k) % _kdcs.size(); const std::string &kdc = _kdcs[index]; std::string host = kdc; int port = 88; size_t colon = kdc.rfind(':'); Loading Loading @@ -448,6 +450,7 @@ Bytes Client::exchange(const Bytes &request) { } } if (want <= 4) throw Error(-1, "empty reply"); _kdc = index; return reply.substr(4, want - 4); } catch (const netplus::NetException &e) { errors += (errors.empty() ? "" : "; ") + kdc + ": " + e.what(); Loading src/krb5.h +1 −0 Changes for src/krb5.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ private: Key longTermKey(int etype, const std::string &salt, const Bytes &s2kparams); std::vector<std::string> _kdcs; size_t _kdc = 0; /* the one that answered last: asked first */ int _timeoutMs; Principal _client; std::string _password, _keytab; Loading Loading
CMakeLists.txt +1 −1 Changes for CMakeLists.txt: 1 added line, 1 removed line. Original line number Diff line number Diff line cmake_minimum_required(VERSION 3.16) project(adconnect VERSION 0.2.1 LANGUAGES CXX) project(adconnect VERSION 0.2.2 LANGUAGES CXX) # adconnect: the users and groups of an Active Directory domain for # systempp's user lookups (getpwnam(), getgrouplist(), ... -- see Loading
src/directory.h +2 −0 Changes for src/directory.h: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ public: int pageSize) override; /* connects and binds now; throws ldap::Error */ void check(); /* the server of the current (or last) connection */ const std::string ¤tServer() const { return _cfg.servers[_server]; } /* our account's long-term key of etype (Kerberos only), to accept * tickets for its services; false without Kerberos */ bool ownKey(int etype, krb5::Key &key); Loading
src/join.cpp +8 −1 Changes for src/join.cpp: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -143,6 +143,11 @@ JoinResult joinWith(const Config &admin, const std::string &hostname, const std: LdapSource src(admin); src.check(); /* the DC that answered first in the list: the account is made there, * the others may be unreachable (or not have it yet) */ std::vector<std::string> servers = { src.currentServer() }; for (const std::string &s : admin.servers) if (s != servers.front()) servers.push_back(s); std::string dn; src.search(admin.base, ldap::Subtree, "(&(objectClass=computer)(sAMAccountName=" + ldap::escape(sam) + "))", { "sAMAccountName" }, [&](const ldap::Entry &e) { dn = e.dn; }, 0); Loading Loading @@ -183,6 +188,8 @@ JoinResult joinWith(const Config &admin, const std::string &hostname, const std: m.krbPrincipal = sam; m.bindPassword = password; m.keytab.clear(); m.servers = servers; m.kdcs = servers; for (int attempt = 0;; attempt++) { try { LdapSource ms(m); Loading @@ -198,7 +205,7 @@ JoinResult joinWith(const Config &admin, const std::string &hostname, const std: r.domain = admin.domain; r.realm = admin.auth == Auth::Kerberos ? admin.krbRealm : upper(admin.domain); r.base = admin.base; r.servers = admin.servers; r.servers = servers; r.principal = sam; r.secretFile = secretFile; return r; Loading
src/krb5.cpp +4 −1 Changes for src/krb5.cpp: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -411,7 +411,9 @@ Key Client::longTermKey(int etype, const std::string &salt, const Bytes &s2kpara Bytes Client::exchange(const Bytes &request) { std::string errors; for (const std::string &kdc : _kdcs) { for (size_t k = 0; k < _kdcs.size(); k++) { size_t index = (_kdc + k) % _kdcs.size(); const std::string &kdc = _kdcs[index]; std::string host = kdc; int port = 88; size_t colon = kdc.rfind(':'); Loading Loading @@ -448,6 +450,7 @@ Bytes Client::exchange(const Bytes &request) { } } if (want <= 4) throw Error(-1, "empty reply"); _kdc = index; return reply.substr(4, want - 4); } catch (const netplus::NetException &e) { errors += (errors.empty() ? "" : "; ") + kdc + ": " + e.what(); Loading
src/krb5.h +1 −0 Changes for src/krb5.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ private: Key longTermKey(int etype, const std::string &salt, const Bytes &s2kparams); std::vector<std::string> _kdcs; size_t _kdc = 0; /* the one that answered last: asked first */ int _timeoutMs; Principal _client; std::string _password, _keytab; Loading