Author: rhafer
Date: Tue Jun 7 16:45:48 2011
New Revision: 64265
URL: http://svn.opensuse.org/viewcvs/yast?rev=64265&view=rev
Log:
ReadSyncRepl() can return multiple syncrepl definitions
Modified:
branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapDatabase.ycp
branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapServer.pm
branches/SuSE-Code-11-SP2-Branch/ldap-server/src/agent/SlapdConfigAgent.cc
branches/SuSE-Code-11-SP2-Branch/ldap-server/src/dialogs.ycp
branches/SuSE-Code-11-SP2-Branch/ldap-server/src/tree_structure.ycp
Modified: branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapDatabase.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapDatabase.ycp?rev=64265&r1=64264&r2=64265&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapDatabase.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapDatabase.ycp Tue Jun 7 16:45:48 2011
@@ -1428,93 +1428,95 @@
{
term widget =
`Top(
- `HSquash(
- `VBox(
- `VSpacing(0.5),
- `Left(
- `CheckBox( `id( `cb_syncrepl ), `opt(`notify), _("This database is a Replication Consumer"), false )
- ),
- `VSpacing(0.3),
- `VBox( `id( `f_synccons ),
+ `ReplacePoint( `id( `syncConsWidget ),
+ `HSquash(
+ `VBox(
+ `VSpacing(0.5),
`Left(
- `VSquash(
- `HBox(
- `ComboBox( `id( `cb_sync_prot ), `opt(`notify), _("Protocol"), [ "ldap", "ldaps" ] ),
- `HSpacing(),
- `InputField( `id( `te_sync_target ), `opt(`hstretch), _("Provider Name"), "" ),
- `HSpacing(),
- `HSquash(
- `IntField( `id(`if_sync_port), _("Port"), 0, 65536, 389)
- ),
- `HSpacing(),
- `VBox(
- `Bottom(
- `CheckBox( `id( `cb_start_tls ), _("Use StartTLS"), true )
- ),
- `VSpacing(0.3)
- )
- )
- )
+ `CheckBox( `id( `cb_syncrepl ), `opt(`notify), _("This database is a Replication Consumer"), false )
),
`VSpacing(0.3),
- `Left(
- `HBox(
- `ComboBox( `id( `cb_sync_type ), `opt(`notify),
- _("Replication Type"), [ "refreshAndPersist", "refreshOnly" ] ),
- `HSpacing(),
+ `VBox( `id( `f_synccons ),
+ `Left(
`VSquash(
- `HBox( `id( `hb_rep_interval ),
- `VBox(
- `Bottom(
- `Label( _("Replication Interval") )
- )
- ),
- `HSpacing(),
- `HSquash(
- `IntField( `id(`if_sync_int_d), _("Days"), 0, 99, 0)
- ),
+ `HBox(
+ `ComboBox( `id( `cb_sync_prot ), `opt(`notify), _("Protocol"), [ "ldap", "ldaps" ] ),
`HSpacing(),
- `HSquash(
- `IntField( `id(`if_sync_int_h), _("Hours"), 0, 23, 0)
- ),
+ `InputField( `id( `te_sync_target ), `opt(`hstretch), _("Provider Name"), "" ),
`HSpacing(),
`HSquash(
- `IntField( `id(`if_sync_int_m), _("Minutes"), 0, 59, 0)
+ `IntField( `id(`if_sync_port), _("Port"), 0, 65536, 389)
),
`HSpacing(),
- `HSquash(
- `IntField( `id(`if_sync_int_s), _("Seconds"), 0, 59, 0)
- ),
- `HStretch()
+ `VBox(
+ `Bottom(
+ `CheckBox( `id( `cb_start_tls ), _("Use StartTLS"), true )
+ ),
+ `VSpacing(0.3)
+ )
)
)
- )
- ),
- `VSpacing(0.3),
- `Left(
- `HBox(
- `InputField( `id( `te_sync_binddn ), `opt(`hstretch), _("Authentication DN"), "" ),
- `HSpacing(),
- `Password( `id( `te_sync_cred ), `opt(`hstretch), _("Password"), "" )
- )
- ),
- `VSpacing(0.3),
- `Left(
- `VSquash(
+ ),
+ `VSpacing(0.3),
+ `Left(
`HBox(
- `VBox(
- `Bottom(
- `CheckBox( `id( `cb_update_ref ), `opt(`notify), _("Custom update referral") )
- ),
- `VSpacing(0.3)
- ),
- `HSpacing(),
- `ComboBox( `id( `cb_updateref_prot ), `opt(`notify), _("Protocol"), [ "ldap", "ldaps" ] ),
+ `ComboBox( `id( `cb_sync_type ), `opt(`notify),
+ _("Replication Type"), [ "refreshAndPersist", "refreshOnly" ] ),
`HSpacing(),
- `InputField( `id( `te_updateref_target ), `opt(`hstretch), _("Target Host"), "" ),
+ `VSquash(
+ `HBox( `id( `hb_rep_interval ),
+ `VBox(
+ `Bottom(
+ `Label( _("Replication Interval") )
+ )
+ ),
+ `HSpacing(),
+ `HSquash(
+ `IntField( `id(`if_sync_int_d), _("Days"), 0, 99, 0)
+ ),
+ `HSpacing(),
+ `HSquash(
+ `IntField( `id(`if_sync_int_h), _("Hours"), 0, 23, 0)
+ ),
+ `HSpacing(),
+ `HSquash(
+ `IntField( `id(`if_sync_int_m), _("Minutes"), 0, 59, 0)
+ ),
+ `HSpacing(),
+ `HSquash(
+ `IntField( `id(`if_sync_int_s), _("Seconds"), 0, 59, 0)
+ ),
+ `HStretch()
+ )
+ )
+ )
+ ),
+ `VSpacing(0.3),
+ `Left(
+ `HBox(
+ `InputField( `id( `te_sync_binddn ), `opt(`hstretch), _("Authentication DN"), "" ),
`HSpacing(),
- `HSquash(
- `IntField( `id(`if_updateref_port), _("Port"), 0, 65536, 389)
+ `Password( `id( `te_sync_cred ), `opt(`hstretch), _("Password"), "" )
+ )
+ ),
+ `VSpacing(0.3),
+ `Left(
+ `VSquash(
+ `HBox(
+ `VBox(
+ `Bottom(
+ `CheckBox( `id( `cb_update_ref ), `opt(`notify), _("Custom update referral") )
+ ),
+ `VSpacing(0.3)
+ ),
+ `HSpacing(),
+ `ComboBox( `id( `cb_updateref_prot ), `opt(`notify), _("Protocol"), [ "ldap", "ldaps" ] ),
+ `HSpacing(),
+ `InputField( `id( `te_updateref_target ), `opt(`hstretch), _("Target Host"), "" ),
+ `HSpacing(),
+ `HSquash(
+ `IntField( `id(`if_updateref_port), _("Port"), 0, 65536, 389)
+ )
)
)
)
Modified: branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapServer.pm
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapServer.pm?rev=64265&r1=64264&r2=64265&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapServer.pm (original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-server/src/LdapServer.pm Tue Jun 7 16:45:48 2011
@@ -1981,8 +1981,9 @@
# syncrepl related ACL and move it to the top. This is to ensure
# that syncrepl clients have read access to everything
my $syncrepl = $self->ReadSyncRepl( $dbIndex );
- if ( $syncrepl && scalar(keys %{$syncrepl}) && $syncrepl->{'binddn'} ne "" )
+ if ( @$syncrepl > 0 && scalar(keys %{$syncrepl->[0]}) && $syncrepl->[0]->{'binddn'} ne "" )
{
+ my $binddn = $syncrepl->[0]->{'binddn'};
my $acllist_sorted=[];
my $syncacl={};
my $found=0;
@@ -1996,7 +1997,7 @@
foreach my $access ( @{$rule->{'access'}} )
{
if ( $access->{'type'} eq "dn.base" &&
- lc($access->{'value'}) eq lc($syncrepl->{'binddn'} ) &&
+ lc($access->{'value'}) eq lc( $binddn ) &&
($access->{'level'} eq "read" || $access->{'level'} eq "write")
)
{
@@ -2214,35 +2215,38 @@
return YaST::YCP::Boolean(1);
}
-BEGIN { $TYPEINFO {ReadSyncRepl} = ["function", [ "map" , "string", "any" ], "integer" ]; }
+BEGIN { $TYPEINFO {ReadSyncRepl} = ["function", [ "list" , [ "map", "string", "any" ] ], "integer" ]; }
sub ReadSyncRepl
{
my ($self, $index) = @_;
y2milestone("ReadSyncRepl ", $index);
- my $syncrepl = SCR->Read(".ldapserver.database.{".$index."}.syncrepl" );
- y2debug( "SyncRepl: ".Data::Dumper->Dump([$syncrepl]) );
- if ( ! $syncrepl )
+ my $syncreplList = SCR->Read(".ldapserver.database.{".$index."}.syncrepl" );
+ y2debug( "SyncRepl: ".Data::Dumper->Dump([$syncreplList]) );
+ if ( ! $syncreplList )
{
my $err = SCR->Error(".ldapserver");
$self->SetError( $err->{'summary'}, $err->{'description'} );
return undef;
}
- if (defined $syncrepl->{'provider'} && defined $syncrepl->{'provider'}->{'port'} )
+ foreach my $syncrepl (@{$syncreplList})
{
- $syncrepl->{'provider'}->{'port'} = YaST::YCP::Integer( $syncrepl->{'provider'}->{'port'} );
- }
- if ( defined $syncrepl->{'interval'} )
- {
- $syncrepl->{'interval'}->{'days'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'days'} );
- $syncrepl->{'interval'}->{'hours'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'hours'} );
- $syncrepl->{'interval'}->{'mins'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'mins'} );
- $syncrepl->{'interval'}->{'secs'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'secs'} );
- }
- if ( defined $syncrepl->{'starttls'} )
- {
- $syncrepl->{'starttls'} = YaST::YCP::Boolean( $syncrepl->{'starttls'} );
+ if (defined $syncrepl->{'provider'} && defined $syncrepl->{'provider'}->{'port'} )
+ {
+ $syncrepl->{'provider'}->{'port'} = YaST::YCP::Integer( $syncrepl->{'provider'}->{'port'} );
+ }
+ if ( defined $syncrepl->{'interval'} )
+ {
+ $syncrepl->{'interval'}->{'days'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'days'} );
+ $syncrepl->{'interval'}->{'hours'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'hours'} );
+ $syncrepl->{'interval'}->{'mins'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'mins'} );
+ $syncrepl->{'interval'}->{'secs'} = YaST::YCP::Integer( $syncrepl->{'interval'}->{'secs'} );
+ }
+ if ( defined $syncrepl->{'starttls'} )
+ {
+ $syncrepl->{'starttls'} = YaST::YCP::Boolean( $syncrepl->{'starttls'} );
+ }
}
- return $syncrepl;
+ return $syncreplList;
}
BEGIN { $TYPEINFO {WriteSyncRepl} = ["function", "boolean" , "integer", ["map", "string", "any" ] ]; }
Modified: branches/SuSE-Code-11-SP2-Branch/ldap-server/src/agent/SlapdConfigAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-server/src/agent/SlapdConfigAgent.cc?rev=64265&r1=64264&r2=64265&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-server/src/agent/SlapdConfigAgent.cc (original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-server/src/agent/SlapdConfigAgent.cc Tue Jun 7 16:45:48 2011
@@ -884,31 +884,32 @@
}
else if ( dbComponent == "syncrepl" )
{
- YCPMap resMap;
+ YCPList resList;
OlcSyncReplList srl = (*i)->getSyncRepl();
- if ( ! srl.empty() )
+ OlcSyncReplList::const_iterator sr;
+ for ( sr = srl.begin(); sr != srl.end(); sr++ )
{
- boost::shared_ptr<OlcSyncRepl> sr = *srl.begin();
- resMap.add( YCPString(OlcSyncRepl::RID), YCPInteger( sr->getRid() ));
+ YCPMap resMap;
+ resMap.add( YCPString(OlcSyncRepl::RID), YCPInteger( (*sr)->getRid() ));
std::string proto,host;
int port;
- sr->getProviderComponents(proto, host, port);
+ (*sr)->getProviderComponents(proto, host, port);
YCPMap providerMap;
providerMap.add( YCPString("protocol"), YCPString(proto) );
providerMap.add( YCPString("target"), YCPString(host) );
providerMap.add( YCPString("port"), YCPInteger(port) );
resMap.add( YCPString(OlcSyncRepl::PROVIDER), providerMap );
- resMap.add( YCPString(OlcSyncRepl::TYPE), YCPString( sr->getType() ));
- if ( sr->getStartTls() != OlcSyncRepl::StartTlsNo )
+ resMap.add( YCPString(OlcSyncRepl::TYPE), YCPString( (*sr)->getType() ));
+ if ( (*sr)->getStartTls() != OlcSyncRepl::StartTlsNo )
{
resMap.add( YCPString(OlcSyncRepl::STARTTLS), YCPBoolean( true ));
}
- if ( sr->getType() == "refreshOnly" )
+ if ( (*sr)->getType() == "refreshOnly" )
{
YCPMap intervalMap;
int d,h,m,s;
- sr->getInterval(d, h, m, s);
+ (*sr)->getInterval(d, h, m, s);
intervalMap.add( YCPString("days"), YCPInteger(d) );
intervalMap.add( YCPString("hours"), YCPInteger(h) );
intervalMap.add( YCPString("mins"), YCPInteger(m) );
@@ -916,11 +917,12 @@
resMap.add( YCPString( OlcSyncRepl::INTERVAL ), intervalMap );
}
- resMap.add( YCPString(OlcSyncRepl::BINDDN), YCPString( sr->getBindDn() ));
- resMap.add( YCPString(OlcSyncRepl::CREDENTIALS), YCPString( sr->getCredentials()));
- resMap.add( YCPString(OlcSyncRepl::BASE), YCPString( sr->getSearchBase()));
+ resMap.add( YCPString(OlcSyncRepl::BINDDN), YCPString( (*sr)->getBindDn() ));
+ resMap.add( YCPString(OlcSyncRepl::CREDENTIALS), YCPString( (*sr)->getCredentials()));
+ resMap.add( YCPString(OlcSyncRepl::BASE), YCPString( (*sr)->getSearchBase()));
+ resList.add(resMap);
}
- return resMap;
+ return resList;
}
else if ( dbComponent == "updateref" )
{
Modified: branches/SuSE-Code-11-SP2-Branch/ldap-server/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ldap-server/src/dialogs.ycp?rev=64265&r1=64264&r2=64265&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP2-Branch/ldap-server/src/dialogs.ycp (original)
+++ branches/SuSE-Code-11-SP2-Branch/ldap-server/src/dialogs.ycp Tue Jun 7 16:45:48 2011
@@ -876,7 +876,7 @@
continue;
}
// Check if the syncrepl config of cn=config makes sense
- map