Author: rhafer
Date: Tue Feb 9 16:58:06 2010
New Revision: 60775
URL: http://svn.opensuse.org/viewcvs/yast?rev=60775&view=rev
Log:
Merged syncprov support from sle-sp1 branch. Revisions 58621-58962. More
to come.
Modified:
trunk/ldap-server/ (props changed)
trunk/ldap-server/src/LdapDatabase.ycp
trunk/ldap-server/src/LdapServer.pm
trunk/ldap-server/src/agent/SlapdConfigAgent.cc
trunk/ldap-server/src/lib/slapd-config.cpp
trunk/ldap-server/src/lib/slapd-config.h
trunk/ldap-server/src/tree_structure.ycp
Modified: trunk/ldap-server/src/LdapDatabase.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapDatabase.ycp?rev=60775&r1=60774&r2=60775&view=diff
==============================================================================
--- trunk/ldap-server/src/LdapDatabase.ycp (original)
+++ trunk/ldap-server/src/LdapDatabase.ycp Tue Feb 9 16:58:06 2010
@@ -624,10 +624,10 @@
return selected;
}
- map whatId2String = $[
- `dn_all : [ _("All Entries"), "*" ],
- `dn_subtree : [ _("All Entries in the subtree"), "subtree" ],
- `dn_base : [ _("The Entry with the DN"), "base" ]
+ map whatString2Label = $[
+ "*" : _("All Entries"),
+ "subtree" : _("All Entries in the subtree"),
+ "base" : _("The Entry with the DN")
];
map whoId2String = $[
@@ -669,6 +669,9 @@
"manage" : `access_manage
];
+ /*
+ * Popup to add/edit the acl "by" clauses
+ */
global map AddAclAccess(string suffix, map access)
{
list itemlist = [];
@@ -705,6 +708,13 @@
`Left(
`ComboBox( `id(`cb_access), _("Define the Access Level"), access_itemlist)
),
+ `RadioButtonGroup(`id(`rbg_aclcontrol),
+ `VBox(
+ `Left(`RadioButton(`id( "stop" ), _("Stop Access Control evaluation here (default)"), true )),
+ `Left(`RadioButton(`id( "break" ), _("Continue with next Access Control rule (\"break\")") )),
+ `Left(`RadioButton(`id( "continue" ), _("Continue evaluation of this rule (\"continue\")") ))
+ )
+ ),
`HBox(
Wizard::CancelOKButtonBox()
)
@@ -721,6 +731,7 @@
{
UI::ChangeWidget( `id( `cb_who), `Value, access["type"]:`nil );
UI::ChangeWidget( `id( `cb_access), `Value, access["level"]:`nil );
+ UI::ChangeWidget( `id( `rbg_aclcontrol), `CurrentButton, access["control"]:"stop" );
if ( access["type"]:`nil == `who_dn ||
access["type"]:`nil == `who_dn_subtree ||
access["type"]:`nil == `who_group )
@@ -760,6 +771,8 @@
}
res["level"] = UI::QueryWidget( `id( `cb_access ), `Value );
+ res["control"] = (string) UI::QueryWidget( `id( `rbg_aclcontrol ), `CurrentButton );
+
break;
}
else if ( ret == `cancel )
@@ -806,9 +819,9 @@
global map AddAclTarget(string suffix, map acl)
{
list itemlist = [];
- foreach( symbol i, [ `dn_all, `dn_subtree, `dn_base ],
+ foreach( string k, string v, whatString2Label,
{
- itemlist = add(itemlist, `item( `id( i ), whatId2String[i,0]:"" ) );
+ itemlist = add(itemlist, `item( `id( k ), v ) );
}
);
term addAclWidget =
@@ -858,7 +871,7 @@
`VBox(
`HBox(
`MinSize( 60, 7,
- `Table( `id( `tab_access ),`opt(`keepSorting), `header(_("Who"), _("DN"),_("Access Level") ) )
+ `Table( `id( `tab_access ),`opt(`keepSorting), `header(_("Who"), _("DN"),_("Access Level"), _("Flow Control") ) )
),
`VBox(
`PushButton( `id (`pb_up ), _("Up") ),
@@ -885,20 +898,20 @@
if ( acl != nil )
{
- UI::ChangeWidget( `id( `cb_what ), `Value, acl["target","what"]:`dn_all );
- if ( acl["target","what"]:`nil == `dn_base )
+ UI::ChangeWidget( `id( `cb_what ), `Value, acl["target","what"]:"*" );
+ if ( acl["target","what"]:"" == "base" )
{
UI::ChangeWidget( `id (`te_dn ), `Enabled, true );
UI::ChangeWidget( `id (`pb_dn ), `Enabled, true );
UI::ChangeWidget( `id (`te_dn ), `Value, acl["target","dn"]:"" );
}
- else if ( acl["target","what"]:`nil == `dn_subtree )
+ else if ( acl["target","what"]:"" == "subtree" )
{
UI::ChangeWidget( `id (`te_dn ), `Enabled, true );
UI::ChangeWidget( `id (`te_dn ), `Value, acl["target","dn"]:"" );
UI::ChangeWidget( `id (`te_dn ), `Label, _("Subtree DN") );
}
- else if ( acl["target","what"]:`nil == `dn_all )
+ else if ( acl["target","what"]:"" == "*" )
{
UI::ChangeWidget( `id (`te_dn ), `Enabled, false );
UI::ChangeWidget( `id (`pb_dn ), `Enabled, false );
@@ -931,7 +944,7 @@
{
UI::ChangeWidget( `id( `te_dn ), `Enabled, false );
UI::ChangeWidget( `id( `pb_dn ), `Enabled, false );
- UI::ChangeWidget( `id( `cb_what ), `Value, `dn_all );
+ UI::ChangeWidget( `id( `cb_what ), `Value, "*" );
UI::ChangeWidget( `id( `cb_filter ), `Value, false );
UI::ChangeWidget( `id( `te_filter ), `Enabled, false );
UI::ChangeWidget( `id( `cb_attrs ), `Value, false );
@@ -951,7 +964,13 @@
list itemlist = maplist (map v, accesslist,
{
pos=pos+1;
- return `item( `id(pos), whoId2String[v["type"]:`none,0]:"", v["value"]:"", accessId2String[v["level"]:`none,0]:"");
+ return `item(
+ `id(pos),
+ whoId2String[v["type"]:`none,0]:"",
+ v["value"]:"",
+ accessId2String[v["level"]:`none,0]:"",
+ v["control"]:"stop"
+ );
}
);
UI::ChangeWidget( `tab_access, `Items, itemlist) ;
@@ -967,7 +986,7 @@
map what = $[];
what["what"] = UI::QueryWidget( `id( `cb_what ), `Value );
what["dn"] = UI::QueryWidget( `id( `te_dn ), `Value );
- if ( (what["what"]:`nil == `dn_base || what["what"]:`nil == `dn_subtree ) )
+ if ( (what["what"]:"" == "base" || what["what"]:"" == "subtree" ) )
{
if ( ! LdapServer::ValidateDn( what["dn"]:"" ) )
{
@@ -1020,17 +1039,17 @@
}
else if ( ret == `cb_what )
{
- symbol cb_val = (symbol)UI::QueryWidget( `id(`cb_what), `Value );
- if ( cb_val == `dn_all )
+ string cb_val = (string)UI::QueryWidget( `id(`cb_what), `Value );
+ if ( cb_val == "*" )
{
UI::ChangeWidget( `id( `te_dn ), `Enabled, false );
UI::ChangeWidget( `id( `pb_dn ), `Enabled, false );
}
- else if ( cb_val == `dn_base || cb_val == `dn_subtree )
+ else if ( cb_val == "base" || cb_val == "subtree" )
{
UI::ChangeWidget( `id( `te_dn ), `Enabled, true );
UI::ChangeWidget( `id( `pb_dn ), `Enabled, true );
- if ( cb_val == `dn_subtree )
+ if ( cb_val == "subtree" )
{
UI::ChangeWidget( `id( `te_dn ), `Label, _("Subtree DN") );
}
@@ -1186,26 +1205,19 @@
resMap["access"] = [];
if ( size(targetMap) == 0 )
{
- resMap["target", "what"] = `dn_all;
+ resMap["target", "what"] = "*";
}
else
{
map dnMap = targetMap["dn"]:$[];
if (size(dnMap) > 0)
{
- if (dnMap["style"]:"" == "subtree" )
- {
- resMap["target", "what"] = `dn_subtree;
- }
- else if (dnMap["style"]:"" == "base" )
- {
- resMap["target", "what"] = `dn_base;
- }
+ resMap["target", "what"] = dnMap["style"]:"";
resMap["target", "dn"] = dnMap["value"]:"";
}
else
{
- resMap["target", "what"] = `dn_all;
+ resMap["target", "what"] = "*";
}
resMap["target", "filter"] = targetMap["filter"]:"";
resMap["target", "attrs"] = targetMap["attrs"]:"";
@@ -1217,6 +1229,7 @@
accessMap["level"] = accessString2Id[access["level"]:""]:`access_none;
accessMap["type"] = whoString2Id[access["type"]:""]:`nil;
accessMap["value"] = access["value"]:"";
+ accessMap["control"] = access["control"]:"";
accessList = add( accessList, accessMap );
}
);
@@ -1229,7 +1242,7 @@
{
pos=pos+1;
string dn="";
- if ( ( v["target","what"]:`dn_all != `dn_all) && ( v["target","dn"]:"" == "" ) )
+ if ( ( v["target","what"]:"*" != "*") && ( v["target","dn"]:"" == "" ) )
{
dn = "<Root-DSE>";
}
@@ -1238,7 +1251,7 @@
dn = v["target","dn"]:"";
}
return `item( `id(pos),
- whatId2String[v["target","what"]:`none,0]:"",
+ whatString2Label[v["target","what"]:""]:"",
dn,
v["target","filter"]:"",
v["target","attrs"]:"All Attributes"
@@ -1263,10 +1276,10 @@
y2milestone( "------------------------------" );
y2milestone( "ACL Target: %1", acl["target","what"]:`nil );
map targetmap = $[];
- if ( acl["target","what"]:`dn_all != `dn_all )
+ if ( acl["target","what"]:"*" != "*" )
{
map dn = $[
- "style" : whatId2String[ acl["target","what"]:`dn_base,1 ]:"",
+ "style" : acl["target","what"]:"",
"value" : acl["target","dn"]:""
];
targetmap["dn"] = dn;
@@ -1371,7 +1384,7 @@
{
pos=pos+1;
string dn="";
- if ( ( v["target","what"]:`dn_all != `dn_all) && ( v["target","dn"]:"" == "" ) )
+ if ( ( v["target","what"]:"*" != "*") && ( v["target","dn"]:"" == "" ) )
{
dn = "<Root-DSE>";
}
@@ -1380,7 +1393,7 @@
dn = v["target","dn"]:"";
}
return `item( `id(pos),
- whatId2String[v["target","what"]:`none,0]:"",
+ whatString2Label[v["target","what"]:""]:"",
dn,
v["target","filter"]:"",
v["target","attrs"]:"All Attributes"
@@ -1393,6 +1406,140 @@
return true;
}
+ global term GetSyncProvWidget()
+ {
+ term widget =
+ `Top(
+ `VBox(
+ `VSpacing(1),
+ `VBox(
+ `HBox(
+ `CheckBox( `id( `cb_synprov_enable ),`opt(`notify ),
+ _("Enable ldapsync provider for this database"), false
+ ),
+ `HSpacing( `opt(`hstretch))
+ ),
+ `VSpacing(0.5),
+ `Frame( `id( `f_sync_settings ), _("Checkpoint settings"),
+ `VBox(
+ `HBox(
+ `HSquash(
+ `IntField( `id( `if_syncprov_checkpoint_ops ),
+ _("Operations"), 0, 2000000000,0
+ )
+ ),
+ `HSpacing( 1 ),
+ `HSquash(
+ `IntField( `id( `if_syncprov_checkpoint_min ),
+ _("Minutes"), 0, 2000000000,0
+ )
+ ),
+ `HStretch()
+ )
+ )
+ ),
+ `VSpacing(0.5),
+ `Frame( `id( `f_sync_slog ), _("Session log"),
+ `VBox(
+ `Left(
+ `CheckBox( `id( `cb_sync_slog ), `opt(`notify),
+ _("Enable Session log") )
+ ),
+ `Left(
+ `HSquash(
+ `IntField( `id( `if_syncprov_sessionlog ),
+ _("Operations"), 0, 2000000000, 0
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ );
+ return widget;
+ }
+
+ global boolean DbSyncProvRead( symbol handler_cmd, integer index, map syncprov )
+ {
+ y2milestone("DbSyncProvRead %1 %2", handler_cmd, index );
+ if ( size(syncprov) == 0 )
+ {
+ UI::ChangeWidget( `cb_synprov_enable, `Value, false );
+ UI::ChangeWidget( `f_sync_settings, `Enabled , false );
+ UI::ChangeWidget( `f_sync_slog, `Enabled , false );
+ }
+ else
+ {
+ UI::ChangeWidget( `cb_synprov_enable, `Value, true );
+ if ( syncprov["checkpoint"]:nil != nil )
+ {
+ UI::ChangeWidget( `if_syncprov_checkpoint_ops, `Value , (integer)syncprov["checkpoint","ops"]:0 );
+ UI::ChangeWidget( `if_syncprov_checkpoint_min, `Value , (integer)syncprov["checkpoint","min"]:0 );
+ }
+ if ( syncprov["sessionlog"]:nil != nil )
+ {
+ UI::ChangeWidget( `cb_sync_slog, `Value, true );
+ UI::ChangeWidget( `if_syncprov_sessionlog, `Value, (integer)syncprov["sessionlog"]:0 );
+ }
+ else
+ {
+ UI::ChangeWidget( `if_syncprov_sessionlog, `Enabled , false );
+ }
+ }
+ return true;
+ }
+
+ global boolean DbSyncProvInput( symbol handler_cmd, integer index )
+ {
+ y2milestone("DbSyncProvInput %1 %2", handler_cmd, index);
+ if ( handler_cmd == `cb_synprov_enable )
+ {
+ if ( UI::QueryWidget( `cb_synprov_enable , `Value ) == true )
+ {
+ UI::ChangeWidget( `f_sync_settings, `Enabled , true );
+ UI::ChangeWidget( `f_sync_slog, `Enabled , true );
+ }
+ else
+ {
+ UI::ChangeWidget( `f_sync_settings, `Enabled , false );
+ UI::ChangeWidget( `f_sync_slog, `Enabled , false );
+ }
+ }
+ if ( UI::QueryWidget( `cb_sync_slog , `Value ) == true )
+ {
+ UI::ChangeWidget( `if_syncprov_sessionlog, `Enabled , true );
+ }
+ else
+ {
+ UI::ChangeWidget( `if_syncprov_sessionlog, `Enabled , false );
+ }
+ return true;
+ }
+
+ global map DbSyncProvWrite( integer index )
+ {
+ y2milestone("DbSyncProvWrite %1", index );
+ map syncprov = $[];
+ if( UI::QueryWidget( `cb_synprov_enable, `Value ) == true )
+ {
+ integer cp_ops = (integer) UI::QueryWidget( `if_syncprov_checkpoint_ops, `Value );
+ integer cp_min = (integer) UI::QueryWidget( `if_syncprov_checkpoint_min, `Value );
+ integer slog = (integer) UI::QueryWidget( `if_syncprov_sessionlog, `Value );
+ syncprov = add(syncprov, "enabled", true );
+ if ( cp_ops != 0 || cp_min != 0 )
+ {
+ map cp = $[ "ops" : cp_ops, "min" : cp_min ];
+ syncprov = add( syncprov, "checkpoint", cp );
+ }
+ if ( slog > 0 )
+ {
+ syncprov = add( syncprov, "sessionlog", slog );
+ }
+ }
+ return syncprov;
+ }
+
define symbol DbPpolicy()
{
string caption = _("Password Policy settings");
Modified: trunk/ldap-server/src/LdapServer.pm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=60775&r1=60774&r2=60775&view=diff
==============================================================================
--- trunk/ldap-server/src/LdapServer.pm (original)
+++ trunk/ldap-server/src/LdapServer.pm Tue Feb 9 16:58:06 2010
@@ -1686,6 +1686,7 @@
# 'type' => <'self'|'users'|'anoymous'|'*'|'group'|'dn.base'|'dn.subtree'>
# # if type is 'group', 'dn.base', 'dn.subtree':
# 'value' => <a valid LDAP DN>
+ # 'control' => <'stop'|'break'|'continue'> '
# ]
#
# }
@@ -1820,6 +1821,53 @@
return YaST::YCP::Boolean(1);
}
+BEGIN { $TYPEINFO {ReadSyncProv} = ["function", [ "map" , "string", "any" ], "integer" ]; }
+sub ReadSyncProv
+{
+ my ($self, $index) = @_;
+ y2milestone("ReadSyncProv ", $index);
+ my $syncprov = SCR->Read(".ldapserver.database.{".$index."}.syncprov" );
+ y2milestone( "Syncprov: ".Data::Dumper->Dump([$syncprov]) );
+ if (defined $syncprov->{'checkpoint'} )
+ {
+ $syncprov->{'checkpoint'} = {
+ "ops" => YaST::YCP::Integer( $syncprov->{'checkpoint'}->{'ops'}),
+ "min" => YaST::YCP::Integer( $syncprov->{'checkpoint'}->{'min'})
+ }
+ }
+ if (defined $syncprov->{'sessionlog'} )
+ {
+ $syncprov->{'sessionlog'} = YaST::YCP::Integer( $syncprov->{'sessionlog'} );
+ }
+ return $syncprov;
+}
+
+BEGIN { $TYPEINFO {WriteSyncProv} = ["function", "boolean" , "integer", ["map", "string", "any" ] ]; }
+sub WriteSyncProv
+{
+ my ( $self, $dbindex, $syncprov) = @_;
+ y2milestone("WriteSyncProv");
+ y2milestone("SyncProv: ".Data::Dumper->Dump([$syncprov]) );
+ if (defined $syncprov->{'checkpoint'} )
+ {
+ $syncprov->{'checkpoint'} = {
+ "ops" => YaST::YCP::Integer( $syncprov->{'checkpoint'}->{'ops'}),
+ "min" => YaST::YCP::Integer( $syncprov->{'checkpoint'}->{'min'})
+ }
+ }
+ if (defined $syncprov->{'sessionlog'} )
+ {
+ $syncprov->{'sessionlog'} = YaST::YCP::Integer( $syncprov->{'sessionlog'} );
+ }
+ if ( ! SCR->Write(".ldapserver.database.{".$dbindex."}.syncprov", $syncprov ) )
+ {
+ my $err = SCR->Error(".ldapserver");
+ $self->SetError( $err->{'summary'}, $err->{'description'} );
+ return YaST::YCP::Boolean(0);
+ }
+ return YaST::YCP::Boolean(1);
+}
+
BEGIN { $TYPEINFO {ReadSchemaList} = ["function", [ "list" , "string"] ]; }
sub ReadSchemaList
{
Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfigAgent.cc?rev=60775&r1=60774&r2=60775&view=diff
==============================================================================
--- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original)
+++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Tue Feb 9 16:58:06 2010
@@ -656,6 +656,34 @@
}
return resMap;
}
+ else if ( dbComponent == "syncprov" )
+ {
+ OlcOverlayList overlays = (*i)->getOverlays();
+ OlcOverlayList::const_iterator j = overlays.begin();
+ for (; j != overlays.end(); j++ )
+ {
+ if ( (*j)->getType() == "syncprov" && (*j)->getUpdatedDn() != "" )
+ {
+ boost::shared_ptr<OlcSyncProvOl> syncprovOlc = boost::dynamic_pointer_cast<OlcSyncProvOl>(*j);
+ int cp_ops,cp_min;
+ syncprovOlc->getCheckPoint(cp_ops, cp_min);
+ if ( cp_ops || cp_min )
+ {
+ YCPMap cpMap;
+ cpMap.add( YCPString("ops"), YCPInteger(cp_ops) );
+ cpMap.add( YCPString("min"), YCPInteger(cp_min) );
+ resMap.add( YCPString("checkpoint"), cpMap );
+ }
+ int slog;
+ if ( syncprovOlc->getSessionLog(slog) )
+ {
+ resMap.add( YCPString("sessionlog"), YCPInteger(slog) );
+ }
+ break;
+ }
+ }
+ return resMap;
+ }
else if ( dbComponent == "acl" )
{
YCPList resList;
@@ -1264,7 +1292,7 @@
if ( j == overlays.end() )
{
y2milestone("New Overlay added");
- boost::shared_ptr<OlcOverlay> tmp(new OlcOverlay("ppolicy", (*i)->getUpdatedDn()));
+ boost::shared_ptr<OlcOverlay> tmp(new OlcOverlay("ppolicy", (*i)->getUpdatedDn(), "olcPPolicyConfig") );
ppolicyOlc = tmp;
ppolicyOlc->setIndex( overlays.size() );
(*i)->addOverlay(ppolicyOlc);
@@ -1300,6 +1328,60 @@
}
ret = true;
}
+ else if ( dbComponent == "syncprov" )
+ {
+ OlcOverlayList overlays = (*i)->getOverlays();
+ OlcOverlayList::const_iterator j = overlays.begin();
+ for (; j != overlays.end(); j++ )
+ {
+ if ( (*j)->getType() == "syncprov" )
+ {
+ break;
+ }
+ }
+ YCPMap argMap = arg->asMap();
+ if ( j == overlays.end() && argMap.size() == 0 )
+ {
+ y2milestone("Empty overlay nothing to do");
+ }
+ else
+ {
+ boost::shared_ptr<OlcSyncProvOl> syncprovOlc;
+ if ( j == overlays.end() )
+ {
+ boost::shared_ptr<OlcSyncProvOl> tmp(new OlcSyncProvOl((*i)->getUpdatedDn()) );
+ syncprovOlc = tmp;
+ syncprovOlc->setIndex(0);
+ (*i)->addOverlay(syncprovOlc);
+ }
+ else
+ {
+ syncprovOlc = boost::dynamic_pointer_cast<OlcSyncProvOl>(*j);
+ }
+ if( argMap.size() == 0 )
+ {
+ syncprovOlc->clearChangedEntry();
+ }
+ else
+ {
+ if( ! argMap->value(YCPString("checkpoint")).isNull() )
+ {
+ YCPMap cpMap = argMap->value(YCPString("checkpoint"))->asMap();
+ syncprovOlc->setCheckPoint( cpMap->value(YCPString("ops"))->asInteger()->value(),
+ cpMap->value(YCPString("min"))->asInteger()->value() );
+ }
+ if( ! argMap->value(YCPString("sessionlog")).isNull() )
+ {
+ syncprovOlc->setSessionLog( argMap->value(YCPString("sessionlog"))->asInteger()->value() );
+ }
+ else
+ {
+ syncprovOlc->setStringValue( "olcSpSessionlog", "" );
+ }
+ }
+ }
+ ret = true;
+ }
else if ( dbComponent == "acl" )
{
YCPList argList = arg->asList();
Modified: trunk/ldap-server/src/lib/slapd-config.cpp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/slapd-config.cpp?rev=60775&r1=60774&r2=60775&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/slapd-config.cpp (original)
+++ trunk/ldap-server/src/lib/slapd-config.cpp Tue Feb 9 16:58:06 2010
@@ -361,6 +361,14 @@
OlcOverlay* OlcOverlay::createFromLdapEntry( const LDAPEntry& e)
{
+ StringList oc = e.getAttributeByName("objectclass")->getValues();
+ for( StringList::const_iterator i = oc.begin(); i != oc.end(); i++ )
+ {
+ if ( strCaseIgnoreEquals(*i, "olcSyncProvConfig" ) )
+ {
+ return new OlcSyncProvOl(e);
+ }
+ }
return new OlcOverlay(e);
}
@@ -371,13 +379,16 @@
entryIndex = splitIndexFromString( type, m_type );
}
-OlcOverlay::OlcOverlay( const std::string &type, const std::string &parent )
+OlcOverlay::OlcOverlay( const std::string &type, const std::string &parent, const std::string &oc )
: m_type(type), m_parent(parent)
{
std::ostringstream dnstr;
dnstr << "olcOverlay=" << m_type << "," << parent;
m_dbEntryChanged.setDN(dnstr.str());
- m_dbEntryChanged.addAttribute(LDAPAttribute("objectclass", "olcPpolicyConfig"));
+ if ( !oc.empty() )
+ {
+ m_dbEntryChanged.addAttribute( LDAPAttribute("objectclass", oc) );
+ }
m_dbEntryChanged.addAttribute(LDAPAttribute("olcoverlay", m_type));
}
@@ -420,6 +431,58 @@
}
}
+void OlcSyncProvOl::setCheckPoint( int ops, int min )
+{
+ if ( !ops && !min )
+ {
+ this->setStringValue( "olcSpCheckpoint", "" );
+ }
+ else
+ {
+ std::ostringstream oStr;
+ oStr << ops << " " << min;
+ this->setStringValue( "olcSpCheckpoint", oStr.str() );
+ }
+}
+
+void OlcSyncProvOl::getCheckPoint( int &ops, int &min) const
+{
+ ops=0;
+ min=0;
+ std::string checkpointStr = this->getStringValue("olcSpCheckpoint");
+ if (! checkpointStr.empty() )
+ {
+ std::istringstream iStr(checkpointStr);
+ iStr >> ops >> std::skipws >> min;
+ }
+ return;
+}
+
+void OlcSyncProvOl::setSessionLog( int slog )
+{
+ if ( slog > 0 )
+ {
+ std::ostringstream oStr;
+ oStr << slog;
+ this->setStringValue( "olcSpSessionLog", oStr.str() );
+ }
+}
+
+bool OlcSyncProvOl::getSessionLog( int &slog ) const
+{
+ std::string slogStr = this->getStringValue("olcSpSessionLog");
+ if (! slogStr.empty() )
+ {
+ std::istringstream iStr(slogStr);
+ iStr >> slog ;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
static int extractAlcToken( const std::string& acl, std::string::size_type& startpos, bool quoted )
{
std::string::size_type pos;
@@ -550,6 +613,7 @@
std::string type = "";
std::string value = "";
std::string level = "";
+ std::string control = "";
spos = tmppos+1;
// skip whitespaces
tmppos = aclString.find_first_not_of("\t ", spos );
@@ -602,9 +666,30 @@
level != "compare" && level != "read" &&
level != "write" && level != "manage" )
{
- throw std::runtime_error( "Unsupported access level" );
+ if ( level == "stop" || level == "break" || level == "continue" )
+ {
+ // it's ok to have no access level defined
+ control = level;
+ level = "";
+ }
+ else
+ {
+ throw std::runtime_error( "Unsupported access level" );
+ }
}
log_it(SLAPD_LOG_INFO, "access: " + level );
+ if ( control.empty() && tmppos != std::string::npos )
+ {
+ spos = tmppos+1;
+ tmppos = extractAlcToken( aclString, spos, false );
+ control = aclString.substr(spos, tmppos-spos);
+ log_it(SLAPD_LOG_INFO, "control: " + control );
+ if ( control != "stop" && control != "break" && control != "continue" )
+ {
+ control = "";
+ tmppos = spos-1;
+ }
+ }
if (tmppos != std::string::npos )
{
spos = aclString.find_first_not_of("\t ", tmppos+1 );
@@ -618,9 +703,8 @@
}
}
}
- log_it(SLAPD_LOG_INFO, "level <"+level+"> type <"+type+"> value <"+value+">" );
- boost::shared_ptr<OlcAclBy> by( new OlcAclBy(level, type, value) );
- log_it(SLAPD_LOG_INFO, " type <"+by->getType()+">" );
+ log_it(SLAPD_LOG_INFO, "level <"+level+"> type <"+type+"> value <"+value+"> control <" + control + ">" );
+ boost::shared_ptr<OlcAclBy> by( new OlcAclBy(level, type, value, control) );
m_byList.push_back(by);
}
}
@@ -737,7 +821,13 @@
{
aclString << "=\"" << (*i)->getValue() << "\"";
}
+
aclString << " " << (*i)->getLevel();
+ std::string control = (*i)->getControl();
+ if ( !control.empty() && control != "stop" )
+ {
+ aclString << " " << (*i)->getControl();
+ }
}
return aclString.str();
}
Modified: trunk/ldap-server/src/lib/slapd-config.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/slapd-config.h?rev=60775&r1=60774&r2=60775&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/slapd-config.h (original)
+++ trunk/ldap-server/src/lib/slapd-config.h Tue Feb 9 16:58:06 2010
@@ -110,7 +110,7 @@
public:
static OlcOverlay* createFromLdapEntry( const LDAPEntry& le);
OlcOverlay( const LDAPEntry &le );
- OlcOverlay( const std::string &type, const std::string &parent );
+ OlcOverlay( const std::string &type, const std::string &parent, const std::string &oc="" );
const std::string getType() const;
void newParentDn( const std::string &parent );
@@ -122,13 +122,26 @@
std::string m_parent;
};
+class OlcSyncProvOl : public OlcOverlay
+{
+ public:
+ OlcSyncProvOl( const LDAPEntry &le ) : OlcOverlay( le ) {}
+ OlcSyncProvOl( const std::string &parent) : OlcOverlay("syncprov",parent,"olcSyncProvConfig") {}
+ void getCheckPoint(int &ops, int &min) const;
+ void setCheckPoint(int ops, int min);
+
+ bool getSessionLog(int &slog) const;
+ void setSessionLog(int slog);
+};
+
class OlcAclBy
{
public:
inline OlcAclBy( const std::string& level,
const std::string& type,
- const std::string& value = "" ) :
- m_type(type), m_value(value)
+ const std::string& value = "",
+ const std::string& control = "" ) :
+ m_type(type), m_value(value), m_control(control)
{
setLevel(level);
}
@@ -147,6 +160,11 @@
{
return m_value;
}
+
+ inline std::string getControl() const
+ {
+ return m_control;
+ }
inline void setLevel( const std::string &level )
{
@@ -167,11 +185,17 @@
{
m_value = value;
}
+ inline void setControl( const std::string &value )
+ {
+ m_control = value;
+ }
+
private:
std::string m_level;
std::string m_type;
std::string m_value;
+ std::string m_control;
};
typedef std::list OlcAclByList;
Modified: trunk/ldap-server/src/tree_structure.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.ycp?rev=60775&r1=60774&r2=60775&view=diff
==============================================================================
--- trunk/ldap-server/src/tree_structure.ycp (original)
+++ trunk/ldap-server/src/tree_structure.ycp Tue Feb 9 16:58:06 2010
@@ -839,6 +839,39 @@
return ret;
}
+define boolean cb_read_syncprov()
+{
+ y2milestone("cb_read_syncprov()");
+ string treeItem = current_tree_item;
+ integer index = (integer)widget_map[current_tree_item,"index"]:nil;
+ map sp = LdapServer::ReadSyncProv(index);
+ return LdapDatabase::DbSyncProvRead( handler_cmd, index, sp );
+}
+
+define boolean cb_input_syncprov()
+{
+ y2milestone("cb_input_syncprov()");
+ string treeItem = current_tree_item;
+ integer index = (integer)widget_map[current_tree_item,"index"]:nil;
+ y2milestone( "calling sync input handler for item '%1'", treeItem );
+ return LdapDatabase::DbSyncProvInput( handler_cmd, index );
+}
+
+define boolean cb_write_syncprov()
+{
+ y2milestone("cb_write_syncprov()");
+ boolean result = false;
+ string treeItem = current_tree_item;
+ integer index = (integer)widget_map[current_tree_item,"index"]:nil;
+ map syncprov = LdapDatabase::DbSyncProvWrite( index );
+ result = LdapServer::WriteSyncProv(index, syncprov);
+ if ( ! result ) {
+ map err = LdapServer::ReadError();
+ callback_error = err["msg"]:"" + "\n" + err["details"]:"";
+ }
+ return result;
+}
+
define boolean cb_input_ppolicy()
{
y2milestone("cb_input_ppolicy()");
@@ -987,6 +1020,15 @@
"cb_input" : ``(cb_input_acl() ),
"help_page" : "acl_edit"
];
+ map dbSyncProv = $[
+ "name" : _("Replication Provider"),
+ "widget" : LdapDatabase::GetSyncProvWidget(),
+ "index" : index,
+ "cb_read" : ``(cb_read_syncprov() ),
+ "cb_write" : ``(cb_write_syncprov() ),
+ "cb_input" : ``(cb_input_syncprov() ),
+ "help_page" : "syncprov_edit"
+ ];
map item_map = $[
"name" : label,
"children" : [ item_name + "_acl"],
@@ -998,7 +1040,7 @@
];
map bdb_item_map = $[
"name" : label,
- "children" : [ item_name + "_index", item_name + "_ppolicy", item_name + "_acl"],
+ "children" : [ item_name + "_index", item_name + "_ppolicy", item_name + "_acl", item_name + "_syncprov"],
"index" : index,
"widget" : editBdbDatabase,
"new_db" : new_db,
@@ -1008,6 +1050,15 @@
"cb_write" : ``( cb_write_db() ),
"cb_input" : ``( cb_input_db() )
];
+ map confdb_item_map = $[
+ "name" : label,
+ "children" : [ item_name + "_acl", item_name + "_syncprov"],
+ "index" : index,
+ "widget" : editGenericDatabase,
+ "new_db" : new_db,
+ "dynamic" : true,
+ "help_page" : "database_detail_unsupported",
+ ];
y2milestone( "adding database item '%1' as '%2'", label, item_name );
if ( type == "bdb" || type == "hdb" )
@@ -1016,6 +1067,13 @@
widget_map[item_name + "_index"] = dbIndex;
widget_map[item_name + "_ppolicy"] = dbPpolicy;
widget_map[item_name + "_acl"] = dbAcl;
+ widget_map[item_name + "_syncprov"] = dbSyncProv;
+ }
+ else if ( type == "config" )
+ {
+ widget_map[item_name] = confdb_item_map;
+ widget_map[item_name + "_acl"] = dbAcl;
+ widget_map[item_name + "_syncprov"] = dbSyncProv;
}
else
{
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org