Mailinglist Archive: yast-commit (711 mails)

< Previous Next >
[yast-commit] r48606 - in /trunk/ldap-server/src: LdapServer.pm agent/SlapdConfigAgent.cc lib/backConfigTest.cpp lib/backConfigTest.h tree_structure.ycp widgets.ycp
  • From: rhafer@xxxxxxxxxxxxxxxx
  • Date: Fri, 27 Jun 2008 13:57:44 -0000
  • Message-id: <20080627135744.9D07D2754C@xxxxxxxxxxxxxxxx>
Author: rhafer
Date: Fri Jun 27 15:57:44 2008
New Revision: 48606

URL: http://svn.opensuse.org/viewcvs/yast?rev=48606&view=rev
Log:
bring back write support for loglevel and allow/disallow

Modified:
trunk/ldap-server/src/LdapServer.pm
trunk/ldap-server/src/agent/SlapdConfigAgent.cc
trunk/ldap-server/src/lib/backConfigTest.cpp
trunk/ldap-server/src/lib/backConfigTest.h
trunk/ldap-server/src/tree_structure.ycp
trunk/ldap-server/src/widgets.ycp

Modified: trunk/ldap-server/src/LdapServer.pm
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=48606&r1=48605&r2=48606&view=diff
==============================================================================
--- trunk/ldap-server/src/LdapServer.pm (original)
+++ trunk/ldap-server/src/LdapServer.pm Fri Jun 27 15:57:44 2008
@@ -31,7 +31,6 @@
my $slapdConfChanged = 0;
my $serviceEnabled = 0;
my $registerSlp = 0;
-my @loglevel = ();
my %dbDefaults = ();

my @databases = ();
@@ -88,9 +87,6 @@
y2milestone("Databases: ". Data::Dumper->Dump([$rc]));
#$rc = SCR->Read('.ldapserver.global.tlsSettings' );
#y2milestone("tlsSettings: ". Data::Dumper->Dump([$rc]));
- $rc = SCR->Read('.ldapserver.global.loglevel' );
- y2milestone("loglevel: ". Data::Dumper->Dump([$rc]));
- @loglevel = @{$rc};
}
}
else
@@ -361,7 +357,7 @@
BEGIN { $TYPEINFO {GetLogLevels} = ["function", [ "list", "string" ] ]; }
sub GetLogLevels
{
- return \@loglevel;
+ return SCR->Read('.ldapserver.global.loglevel' );
}

BEGIN { $TYPEINFO {SetLogLevels} = ["function", "boolean", [ "list", "string"
] ]; }
@@ -369,12 +365,40 @@
{
my $self = shift;
my $lvls = shift;
- @loglevel = @{$lvls};
-
SCR->Write('.ldapserver.global.loglevel', $lvls );
return 1;
}

