VNC: try to find password for host if no password for host:port is found

This commit is contained in:
Laurens Voerman
2017-09-21 16:33:14 +02:00
parent 4bc1320709
commit 292b892478

View File

@@ -397,20 +397,23 @@ class ReaderWriterVNC : public osgDB::ReaderWriter
const osgDB::AuthenticationMap* authenticationMap = (options && options->getAuthenticationMap()) ?
options->getAuthenticationMap() :
osgDB::Registry::instance()->getAuthenticationMap();
if (authenticationMap != NULL) {
const osgDB::AuthenticationDetails* details = authenticationMap->getAuthenticationDetails(hostname);
if (details == NULL) {
size_t pos = hostname.find(":");
if (pos != std::string::npos) {
details = authenticationMap->getAuthenticationDetails(hostname.substr(0, pos));
}
}
// configure authentication if required.
if (details != NULL)
{
OSG_NOTICE << "Passing in password = " << details->password << std::endl;
const osgDB::AuthenticationDetails* details = authenticationMap ?
authenticationMap->getAuthenticationDetails(hostname) :
0;
// configure authentication if required.
if (details)
{
OSG_NOTICE<<"Passing in password = "<<details->password<<std::endl;
image->_username = details->username;
image->_password = details->password;
image->_username = details->username;
image->_password = details->password;
}
}
if (options && !options->getOptionString().empty())
{
image->_optionString = options->getOptionString();