From 9f73a972fb8607d23e5cec2ca6943b954871f20a Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount <quanah@openldap.org> Date: Tue, 29 Sep 2009 23:35:03 +0000 Subject: [PATCH] Throw an exception when reading an unexpected LDIF record type --- contrib/ldapc++/src/LdifReader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/ldapc++/src/LdifReader.cpp b/contrib/ldapc++/src/LdifReader.cpp index d6dc1bcc4c..31cf76baa1 100644 --- a/contrib/ldapc++/src/LdifReader.cpp +++ b/contrib/ldapc++/src/LdifReader.cpp @@ -179,11 +179,12 @@ int LdifReader::readNextRecord( bool first ) LDAPEntry LdifReader::getEntryRecord() { + std::list<stringpair>::const_iterator i = m_currentRecord.begin(); if ( m_curRecType != LDAPMsg::SEARCH_ENTRY ) { - // Error + throw( std::runtime_error( "The LDIF record: '" + i->second + + "' is not a valid LDAP Entry" )); } - std::list<stringpair>::const_iterator i = m_currentRecord.begin(); LDAPEntry resEntry(i->second); i++; LDAPAttribute curAttr(i->first); -- GitLab