[yast-commit] r58800 - in /branches/SuSE-Code-11-SP1-Branch/ldap-server: ./ src/lib/slapd-config.cpp src/lib/slapd-config.h
Author: rhafer Date: Mon Sep 28 11:31:13 2009 New Revision: 58800 URL: http://svn.opensuse.org/viewcvs/yast?rev=58800&view=rev Log: merged recent bugfixes from trunk (bnc#542165, bnc#541819) Modified: branches/SuSE-Code-11-SP1-Branch/ldap-server/ (props changed) branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.cpp branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.h Modified: branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.cpp?rev=58800&r1=58799&r2=58800&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.cpp (original) +++ branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.cpp Mon Sep 28 11:31:13 2009 @@ -1253,6 +1253,8 @@ tls.applySettings( *this ); } +const std::string OlcSchemaConfig::schemabase = "cn=schema,cn=config"; + OlcSchemaConfig::OlcSchemaConfig() : OlcConfigEntry() { m_dbEntryChanged.setDN("cn=schema,cn=config"); @@ -1264,21 +1266,44 @@ { log_it(SLAPD_LOG_INFO, "OlcSchemaConfig::OlcSchemaConfig(const LDAPEntry &e) : OlcConfigEntry(e)"); std::string name(this->getStringValue("cn")); - if ( name[0] == '{' ) + std::string dn(e.getDN() ); + if ( name.empty() ) + { + throw std::runtime_error( "Entry '" + dn + "' has no 'cn' Attribute." ); + } + if ( (dn.size() < schemabase.size()) || + (dn.compare( dn.size()-schemabase.size(), schemabase.size(), schemabase )) ) + { + throw std::runtime_error( "Entry '" + dn + "' is not a child of '" + schemabase + "'." ); + } + if ( this->getStringValues("olcobjectclasses").empty() && + this->getStringValues("olcattributetypes").empty() ) { - std::string::size_type pos = name.find('}'); - std::istringstream indexstr(name.substr(1, pos-1)); - indexstr >> entryIndex; - m_name = name.substr( pos+1, std::string::npos ); - } else { - m_name = name; - entryIndex = 0; + throw std::runtime_error( "Entry '" + dn + "' does not define any objectclasses or attributetypes." ); } + + entryIndex = splitIndexFromString( name, m_name ); } OlcSchemaConfig::OlcSchemaConfig(const LDAPEntry &e1, const LDAPEntry &e2) : OlcConfigEntry(e1, e2) { - log_it(SLAPD_LOG_INFO, "OlcSchemaConfig::OlcSchemaConfig(const LDAPEntry &e) : OlcConfigEntry(e)"); + log_it(SLAPD_LOG_INFO, "OlcSchemaConfig::OlcSchemaConfig(const LDAPEntry &e1, const LDAPEntry &e2) : OlcConfigEntry(e1, e2)" ); std::string name(this->getStringValue("cn")); + std::string dn(e2.getDN() ); + if ( name.empty() ) + { + throw std::runtime_error( "Entry '" + dn + "' has no 'cn' Attribute." ); + } + if ( (dn.size() < schemabase.size()) || + (dn.compare( dn.size()-schemabase.size(), schemabase.size(), schemabase )) ) + { + throw std::runtime_error( "Entry '" + dn + "' is not a child of '" + schemabase + "'." ); + } + if ( this->getStringValues("olcobjectclasses").empty() && + this->getStringValues("olcattributetypes").empty() ) + { + throw std::runtime_error( "Entry '" + dn + "' does not define any objectclasses or attributetypes." ); + } + entryIndex = splitIndexFromString( name, m_name ); } Modified: branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.h?rev=58800&r1=58799&r2=58800&view=diff ============================================================================== --- branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.h (original) +++ branches/SuSE-Code-11-SP1-Branch/ldap-server/src/lib/slapd-config.h Mon Sep 28 11:31:13 2009 @@ -292,6 +292,7 @@ virtual void clearChangedEntry(); const std::string& getName() const; const std::vector<LDAPAttrType> getAttributeTypes() const; + static const std::string schemabase; protected: virtual void updateEntryDn( bool origEntry = false); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
rhafer@svn.opensuse.org