[yast-commit] r48653 - in /trunk/ldap-server/src: LdapServer.pm agent/SlapdConfigAgent.cc complex.ycp
Author: rhafer Date: Fri Jun 27 16:00:50 2008 New Revision: 48653 URL: http://svn.opensuse.org/viewcvs/yast?rev=48653&view=rev Log: - reworked initial Schema loading to use ldif and schema Files directly instead of only adding include statements - add rfc2307bis by default Modified: trunk/ldap-server/src/LdapServer.pm trunk/ldap-server/src/agent/SlapdConfigAgent.cc trunk/ldap-server/src/complex.ycp Modified: trunk/ldap-server/src/LdapServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=48653&r1=48652&r2=48653&view=diff ============================================================================== --- trunk/ldap-server/src/LdapServer.pm (original) +++ trunk/ldap-server/src/LdapServer.pm Fri Jun 27 16:00:50 2008 @@ -763,12 +763,35 @@ ] }; - @schema = ( "core", "cosine", "inetorgperson" ); - SCR->Execute('.ldapserver.initGlobals' ); - SCR->Execute('.ldapserver.initSchema', \@schema ); + SCR->Execute('.ldapserver.initSchema' ); + my $rc = SCR->Write(".ldapserver.schema.addFromLdif", "/etc/openldap/schema/core.ldif" ); + if ( ! $rc ) { + my $err = SCR->Error(".ldapserver"); + $self->SetError( $err->{'summary'}, $err->{'description'} ); + return $rc; + } + $rc = SCR->Write(".ldapserver.schema.addFromLdif", "/etc/openldap/schema/cosine.ldif" ); + if ( ! $rc ) { + my $err = SCR->Error(".ldapserver"); + $self->SetError( $err->{'summary'}, $err->{'description'} ); + return $rc; + } + $rc = SCR->Write(".ldapserver.schema.addFromLdif", "/etc/openldap/schema/inetorgperson.ldif" ); + if ( ! $rc ) { + my $err = SCR->Error(".ldapserver"); + $self->SetError( $err->{'summary'}, $err->{'description'} ); + return $rc; + } + $rc = SCR->Write(".ldapserver.schema.addFromSchemafile", "/etc/openldap/schema/rfc2307bis.schema" ); + if ( ! $rc ) { + my $err = SCR->Error(".ldapserver"); + $self->SetError( $err->{'summary'}, $err->{'description'} ); + return $rc; + } + SCR->Execute('.ldapserver.initDatabases', [ $frontenddb, $cfgdatabase, $database ] ); - my $rc = SCR->Read('.ldapserver.databases'); + $rc = SCR->Read('.ldapserver.databases'); if ( $dbDefaults{'defaultIndex'} == 1 ) { foreach my $idx ( @defaultIndexes ) Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfigAgent.cc?rev=48653&r1=48652&r2=48653&view=diff ============================================================================== --- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original) +++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Fri Jun 27 16:00:50 2008 @@ -180,12 +180,6 @@ else if ( path->component_str(0) == "initSchema" ) { schemaBase = boost::shared_ptr<OlcSchemaConfig>(new OlcSchemaConfig() ); - YCPList schemaList = arg->asList(); - for ( int i = 0; i < schemaList->size(); i++ ) - { - y2milestone("Schemafile to include: %s", schemaList->value(i)->asString()->value_cstr() ); - } - } else if ( path->component_str(0) == "initDatabases" ) { @@ -918,12 +912,14 @@ { LDAPEntry entry, oldEntry; entry = ldif.getEntryRecord(); + y2milestone("adding <%s> to SchemaList", entry.getDN().c_str() ); schema.push_back( boost::shared_ptr<OlcSchemaConfig>(new OlcSchemaConfig(oldEntry, entry)) ); } return YCPBoolean(true); } catch ( std::runtime_error e ) { + std::string errstring = "Error while parsing LDIF file: " + filename; lastError->add(YCPString("summary"), - YCPString("Error while parsing LDIF file") ); + YCPString(errstring) ); lastError->add(YCPString("description"), YCPString(std::string( e.what() ) ) ); return YCPBoolean(false); @@ -1030,15 +1026,15 @@ YCPString SlapdConfigAgent::ConfigToLdif() const { y2milestone("ConfigToLdif"); - OlcDatabaseList::const_iterator i = databases.begin(); std::ostringstream ldif; ldif << globals->toLdif() << std::endl; ldif << schemaBase->toLdif() << std::endl; - LdifWriter writer(ldif); - writer.writeIncludeRecord("/etc/openldap/schema/core.ldif"); - writer.writeIncludeRecord("/etc/openldap/schema/cosine.ldif"); - writer.writeIncludeRecord("/etc/openldap/schema/inetorgperson.ldif"); - ldif << std::endl; + OlcSchemaList::const_iterator j; + for ( j = schema.begin(); j != schema.end() ; j++ ) + { + ldif << (*j)->toLdif() << std::endl; + } + OlcDatabaseList::const_iterator i = databases.begin(); for ( ; i != databases.end(); i++ ) { ldif << (*i)->toLdif() << std::endl; Modified: trunk/ldap-server/src/complex.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/complex.ycp?rev=48653&r1=48652&r2=48653&view=diff ============================================================================== --- trunk/ldap-server/src/complex.ycp (original) +++ trunk/ldap-server/src/complex.ycp Fri Jun 27 16:00:50 2008 @@ -469,8 +469,11 @@ } else if ( ret == `next ) { - LdapServer::ReadFromDefaults(); - ret = `next; + if ( ! LdapServer::ReadFromDefaults() ) + { + DisplayError( LdapServer::GetError() ); + ret = `abort; + } break; } else if ( ret == `back ) -- 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