Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49721 - /trunk/ldap-server/src/agent/SlapdConfigAgent.cc
  • From: rhafer@xxxxxxxxxxxxxxxx
  • Date: Tue, 05 Aug 2008 14:23:51 -0000
  • Message-id: <20080805142351.ECA8739CDB@xxxxxxxxxxxxxxxx>
Author: rhafer
Date: Tue Aug 5 16:23:51 2008
New Revision: 49721

URL: http://svn.opensuse.org/viewcvs/yast?rev=49721&view=rev
Log:
Open connection only if not already connected

Modified:
trunk/ldap-server/src/agent/SlapdConfigAgent.cc

Modified: trunk/ldap-server/src/agent/SlapdConfigAgent.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/agent/SlapdConfigAgent.cc?rev=49721&r1=49720&r2=49721&view=diff
==============================================================================
--- trunk/ldap-server/src/agent/SlapdConfigAgent.cc (original)
+++ trunk/ldap-server/src/agent/SlapdConfigAgent.cc Tue Aug 5 16:23:51 2008
@@ -118,7 +118,7 @@
if ( path->component_str(0) == "global" ) {
y2milestone("Global Write");
return WriteGlobal(path->at(1), arg, arg2);
- } else if ( path->component_str(0) == "database" ) {
+ } else if ( (path->component_str(0) == "database") && (path->length() > 1)
) {
y2milestone("Database Write");
return WriteDatabase(path->at(1), arg, arg2);
} else if ( path->component_str(0) == "schema" ) {
@@ -146,11 +146,26 @@
y2milestone("Execute Path %s", path->toString().c_str() );
if ( path->component_str(0) == "init" )
{
-
- LDAPConnection *lc = new LDAPConnection("ldapi:///");
- SaslExternalHandler sih;
- lc->saslInteractiveBind("external", 2 /* LDAP_SASL_QUIET */,
(SaslInteractionHandler*)&sih);
- olc = OlcConfig(lc);
+ if ( ! olc.hasConnection() )
+ {
+ LDAPConnection *lc = new LDAPConnection("ldapi:///");
+ try {
+ SaslExternalHandler sih;
+ lc->saslInteractiveBind("external", 2 /* LDAP_SASL_QUIET */,
(SaslInteractionHandler*)&sih);
+ }
+ catch ( LDAPException e)
+ {
+ std::string errstring = "Error connecting to LDAP Server";
+ std::string details = e.getResultMsg() + ": " +
e.getServerMsg();
+
+ lastError->add(YCPString("summary"),
+ YCPString(errstring) );
+ lastError->add(YCPString("description"), YCPString( details )
);
+ delete(lc);
+ return YCPBoolean(false);
+ }
+ olc = OlcConfig(lc);
+ }
}
if ( path->component_str(0) == "initFromLdif" )
{
@@ -273,17 +288,17 @@
if ( globals )
olc.updateEntry( *globals );

- OlcSchemaList::const_iterator j;
+ OlcSchemaList::iterator j;
for ( j = schema.begin(); j != schema.end() ; j++ )
{
olc.updateEntry(**j);
}
- OlcDatabaseList::const_iterator i;
+ OlcDatabaseList::iterator i;
for ( i = databases.begin(); i != databases.end() ; i++ )
{
olc.updateEntry(**i);
OlcOverlayList overlays = (*i)->getOverlays();
- OlcOverlayList::const_iterator k;
+ OlcOverlayList::iterator k;
for ( k = overlays.begin(); k != overlays.end(); k++ )
{
y2milestone("Update overlay: %s", (*k)->getDn().c_str() );

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

< Previous Next >
This Thread
  • No further messages