[yast-commit] r48663 - in /trunk/ldap-server/src: agent/SlapdConfigAgent.cc tree_structure.ycp
Author: rhafer Date: Fri Jun 27 16:01:27 2008 New Revision: 48663 URL: http://svn.opensuse.org/viewcvs/yast?rev=48663&view=rev Log: Don't add/delete ppolicy when nothing was changed Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc trunk/ldap-server/src/tree_structure.ycp Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfigAgent.cc?rev=48663&r1=48662&r2=48663&view=diff ============================================================================== --- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original) +++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Fri Jun 27 16:01:27 2008 @@ -844,42 +844,48 @@ break; } } - boost::shared_ptr<OlcOverlay> ppolicyOlc; - if ( j == overlays.end() ) + YCPMap argMap = arg->asMap(); + if ( j == overlays.end() && argMap.size() == 0 ) { - y2milestone("New Overlay added"); - boost::shared_ptr<OlcOverlay> tmp(new OlcOverlay("ppolicy", (*i)->getDn())); - ppolicyOlc = tmp; - (*i)->addOverlay(ppolicyOlc); + y2milestone("Empty overlay nothing to do"); } - else + else { - y2milestone("Update existing Overlay"); - ppolicyOlc = *j; - } - YCPMap argMap = arg->asMap(); - y2milestone("Mapsize: %ld", argMap.size()); - if ( argMap.size() == 0 ){ - y2milestone("Delete ppolicy overlay"); - ppolicyOlc->clearChangedEntry(); - } else { - ppolicyOlc->setStringValue("olcPpolicyDefault", - argMap->value(YCPString("defaultPolicy"))->asString()->value_cstr() ); - if ( argMap->value(YCPString("useLockout"))->asBoolean()->value() == true ) + boost::shared_ptr<OlcOverlay> ppolicyOlc; + if ( j == overlays.end() ) { - ppolicyOlc->setStringValue("olcPpolicyUseLockout", "TRUE"); + y2milestone("New Overlay added"); + boost::shared_ptr<OlcOverlay> tmp(new OlcOverlay("ppolicy", (*i)->getDn())); + ppolicyOlc = tmp; + (*i)->addOverlay(ppolicyOlc); } else { - ppolicyOlc->setStringValue("olcPpolicyUseLockout", "FALSE"); + y2milestone("Update existing Overlay"); + ppolicyOlc = *j; } - if ( argMap->value(YCPString("hashClearText"))->asBoolean()->value() == true ) - { - ppolicyOlc->setStringValue("olcPpolicyHashCleartext", "TRUE"); - } - else - { - ppolicyOlc->setStringValue("olcPpolicyHashCleartext", "FALSE"); + if ( argMap.size() == 0 ){ + y2milestone("Delete ppolicy overlay"); + ppolicyOlc->clearChangedEntry(); + } else { + ppolicyOlc->setStringValue("olcPpolicyDefault", + argMap->value(YCPString("defaultPolicy"))->asString()->value_cstr() ); + if ( argMap->value(YCPString("useLockout"))->asBoolean()->value() == true ) + { + ppolicyOlc->setStringValue("olcPpolicyUseLockout", "TRUE"); + } + else + { + ppolicyOlc->setStringValue("olcPpolicyUseLockout", "FALSE"); + } + if ( argMap->value(YCPString("hashClearText"))->asBoolean()->value() == true ) + { + ppolicyOlc->setStringValue("olcPpolicyHashCleartext", "TRUE"); + } + else + { + ppolicyOlc->setStringValue("olcPpolicyHashCleartext", "FALSE"); + } } } ret = true; Modified: trunk/ldap-server/src/tree_structure.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.ycp?rev=48663&r1=48662&r2=48663&view=diff ============================================================================== --- trunk/ldap-server/src/tree_structure.ycp (original) +++ trunk/ldap-server/src/tree_structure.ycp Fri Jun 27 16:01:27 2008 @@ -1096,12 +1096,19 @@ // LdapServer::WriteSchemaIncludeList(inclist); // } } else { - // delete ppolicy - result = LdapServer::AddPasswordPolicy( index, $[] ); - if ( ! result ) { - map<string, string> err = LdapServer::GetError(); - callback_error = err["msg"]:"" + "\n" + err["details"]:""; + map<string,any> ppolicy_map = LdapServer::GetPpolicyOverlay(index); + if ( size(ppolicy_map) == 0 ) + { + result = true; } + else + { + // delete ppolicy + result = LdapServer::AddPasswordPolicy( index, $[] ); + if ( ! result ) { + map<string, string> err = LdapServer::GetError(); + callback_error = err["msg"]:"" + "\n" + err["details"]:""; + } // map<string,string> ppolicy_map = LdapServer::GetPasswordPolicyOverlay(suffix); // if ( ppolicy_map != nil ){ @@ -1117,6 +1124,7 @@ // }); // db["overlay"] = newoverlay; // } + } } return result; } -- 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