From 3caa3ef1be6a44a10df19ab95d01f69528667368 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 21 Mar 2013 20:47:15 -0500 Subject: Fix rebonding --- src/bondwizard.cpp | 2 +- src/ldapbonding.cpp | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/bondwizard.cpp b/src/bondwizard.cpp index c774da0..9d187ae 100644 --- a/src/bondwizard.cpp +++ b/src/bondwizard.cpp @@ -202,7 +202,7 @@ void BondWizard::accept(){ cancelButton()->setEnabled(false); finishpage->setEnabled(false); - if (LDAPManager::bondRealm(m_finalRealm, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), &errorString) == 0) { + if (LDAPManager::bondRealm(finishpage->ldapAdminUsername->text(), finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), &errorString) == 0) { m_ldapConfig->save(); done(0); } diff --git a/src/ldapbonding.cpp b/src/ldapbonding.cpp index f8b16c0..fbf1006 100644 --- a/src/ldapbonding.cpp +++ b/src/ldapbonding.cpp @@ -334,15 +334,26 @@ void LDAPConfig::reBondToRealm() { passdlg.m_base->ldapAdminRealm->setText(realmName); if (passdlg.exec() == TQDialog::Accepted) { setEnabled(false); - if (LDAPManager::bondRealm(passdlg.m_base->ldapAdminUsername->text(), passdlg.m_base->ldapAdminPassword->password(), passdlg.m_base->ldapAdminRealm->text(), &errorString) == 0) { + if (LDAPManager::unbondRealm(m_realms[realmName], passdlg.m_base->ldapAdminUsername->text(), passdlg.m_base->ldapAdminPassword->password(), passdlg.m_base->ldapAdminRealm->text(), &errorString) == 0) { // Success! - realmcfg.bonded = true; + realmcfg.bonded = false; m_realms.remove(realmName); m_realms.insert(realmName, realmcfg); save(); + + if (LDAPManager::bondRealm(passdlg.m_base->ldapAdminUsername->text(), passdlg.m_base->ldapAdminPassword->password(), passdlg.m_base->ldapAdminRealm->text(), &errorString) == 0) { + // Success! + realmcfg.bonded = true; + m_realms.remove(realmName); + m_realms.insert(realmName, realmcfg); + save(); + } + else { + KMessageBox::error(this, i18n("Unable to bond to realm!

Details: %1").arg(errorString), i18n("Unable to Bond to Realm")); + } } else { - KMessageBox::error(this, i18n("Unable to bond to realm!

Details: %1").arg(errorString), i18n("Unable to Bond to Realm")); + KMessageBox::error(this, i18n("Unable to unbond from realm!

%1").arg(errorString), i18n("Unable to Unbond from Realm")); } setEnabled(true); } -- cgit v1.2.1