Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49722 - in /trunk/ldap-server/src/lib: slapd-config.cpp slapd-config.h
  • From: rhafer@xxxxxxxxxxxxxxxx
  • Date: Tue, 05 Aug 2008 14:23:55 -0000
  • Message-id: <20080805142355.4AC7439CDE@xxxxxxxxxxxxxxxx>
Author: rhafer
Date: Tue Aug 5 16:23:54 2008
New Revision: 49722

URL: http://svn.opensuse.org/viewcvs/yast?rev=49722&view=rev
Log:
re-read LDAP Entries from server after writing them

Modified:
trunk/ldap-server/src/lib/slapd-config.cpp
trunk/ldap-server/src/lib/slapd-config.h

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=49722&r1=49721&r2=49722&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/slapd-config.cpp (original)
+++ trunk/ldap-server/src/lib/slapd-config.cpp Tue Aug 5 16:23:54 2008
@@ -457,6 +457,12 @@
return res;
}

+void OlcSchemaConfig::resetMemberAttrs()
+{
+ std::string name(this->getStringValue("cn"));
+ entryIndex = splitIndexFromString( name, m_name );
+}
+
OlcTlsSettings OlcGlobalConfig::getTlsSettings() const
{
log_it(0, "OlcTlsSettings OlcGlobalConfig::getTlsSettings() const ");
@@ -468,35 +474,6 @@
tls.applySettings( *this );
}

-//std::map<std::string, std::list<std::string> > OlcGlobalConfig::toMap() const
-//{
-// std::map<std::string, std::list<std::string> > resMap;
-// const LDAPAttribute *at =
m_dbEntryChanged.getAttributeByName("olcsuffix");
-// if ( at )
-// {
-// StringList values = at->getValues();
-// StringList::const_iterator j;
-// std::list<std::string> valList;
-// for ( j = values.begin(); j != values.end(); j++ )
-// {
-// valList.push_back(*j);
-// }
-// resMap.insert(std::make_pair("suffix", valList));
-// }
-// at = m_dbEntryChanged.getAttributeByName("olcDatabase");
-// if ( at )
-// {
-// StringList values = at->getValues();
-// StringList::const_iterator j;
-// std::list<std::string> valList;
-// for ( j = values.begin(); j != values.end(); j++ )
-// {
-// valList.push_back(*j);
-// }
-// resMap.insert(std::make_pair("type", valList));
-// }
-// return resMap;
-//}

bool OlcConfigEntry::isDatabaseEntry ( const LDAPEntry& e )
{
@@ -608,7 +585,14 @@

void OlcConfigEntry::clearChangedEntry()
{
- m_dbEntryChanged = LDAPEntry();
+ m_dbEntryChanged = LDAPEntry();
+}
+
+void OlcConfigEntry::resetEntries( const LDAPEntry &e )
+{
+ m_dbEntry = e;
+ m_dbEntryChanged = e;
+ this->resetMemberAttrs();
}

OlcOverlay* OlcOverlay::createFromLdapEntry( const LDAPEntry& e)
@@ -638,36 +622,11 @@
return m_type;
}

-
-//std::map<std::string, std::list<std::string> > OlcDatabase::toMap() const
-//{
-// std::map<std::string, std::list<std::string> > resMap;
-// const LDAPAttribute *at =
m_dbEntryChanged.getAttributeByName("olcsuffix");
-// if ( at )
-// {
-// StringList values = at->getValues();
-// StringList::const_iterator j;
-// std::list<std::string> valList;
-// for ( j = values.begin(); j != values.end(); j++ )
-// {
-// valList.push_back(*j);
-// }
-// resMap.insert(std::make_pair("suffix", valList));
-// }
-// at = m_dbEntryChanged.getAttributeByName("olcDatabase");
-// if ( at )
-// {
-// StringList values = at->getValues();
-// StringList::const_iterator j;
-// std::list<std::string> valList;
-// for ( j = values.begin(); j != values.end(); j++ )
-// {
-// valList.push_back(*j);
-// }
-// resMap.insert(std::make_pair("type", valList));
-// }
-// return resMap;
-//}
+void OlcOverlay::resetMemberAttrs()
+{
+ std::string type(this->getStringValue("olcoverlay"));
+ entryIndex = splitIndexFromString( type, m_type );
+}

