summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libtdeldap.cpp63
1 files changed, 45 insertions, 18 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 49425b8..61e2a62 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -3458,38 +3458,65 @@ int LDAPManager::setLDAPMasterReplicationSettings(LDAPMasterReplicationInfo repl
return -2;
}
}
- }
- else {
- // Check to see if the syncprov overlay entries exist
- TQString olcOverlaySyncProvAttr;
- LDAPMessage* msg;
- retcode = ldap_search_ext_s(m_ldap, "olcDatabase={0}config,cn=config", LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
+
+ haveOlcOverlaySyncProv = false;
+ retcode = ldap_search_ext_s(m_ldap, "olcDatabase={1}hdb,cn=config", LDAP_SCOPE_SUBTREE, NULL, ldap_user_and_operational_attributes, 0, NULL, NULL, NULL, 0, &msg);
if (retcode != LDAP_SUCCESS) {
if (errstr) *errstr = i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
else KMessageBox::error(0, i18n("<qt>LDAP search failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
return -2;
}
-
+
// Iterate through the returned entries
- LDAPMessage* entry;
for(entry = ldap_first_entry(m_ldap, msg); entry != NULL; entry = ldap_next_entry(m_ldap, entry)) {
- olcOverlaySyncProvAttr = parseLDAPSyncProvOverlayConfigRecord(entry);
- if (olcOverlaySyncProvAttr != "") {
- break;
+ if (parseLDAPSyncProvOverlayConfigRecord(entry) != "") {
+ haveOlcOverlaySyncProv = true;
}
}
// clean up
ldap_msgfree(msg);
- if (olcOverlaySyncProvAttr != "") {
- // FIXME
- // OpenLDAP does not support removing overlays from the cn=config interface (i.e., once they are enabled above, they stay unless manually deleted from the config files)
- // See http://www.openldap.org/lists/openldap-software/200811/msg00103.html
- // If it were possible, the code would look something like this:
- // retcode = ldap_delete_ext_s(m_ldap, olcOverlaySyncProvAttr + ",olcDatabase={0}config,cn=config", NULL, NULL);
+ if (!haveOlcOverlaySyncProv) {
+ // Create the base DN entry
+ int number_of_parameters = 1; // 1 primary attribute
+ LDAPMod *mods[number_of_parameters+1];
+ set_up_attribute_operations(mods, number_of_parameters);
+
+ // Load initial required LDAP object attributes
+ i=0;
+ TQStringList objectClassList;
+ objectClassList.append("olcOverlayConfig");
+ objectClassList.append("olcSyncProvConfig");
+ create_multiple_attributes_operation(mods, &i, "objectClass", objectClassList);
+ LDAPMod *prevterm = mods[i];
+ mods[i] = NULL;
+
+ // Add new object
+ retcode = ldap_add_ext_s(m_ldap, "olcOverlay=syncprov,olcDatabase={1}hdb,cn=config", mods, NULL, NULL);
+
+ // Clean up
+ clean_up_attribute_operations(i, mods, prevterm, number_of_parameters);
+
+ if (retcode != LDAP_SUCCESS) {
+ if (errstr) {
+ *errstr = i18n("<qt>LDAP overlay configuration failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode));
+ }
+ else {
+ KMessageBox::error(0, i18n("<qt>LDAP overlay configuration failure<p>Reason: [%3] %4</qt>").arg(retcode).arg(ldap_err2string(retcode)), i18n("LDAP Error"));
+ }
+ return -2;
+ }
}
}
+ else {
+ // FIXME
+ // OpenLDAP does not support removing overlays from the cn=config interface (i.e., once they are enabled above, they stay unless manually deleted from the config files)
+ // See http://www.openldap.org/lists/openldap-software/200811/msg00103.html
+ // If it were possible, the code would look something like this:
+ // retcode = ldap_delete_ext_s(m_ldap, olcOverlaySyncProvAttr + ",olcDatabase={0}config,cn=config", NULL, NULL);
+ // retcode = ldap_delete_ext_s(m_ldap, olcOverlaySyncProvAttr + ",olcDatabase={1}hdb,cn=config", NULL, NULL);
+ }
return 0;
}
}
@@ -4360,7 +4387,7 @@ LDAPMasterReplicationInfo::LDAPMasterReplicationInfo() {
// FIXME
// Retry method and timeout should be user configurable
// See http://www.openldap.org/doc/admin24/slapdconfig.html for syntax
- retryMethod = "5 5 300 5";
+ retryMethod = "5 5 300 5 600 +";
timeout = 1;
ignore_ssl_failure = false;
}