+BEGIN { $TYPEINFO {GetAllowFeatures} = ["function", [ "list", "string" ] ]; }
+sub GetAllowFeatures
+{
+ return SCR->Read('.ldapserver.global.allow' );
+}
+
+BEGIN { $TYPEINFO {GetDisallowFeatures} = ["function", [ "list", "string" ] ];
}
+sub GetDisallowFeatures
+{
+ return SCR->Read('.ldapserver.global.disallow' );
+}
+
+BEGIN { $TYPEINFO {SetAllowFeatures} = ["function", "boolean", [ "list",
"string" ] ]; }
+sub SetAllowFeatures
+{
+ my $self = shift;
+ my $features = shift;
+ SCR->Write('.ldapserver.global.allow', $features );
+ return 1;
+}
+
+BEGIN { $TYPEINFO {SetDisallowFeatures} = ["function", "boolean", [ "list",
"string" ] ]; }
+sub SetDisallowFeatures
+{
+ my $self = shift;
+ my $features = shift;
+ SCR->Write('.ldapserver.global.disallow', $features );
+ return 1;
+}
+
BEGIN { $TYPEINFO {MigrateSlapdConf} = ["function", "boolean"]; }
sub MigrateSlapdConf
{

Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfigAgent.cc?rev=48606&r1=48605&r2=48606&view=diff
==============================================================================
--- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original)
+++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Fri Jun 27 15:57:44 2008
@@ -195,6 +195,9 @@
}
else if ( path->component_str(0) == "commitChanges" )
{
+ if ( globals )
+ olc.updateEntry( *globals );
+
OlcDatabaseList::const_iterator i;
for ( i = databases.begin(); i != databases.end() ; i++ )
{
@@ -236,6 +239,10 @@
}
else
{
+ if ( globals == 0 )
+ {
+ globals = olc.getGlobals();
+ }
if ( path->component_str(0) == "loglevel" )
{
y2milestone("Read loglevel");
@@ -248,6 +255,30 @@
}
return yLevelList;
}
+ if ( path->component_str(0) == "allow" )
+ {
+ y2milestone("Read allow Features");
+ YCPList yFeatureList;
+ const std::vector<std::string> loglevel =
globals->getAllowFeatures();
+ std::vector<std::string>::const_iterator i;
+ for ( i = loglevel.begin(); i != loglevel.end(); i++ )
+ {
+ yFeatureList.add(YCPString(*i) );
+ }
+ return yFeatureList;
+ }
+ if ( path->component_str(0) == "disallow" )
+ {
+ y2milestone("Read allow Features");
+ YCPList yFeatureList;
+ const std::vector<std::string> loglevel =
globals->getDisallowFeatures();
+ std::vector<std::string>::const_iterator i;
+ for ( i = loglevel.begin(); i != loglevel.end(); i++ )
+ {
+ yFeatureList.add(YCPString(*i) );
+ }
+ return yFeatureList;
+ }
if ( path->component_str(0) == "tlsSettings" )
{
YCPMap ymap;
@@ -344,7 +375,28 @@
levelList.push_back(
levels->value(i)->asString()->value_cstr() );
}
globals->setLogLevel( levelList );
- //olc.setGlobals(olcg);
+ return YCPBoolean(true);
+ }
+ if ( path->component_str(0) == "allow" ) {
+ y2milestone("Write allow Features");
+ YCPList features = arg->asList();
+ std::list<std::string> featureList;
+ for ( int i = 0; i < features->size(); i++ )
+ {
+ featureList.push_back(
features->value(i)->asString()->value_cstr() );
+ }
+ globals->setAllowFeatures( featureList );
+ return YCPBoolean(true);
+ }
+ if ( path->component_str(0) == "disallow" ) {
+ y2milestone("Write allow Features");
+ YCPList features = arg->asList();
+ std::list<std::string> featureList;
+ for ( int i = 0; i < features->size(); i++ )
+ {
+ featureList.push_back(
features->value(i)->asString()->value_cstr() );
+ }
+ globals->setDisallowFeatures( featureList );
return YCPBoolean(true);
}
}

Modified: trunk/ldap-server/src/lib/backConfigTest.cpp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTest.cpp?rev=48606&r1=48605&r2=48606&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/backConfigTest.cpp (original)
+++ trunk/ldap-server/src/lib/backConfigTest.cpp Fri Jun 27 15:57:44 2008
@@ -130,20 +130,6 @@
m_dbEntryChanged.addAttribute(LDAPAttribute("cn", "config"));
}