void OlcDatabase::setSuffix( const std::string &suffix)
{
@@ -704,25 +663,11 @@
return m_overlays;
}

-//std::map<std::string, std::list<std::string> > OlcBdbDatabase::toMap() const
-//{
-// std::map<std::string, std::list<std::string> > resMap =
-// OlcDatabase::toMap();
-//
-// const LDAPAttribute *at =
m_dbEntryChanged.getAttributeByName("olcDbNoSync");
-// if ( at )
-// {
-// StringList values = at->getValues();
-// StringList::const_iterator j;
-// std::list<std::string> valList;
-// for ( j = values.begin(); j != values.end(); j++ )
-// {
-// valList.push_back(*j);
-// }
-// resMap.insert(std::make_pair("nosync", valList));
-// }
-// return resMap;
-//}
+void OlcDatabase::resetMemberAttrs()
+{
+ std::string type(this->getStringValue("olcdatabase"));
+ entryIndex = splitIndexFromString( type, m_type );
+}

bool OlcDatabase::isBdbDatabase( const LDAPEntry& e )
{
@@ -938,7 +883,18 @@

OlcConfig::OlcConfig(LDAPConnection *lc) : m_lc(lc)
{
-
+}
+
+bool OlcConfig::hasConnection() const
+{
+ if ( m_lc )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}

boost::shared_ptr<OlcGlobalConfig> OlcConfig::getGlobals()
@@ -972,9 +928,10 @@
}
}

-void OlcConfig::updateEntry( const OlcConfigEntry &oce )
+void OlcConfig::updateEntry( OlcConfigEntry &oce )
{
try {
+ bool reread = true;
if ( oce.isNewEntry () )
{
m_lc->add(&oce.getChangedEntry());
@@ -986,7 +943,20 @@
m_lc->modify( oce.getDn(), &ml );
} else {
log_it(0,oce.getDn() + ": no changes" );
+ reread = false;
+ }
+ }
+ // re-read Entry from Server
+ if ( reread )
+ {
+ LDAPSearchResults *sr = m_lc->search( oce.getDn(),
LDAPConnection::SEARCH_BASE);
+ LDAPEntry *e = sr->getNext();
+ if ( e ) {
+ log_it(0,"Re-read Entry " + e->getDN() );
+ oce.resetEntries( *e );
+ delete(e);
}
+ delete(sr);
}
} catch (LDAPException e) {
log_it(0, e.getResultMsg() + " " + e.getServerMsg() );

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=49722&r1=49721&r2=49722&view=diff
==============================================================================
--- trunk/ldap-server/src/lib/slapd-config.h (original)
+++ trunk/ldap-server/src/lib/slapd-config.h Tue Aug 5 16:23:54 2008
@@ -48,7 +48,9 @@
inline const LDAPEntry& getChangedEntry() const {
return m_dbEntryChanged;
}
+
virtual void clearChangedEntry();
+ virtual void resetEntries( const LDAPEntry &le );

bool isNewEntry() const;
bool isDeletedEntry() const;
@@ -74,6 +76,7 @@
virtual std::string toLdif() const;

protected:
+ virtual void resetMemberAttrs() {};
virtual void updateEntryDn();

int entryIndex;
@@ -105,6 +108,7 @@
const std::string getType() const;

protected:
+ virtual void resetMemberAttrs();
std::string m_type;
};

@@ -132,6 +136,7 @@
OlcOverlayList& getOverlays() ;

protected:
+ virtual void resetMemberAttrs();
virtual void updateEntryDn();
std::string m_type;
OlcOverlayList m_overlays;
@@ -194,6 +199,7 @@
const std::vector<LDAPAttrType> getAttributeTypes() const;

private:
+ virtual void resetMemberAttrs();
std::string m_name;
};

@@ -236,13 +242,14 @@

public:
OlcConfig(LDAPConnection *lc=0 );
+ bool hasConnection() const;

boost::shared_ptr<OlcGlobalConfig> getGlobals();
OlcDatabaseList getDatabases();
OlcSchemaList getSchemaNames();

void setGlobals( OlcGlobalConfig &olcg);
- void updateEntry( const OlcConfigEntry &oce );
+ void updateEntry( OlcConfigEntry &oce );

static SlapdConfigLogCallback *logCallback;
static void setLogCallback( SlapdConfigLogCallback *lcb );

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

< Previous Next >
This Thread
  • No further messages