Skip to content
Snippets Groups Projects
Commit 292a990f authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

Fixed parsing of URIs with missing host and/or port

parent c1fd063f
No related branches found
No related tags found
No related merge requests found
...@@ -163,7 +163,7 @@ void LDAPUrl::parseUrl() ...@@ -163,7 +163,7 @@ void LDAPUrl::parseUrl()
DEBUG(LDAP_DEBUG_TRACE, "LDAPUrl::parseUrl()" << std::endl); DEBUG(LDAP_DEBUG_TRACE, "LDAPUrl::parseUrl()" << std::endl);
// reading Scheme // reading Scheme
std::string::size_type pos = m_urlString.find(':'); std::string::size_type pos = m_urlString.find(':');
std::string::size_type startpos = m_urlString.find(':'); std::string::size_type startpos = pos;
if (pos == std::string::npos) { if (pos == std::string::npos) {
throw LDAPUrlException(LDAPUrlException::INVALID_URL, throw LDAPUrlException(LDAPUrlException::INVALID_URL,
"No colon found in URL"); "No colon found in URL");
...@@ -190,6 +190,7 @@ void LDAPUrl::parseUrl() ...@@ -190,6 +190,7 @@ void LDAPUrl::parseUrl()
startpos = pos + 3; startpos = pos + 3;
} }
if ( m_urlString[startpos] == '/' ) { if ( m_urlString[startpos] == '/' ) {
// no hostname and port
startpos++; startpos++;
} else { } else {
pos = m_urlString.find('/', startpos); pos = m_urlString.find('/', startpos);
...@@ -222,8 +223,8 @@ void LDAPUrl::parseUrl() ...@@ -222,8 +223,8 @@ void LDAPUrl::parseUrl()
DEBUG(LDAP_DEBUG_TRACE, " Port: <" << m_Port << ">" DEBUG(LDAP_DEBUG_TRACE, " Port: <" << m_Port << ">"
<< std::endl); << std::endl);
} }
startpos = pos + 1;
} }
startpos = pos + 1;
int parserMode = base; int parserMode = base;
while ( pos != std::string::npos ) { while ( pos != std::string::npos ) {
pos = m_urlString.find('?', startpos); pos = m_urlString.find('?', startpos);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment