]> git.sur5r.net Git - openldap/commitdiff
Throw an exception when reading an unexpected LDIF record type
authorRalf Haferkamp <ralf@openldap.org>
Fri, 25 Sep 2009 15:08:37 +0000 (15:08 +0000)
committerRalf Haferkamp <ralf@openldap.org>
Fri, 25 Sep 2009 15:08:37 +0000 (15:08 +0000)
contrib/ldapc++/src/LdifReader.cpp

index d6dc1bcc4cbe74737586dd9efe89bdf97db2b88c..31cf76baa13be47d2bee82f80c9c419ade757dd2 100644 (file)
@@ -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);