From: Ralf Haferkamp Date: Mon, 17 Mar 2008 11:18:47 +0000 (+0000) Subject: Fixed parsing of URIs with missing host and/or port X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~81 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=adee18e1450005ea556f7829428f6c3aa6ce22eb;p=openldap Fixed parsing of URIs with missing host and/or port --- diff --git a/contrib/ldapc++/src/LDAPUrl.cpp b/contrib/ldapc++/src/LDAPUrl.cpp index 95b510af75..00b1aebe59 100644 --- a/contrib/ldapc++/src/LDAPUrl.cpp +++ b/contrib/ldapc++/src/LDAPUrl.cpp @@ -163,7 +163,7 @@ void LDAPUrl::parseUrl() DEBUG(LDAP_DEBUG_TRACE, "LDAPUrl::parseUrl()" << std::endl); // reading Scheme 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) { throw LDAPUrlException(LDAPUrlException::INVALID_URL, "No colon found in URL"); @@ -190,6 +190,7 @@ void LDAPUrl::parseUrl() startpos = pos + 3; } if ( m_urlString[startpos] == '/' ) { + // no hostname and port startpos++; } else { pos = m_urlString.find('/', startpos); @@ -222,8 +223,8 @@ void LDAPUrl::parseUrl() DEBUG(LDAP_DEBUG_TRACE, " Port: <" << m_Port << ">" << std::endl); } + startpos = pos + 1; } - startpos = pos + 1; int parserMode = base; while ( pos != std::string::npos ) { pos = m_urlString.find('?', startpos);