[yast-commit] r59192 - in /branches/SuSE-Code-11-Branch/ldap-server/src/lib: slapd-config.cpp slapd-config.h
![](https://seccdn.libravatar.org/avatar/0dddba71f3ed8a18896e852e75c1a9e5.jpg?s=120&d=mm&r=g)
Author: rhafer Date: Mon Oct 26 10:51:22 2009 New Revision: 59192 URL: http://svn.opensuse.org/viewcvs/yast?rev=59192&view=rev Log: merged bnc#542165 fix from trunk Modified: branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.cpp branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.h Modified: branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.cpp?rev=59192&r1=59191&r2=59192&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.cpp (original) +++ branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.cpp Mon Oct 26 10:51:22 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,6 +1266,21 @@ { log_it(SLAPD_LOG_INFO, "OlcSchemaConfig::OlcSchemaConfig(const LDAPEntry &e) : OlcConfigEntry(e)"); std::string name(this->getStringValue("cn")); + 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() ) + { + throw std::runtime_error( "Entry '" + dn + "' does not define any objectclasses or attributetypes." ); + } if ( name[0] == '{' ) { std::string::size_type pos = name.find('}'); @@ -1277,8 +1294,24 @@ } 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-Branch/ldap-server/src/lib/slapd-config.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.h?rev=59192&r1=59191&r2=59192&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.h (original) +++ branches/SuSE-Code-11-Branch/ldap-server/src/lib/slapd-config.h Mon Oct 26 10:51:22 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