summaryrefslogtreecommitdiffstats
path: root/src/ldapcontroller.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2025-09-29 22:37:04 -0500
committerTimothy Pearson <tpearson@raptorengineering.com>2025-10-22 19:33:43 -0500
commit1fb3a28fe6adb2404ccc9fa0633ef3344fe65b3d (patch)
treee9ffe7abf6edd4ab23610e2a3eea991f2be382f7 /src/ldapcontroller.cpp
parent9011d2d03eb173a7b10db874a74e8ab5f6a80653 (diff)
downloadkcmldapcontroller-1fb3a28fe6adb2404ccc9fa0633ef3344fe65b3d.tar.gz
kcmldapcontroller-1fb3a28fe6adb2404ccc9fa0633ef3344fe65b3d.zip
Don't attempt to access the LDAP server if the realm DC is blank
If the realm DC is blank, it indicates that configuration has not reached a point where connection to the LDAP server is possible. Providing a blank DC to LDAP will always result in an invalid DN error. This resolves spurious popups when creating the first realm control server in a given realm. Signed-off-by: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Diffstat (limited to 'src/ldapcontroller.cpp')
-rw-r--r--src/ldapcontroller.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/ldapcontroller.cpp b/src/ldapcontroller.cpp
index a358235..cacca6a 100644
--- a/src/ldapcontroller.cpp
+++ b/src/ldapcontroller.cpp
@@ -531,7 +531,10 @@ void LDAPController::updateCertDisplay() {
credentials->username = "";
credentials->password = "";
credentials->realm = realmname;
- LDAPManager* ldap_mgr = new LDAPManager(realmname, "ldapi://", credentials);
+ LDAPManager* ldap_mgr = NULL;
+ if (realmname != "") {
+ ldap_mgr = new LDAPManager(realmname, "ldapi://", credentials);
+ }
// Certificate Authority
if (TQFile::exists(KERBEROS_PKI_PEM_FILE)) {
@@ -601,7 +604,7 @@ void LDAPController::updateCertDisplay() {
// Certificate Revocation List
TQByteArray certificateContents;
- if (ldap_mgr->getTDECertificate("publicRootCertificateRevocationList", &certificateContents, NULL) == 0) {
+ if (ldap_mgr && ldap_mgr->getTDECertificate("publicRootCertificateRevocationList", &certificateContents, NULL) == 0) {
certExpiry = LDAPManager::getCertificateExpiration(certificateContents);
if (certExpiry >= now) {
m_base->crlExpiryString->setText("Expires " + certExpiry.toString());
@@ -622,7 +625,9 @@ void LDAPController::updateCertDisplay() {
m_base->crlExpiryString->setPaletteForegroundColor(CERT_STATUS_COLOR_NOTFOUND);
}
- delete ldap_mgr;
+ if (ldap_mgr) {
+ delete ldap_mgr;
+ }
}
void LDAPController::btncaSetMaster() {
@@ -1055,9 +1060,13 @@ void LDAPController::save() {
credentials->username = "";
credentials->password = "";
credentials->realm = realmname;
- LDAPManager* ldap_mgr = new LDAPManager(realmname, "ldapi://", credentials);
+ LDAPManager* ldap_mgr = NULL;
- if (ldap_mgr->setLdapCertificateStoreAttribute("publicRootCRLIntervalDays", TQString("%1").arg(m_certconfig.caCrlExpiryDays), &errorstring) != 0) {
+ if (realmname != "") {
+ ldap_mgr = new LDAPManager(realmname, "ldapi://", credentials);
+ }
+
+ if (ldap_mgr && ldap_mgr->setLdapCertificateStoreAttribute("publicRootCRLIntervalDays", TQString("%1").arg(m_certconfig.caCrlExpiryDays), &errorstring) != 0) {
KMessageBox::error(this, i18n("<qt><b>Unable to update CRL interval entry in LDAP database</b><p>Details: %1</qt>").arg(errorstring), i18n("LDAP Update Failure"));
}
@@ -1087,13 +1096,15 @@ void LDAPController::save() {
replicationSettings.ignore_ssl_failure = m_base->ignoreReplicationSSLFailures->isChecked();
- if (ldap_mgr->setLDAPMasterReplicationSettings(replicationSettings, NULL) != 0) {
+ if (ldap_mgr && ldap_mgr->setLDAPMasterReplicationSettings(replicationSettings, NULL) != 0) {
// ERROR
}
}
}
- delete ldap_mgr;
+ if (ldap_mgr) {
+ delete ldap_mgr;
+ }
load();
}