Loading src/smb.cpp +9 −2 Changes for src/smb.cpp: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -1057,7 +1057,14 @@ bool ntlmViaAdconnect(const std::string &domain, const std::string &account, con f.push_back(line.substr(p)); if (f.size() != 2) { error = "bad answer from adconnectd"; return false; } unsigned long status = strtoul(f[0].c_str(), nullptr, 10); if (status != 0) { error = "the domain controller refused the password"; return false; } if (status != 0) { // the NT status: 0xc000006a wrong password, 0xc0000064 no such user, // 0xc000006d logon failure (e.g. a domain/UPN the DC didn't take) char hex[16]; snprintf(hex, sizeof hex, "0x%08lx", status); error = std::string("the domain controller refused the login (NT status ") + hex + ")"; return false; } if (!unbase64(f[1], sessionKey)) { error = "bad answer from adconnectd"; return false; } return true; } Loading Loading @@ -1155,7 +1162,7 @@ void SmbServer::ntlmAuthen(const unsigned char *payload, size_t len) { memcpy(resp.session_key, key.data(), std::min<size_t>(key.size(), sizeof(resp.session_key))); std::fill(key.begin(), key.end(), '\0'); } else { std::cerr << "sharedd: SMB: NTLM login for " << domain << "\\" << user << " refused: " << error std::cerr << "sharedd: SMB: NTLM login for " << (domain.empty() ? user : domain + "\\" + user) << " refused: " << error << std::endl; } send(NtlmAuthenResponse, &resp, sizeof(resp), false); Loading Loading
src/smb.cpp +9 −2 Changes for src/smb.cpp: 9 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -1057,7 +1057,14 @@ bool ntlmViaAdconnect(const std::string &domain, const std::string &account, con f.push_back(line.substr(p)); if (f.size() != 2) { error = "bad answer from adconnectd"; return false; } unsigned long status = strtoul(f[0].c_str(), nullptr, 10); if (status != 0) { error = "the domain controller refused the password"; return false; } if (status != 0) { // the NT status: 0xc000006a wrong password, 0xc0000064 no such user, // 0xc000006d logon failure (e.g. a domain/UPN the DC didn't take) char hex[16]; snprintf(hex, sizeof hex, "0x%08lx", status); error = std::string("the domain controller refused the login (NT status ") + hex + ")"; return false; } if (!unbase64(f[1], sessionKey)) { error = "bad answer from adconnectd"; return false; } return true; } Loading Loading @@ -1155,7 +1162,7 @@ void SmbServer::ntlmAuthen(const unsigned char *payload, size_t len) { memcpy(resp.session_key, key.data(), std::min<size_t>(key.size(), sizeof(resp.session_key))); std::fill(key.begin(), key.end(), '\0'); } else { std::cerr << "sharedd: SMB: NTLM login for " << domain << "\\" << user << " refused: " << error std::cerr << "sharedd: SMB: NTLM login for " << (domain.empty() ? user : domain + "\\" + user) << " refused: " << error << std::endl; } send(NtlmAuthenResponse, &resp, sizeof(resp), false); Loading