-int OlcGlobalConfig::getLogLevel() const
-{
- const LDAPAttribute *attr =
m_dbEntryChanged.getAttributeByName("olcloglevel");
- if (attr) {
- StringList sl = attr->getValues();
- StringList::const_iterator i;
- for (i = sl.begin(); i != sl.end(); i++ ) {
- std::cout << "loglevel: " << *i << std::endl;
- }
- } else {
- return 0;
- }
-}
-
const std::vector<std::string> OlcGlobalConfig::getLogLevelString() const
{
StringList lvalues = this->getStringValues("olcLogLevel");
@@ -170,29 +156,54 @@
//
//}

-void OlcGlobalConfig::setLogLevel(int level) {
+void OlcGlobalConfig::setLogLevel(const std::list<std::string> &level) {
const LDAPAttribute *sattr =
m_dbEntryChanged.getAttributeByName("olcloglevel");
- LDAPAttribute attr;
+ LDAPAttribute attr( "olcloglevel" );
if ( sattr ) {
attr = *sattr;
}
- std::ostringstream o;
StringList values;
- o << level;
- values.add(o.str());
+ std::list<std::string>::const_iterator i = level.begin();
+ for(; i != level.end(); i++ )
+ {
+ values.add(*i);
+ }
attr.setValues(values);
m_dbEntryChanged.replaceAttribute(attr);
}

-void OlcGlobalConfig::setLogLevel(const std::list<std::string> &level) {
+void OlcGlobalConfig::addLogLevel(std::string level) {
const LDAPAttribute *sattr =
m_dbEntryChanged.getAttributeByName("olcloglevel");
- LDAPAttribute attr( "olcloglevel" );
+ LDAPAttribute attr;
+ if ( sattr ) {
+ attr = *sattr;
+ }
+ attr.addValue(level);
+ m_dbEntryChanged.replaceAttribute(attr);
+}
+
+const std::vector<std::string> OlcGlobalConfig::getAllowFeatures() const
+{
+ StringList values = this->getStringValues("olcAllows");
+ StringList::const_iterator i;
+ std::vector<std::string> allow;
+ for ( i = values.begin(); i != values.end(); i++ )
+ {
+ allow.push_back(*i);
+ }
+ return allow;
+}
+
+void OlcGlobalConfig::setAllowFeatures(const std::list<std::string> &allow )
+{
+ const LDAPAttribute *sattr =
m_dbEntryChanged.getAttributeByName("olcAllows");
+ LDAPAttribute attr( "olcAllows" );
if ( sattr ) {
attr = *sattr;
}
StringList values;
- std::list<std::string>::const_iterator i = level.begin();
- for(; i != level.end(); i++ )
+ std::list<std::string>::const_iterator i = allow.begin();
+ for(; i != allow.end(); i++ )
{
values.add(*i);
}
@@ -200,16 +211,36 @@
m_dbEntryChanged.replaceAttribute(attr);
}

-void OlcGlobalConfig::addLogLevel(std::string level) {
- const LDAPAttribute *sattr =
m_dbEntryChanged.getAttributeByName("olcloglevel");
- LDAPAttribute attr;
+const std::vector<std::string> OlcGlobalConfig::getDisallowFeatures() const
+{
+ StringList values = this->getStringValues("olcDisallows");
+ StringList::const_iterator i;
+ std::vector<std::string> allow;
+ for ( i = values.begin(); i != values.end(); i++ )
+ {
+ allow.push_back(*i);
+ }
+ return allow;
+}
+
+void OlcGlobalConfig::setDisallowFeatures(const std::list<std::string>
&disallow )
+{
+ const LDAPAttribute *sattr =
m_dbEntryChanged.getAttributeByName("olcDisallows");
+ LDAPAttribute attr( "olcDisallows" );
if ( sattr ) {
attr = *sattr;
}
- attr.addValue(level);
+ StringList values;
+ std::list<std::string>::const_iterator i = disallow.begin();
+ for(; i != disallow.end(); i++ )
+ {
+ values.add(*i);
+ }
+ attr.setValues(values);
m_dbEntryChanged.replaceAttribute(attr);
}

+
OlcSchemaConfig::OlcSchemaConfig() : OlcConfigEntry()
{
m_dbEntryChanged.setDN("cn=schema,cn=config");
@@ -547,7 +578,7 @@
}
bool replace = false;
if ( delValues.size() > 0 ) {
- if ( (int) delValues.size() == i->getNumValues() ) {
+ if ( (addValues.size() > 0) && ( (int)delValues.size() ==
i->getNumValues()) ) {
std::cout << "All Values deleted, this is a replace" <<
std::endl;
modifications.addModification(
LDAPModification( LDAPAttribute(i->getName(),
addValues),
@@ -575,6 +606,22 @@
);
}
}
+ i = m_dbEntryChanged.getAttributes()->begin();
+ for(; i != m_dbEntryChanged.getAttributes()->end(); i++ )
+ {
+ std::cout << i->getName() << std::endl;
+ const LDAPAttribute *old = m_dbEntry.getAttributeByName(i->getName());
+ if (! old ) {
+ std::cout << "Attribute added: " << i->getName() << std::endl;
+ if (! i->getValues().empty() )
+ {
+ modifications.addModification(
+ LDAPModification( LDAPAttribute(i->getName(),
i->getValues()),
+ LDAPModification::OP_ADD)
+ );
+ }
+ }
+ }
return modifications;
}

@@ -583,7 +630,7 @@

}

-OlcGlobalConfig OlcConfig::getGlobals()
+boost::shared_ptr<OlcGlobalConfig> OlcConfig::getGlobals()
{
LDAPSearchResults *sr;
LDAPEntry *dbEntry;
@@ -596,10 +643,11 @@
}
if ( dbEntry ) {
std::cout << "Got GlobalConfig: " << dbEntry->getDN() << std::endl;
- OlcGlobalConfig gc(*dbEntry);
+ boost::shared_ptr<OlcGlobalConfig> gc( new OlcGlobalConfig(*dbEntry) );
return gc;
}
- return OlcGlobalConfig();
+ boost::shared_ptr<OlcGlobalConfig> gc( new OlcGlobalConfig() );
+ return gc;
}

void OlcConfig::setGlobals( OlcGlobalConfig &olcg)

Modified: trunk/ldap-server/src/lib/backConfigTest.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/lib/backConfigTest.h?rev=48606&r1=48605&r2=48606&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/backConfigTest.h (original)
+++ trunk/ldap-server/src/lib/backConfigTest.h Fri Jun 27 15:57:44 2008
@@ -106,11 +106,16 @@
public:
OlcGlobalConfig();
inline OlcGlobalConfig( const LDAPEntry &le) : OlcConfigEntry(le) {}
- int getLogLevel() const;
+
const std::vector<std::string> getLogLevelString() const;
- void setLogLevel(int level);
void setLogLevel(const std::list<std::string> &level);
void addLogLevel(std::string level);
+
+ const std::vector<std::string> getAllowFeatures() const;
+ void setAllowFeatures( const std::list<std::string> &features );
+ const std::vector<std::string> getDisallowFeatures() const;
+ void setDisallowFeatures( const std::list<std::string> &features );
+
OlcTlsSettings getTlsSettings() const;
virtual std::map<std::string, std::list<std::string> > toMap() const;
};
@@ -125,7 +130,7 @@
class OlcConfig {
public:
OlcConfig(LDAPConnection *lc=0 );
- OlcGlobalConfig getGlobals();
+ boost::shared_ptr<OlcGlobalConfig> getGlobals();
void setGlobals( OlcGlobalConfig &olcg);
void updateEntry( const OlcConfigEntry &oce );
OlcDatabaseList getDatabases();

Modified: trunk/ldap-server/src/tree_structure.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/tree_structure.ycp?rev=48606&r1=48605&r2=48606&view=diff
==============================================================================
--- trunk/ldap-server/src/tree_structure.ycp (original)
+++ trunk/ldap-server/src/tree_structure.ycp Fri Jun 27 15:57:44 2008
@@ -261,8 +261,10 @@
define boolean cb_read_allow()
``{
y2milestone( "calling allow read handler" );
-// list<string> allowlist = LdapServer::ReadAllowList();
-// UI::ChangeWidget( `msb_allow, `SelectedItems, allowlist );
+ list<string> allowlist = LdapServer::GetAllowFeatures();
+ list<string> disallowlist = LdapServer::GetDisallowFeatures();
+ UI::ChangeWidget( `msb_allow, `SelectedItems, allowlist );
+ UI::ChangeWidget( `msb_disallow, `SelectedItems, disallowlist );
return true;
}

@@ -270,10 +272,13 @@
``{
y2milestone( "calling allow write handler" );
list<string> allowlist = [];
+ list<string> disallowlist = [];
allowlist = (list<string>)UI::QueryWidget( `msb_allow, `SelectedItems );
+ disallowlist = (list<string>)UI::QueryWidget( `msb_disallow,
`SelectedItems );

y2milestone( "writing allowlist: '%1'", allowlist );
-// LdapServer::WriteAllowList( allowlist );
+ LdapServer::SetAllowFeatures( allowlist );
+ LdapServer::SetDisallowFeatures( disallowlist );
return true;
}

@@ -1015,7 +1020,7 @@
],
"g_allow" : $[
/* Tree item */
- "name" : _("Allow Settings"),
+ "name" : _("Allow/Disallow Features"),
"widget" : allowWidget,
"cb_check" : ``( cb_check_allow() ),
"cb_read" : ``( cb_read_allow() ),

Modified: trunk/ldap-server/src/widgets.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/widgets.ycp?rev=48606&r1=48605&r2=48606&view=diff
==============================================================================
--- trunk/ldap-server/src/widgets.ycp (original)
+++ trunk/ldap-server/src/widgets.ycp Fri Jun 27 15:57:44 2008
@@ -118,13 +118,23 @@
);

term allowWidget =
- `MultiSelectionBox(
- `id( `msb_allow ), _("Select &Allow Flags:"), [
- `item( `id( "bind_v2" ), _("LDAPv2 Bind Requests") ),
- `item( `id( "bind_anon_cred" ), _("Anonymous Bind when
Credentials Not Empty") ),
- `item( `id( "bind_anon_dn" ), _("Unauthenticated Bind when DN
Not Empty") ),
- `item( `id( "update_anon" ), _("Unauthenticated Update Options
to Process") )
- ]
+ `VBox (
+ `MultiSelectionBox(
+ `id( `msb_allow ), _("Select &Allow Flags:"), [
+ `item( `id( "bind_v2" ), _("LDAPv2 Bind Requests") ),
+ `item( `id( "bind_anon_cred" ), _("Anonymous Bind when
Credentials Not Empty") ),
+ `item( `id( "bind_anon_dn" ), _("Unauthenticated Bind when
DN Not Empty") ),
+ `item( `id( "update_anon" ), _("Unauthenticated Update
Options to Process") )
+ ]
+ ),
+ `MultiSelectionBox(
+ `id( `msb_disallow ), _("Select &Disallow Flags:"), [
+ `item( `id( "bind_anon" ), _("Disable acceptance of
anonymous Bind Requests (does not prohibit anonymous directory access)") ),
+ `item( `id( "bind_simple" ), _("Disable Simple Bind
authentication") ),
+ `item( `id( "tls_2_anon" ), _("Disable forcing session to
anonymous status upon StartTLS operation receipt") ),
+ `item( `id( "tls_authc" ), _("Disallow the StartTLS
operation if authenticated") )
+ ]
+ )
);

term tlsWidget =

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages