Loading src/api.cpp +8 −3 Changes for src/api.cpp: 8 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -815,13 +815,18 @@ public: dsdb::Entry e; found = g_AdPlugin->dirGetBySam(domain, query, e, err) && e.isClass("user"); if (!found && query.find('@') != std::string::npos) { // a mail address: match mail or userPrincipalName, else the // local part as account name // a mail address: match mail, userPrincipalName or a proxyAddresses // smtp: entry, else the local part as account name std::vector<dsdb::Entry> users; if (g_AdPlugin->dirList(domain, AdPlugin::DirUser, users, err)) { const std::string q = lower(query); for (auto &u : users) { if (lower(u.str("mail")) == q || lower(u.str("userPrincipalName")) == q) { bool match = lower(u.str("mail")) == q || lower(u.str("userPrincipalName")) == q; // Exchange-style aliases: "SMTP:primary@x", "smtp:alias@x" if (const dsdb::Values *pa = !match ? u.get("proxyAddresses") : nullptr) for (const auto &v : *pa) if (lower(v).rfind("smtp:", 0) == 0 && lower(v.substr(5)) == q) match = true; if (match) { e = u; found = true; break; Loading Loading
src/api.cpp +8 −3 Changes for src/api.cpp: 8 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -815,13 +815,18 @@ public: dsdb::Entry e; found = g_AdPlugin->dirGetBySam(domain, query, e, err) && e.isClass("user"); if (!found && query.find('@') != std::string::npos) { // a mail address: match mail or userPrincipalName, else the // local part as account name // a mail address: match mail, userPrincipalName or a proxyAddresses // smtp: entry, else the local part as account name std::vector<dsdb::Entry> users; if (g_AdPlugin->dirList(domain, AdPlugin::DirUser, users, err)) { const std::string q = lower(query); for (auto &u : users) { if (lower(u.str("mail")) == q || lower(u.str("userPrincipalName")) == q) { bool match = lower(u.str("mail")) == q || lower(u.str("userPrincipalName")) == q; // Exchange-style aliases: "SMTP:primary@x", "smtp:alias@x" if (const dsdb::Values *pa = !match ? u.get("proxyAddresses") : nullptr) for (const auto &v : *pa) if (lower(v).rfind("smtp:", 0) == 0 && lower(v.substr(5)) == q) match = true; if (match) { e = u; found = true; break; Loading