in common/util.hpp [563:597]
static std::pair<size_t, void*> find_password( std::string ldap_search_result )
{
size_t base64_decode_len = 0;
std::vector<std::string> results;
std::string password = std::string( "msDS-ManagedPassword::" );
results = Util::split_string( ldap_search_result, '#' );
bool password_found = false;
for ( auto& result : results )
{
auto found = result.find( password );
if ( found != std::string::npos )
{
found += password.length();
password = result.substr( found + 1, result.length() );
// std::cerr << "Password = " << password << std::endl;
password_found = true;
break;
}
}
uint8_t* blob_base64_decoded = nullptr;
if ( password_found )
{
blob_base64_decoded = base64_decode( password, &base64_decode_len );
if ( blob_base64_decoded == nullptr )
{
std::cerr << Util::getCurrentTime() << '\t' << "ERROR: base64 buffer is null"
<< std::endl;
return std::make_pair( 0, nullptr );
}
}
return std::make_pair( base64_decode_len, blob_base64_decoded );
}