summaryrefslogtreecommitdiffstats
path: root/src/secondaryrealmwizard/secondaryrealmwizard.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-11 16:25:33 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-11 16:25:33 -0500
commitccfa240cc20f88ae2bbf3df9af625133b4aabcf7 (patch)
treed21e7e69b0aa2b99e2ba8e32924764ac33b845f1 /src/secondaryrealmwizard/secondaryrealmwizard.cpp
parente2d9b461c364c36b12c713b20658ab9444587d43 (diff)
downloadkcmldapcontroller-ccfa240cc20f88ae2bbf3df9af625133b4aabcf7.tar.gz
kcmldapcontroller-ccfa240cc20f88ae2bbf3df9af625133b4aabcf7.zip
Add skeleton for secondary realm controller and fix wizard
Diffstat (limited to 'src/secondaryrealmwizard/secondaryrealmwizard.cpp')
-rw-r--r--src/secondaryrealmwizard/secondaryrealmwizard.cpp108
1 files changed, 10 insertions, 98 deletions
diff --git a/src/secondaryrealmwizard/secondaryrealmwizard.cpp b/src/secondaryrealmwizard/secondaryrealmwizard.cpp
index ef37f04..ec5f470 100644
--- a/src/secondaryrealmwizard/secondaryrealmwizard.cpp
+++ b/src/secondaryrealmwizard/secondaryrealmwizard.cpp
@@ -63,23 +63,19 @@
SecondaryRealmWizard::SecondaryRealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget *parent, const char *name)
: KWizard(parent, name, true), m_controller(controller), m_fqdn(fqdn), m_certconfig(certinfo) {
- setCaption(i18n("LDAP Realm Wizard"));
+ setCaption(i18n("Secondary Realm Controller Wizard"));
intropage = new SecondaryRealmIntroPage(this);
addPage (intropage, i18n( "Step 1: Introduction" ) );
setHelpEnabled(TQWizard::page(0), false);
realmpage = new SecondaryRealmConfigPage(this);
- addPage (realmpage, i18n( "Step 2: Set Up New Realm" ) );
+ addPage (realmpage, i18n( "Step 2: Gather Realm Information" ) );
setHelpEnabled(TQWizard::page(1), false);
- certpage = new SecondaryCertConfigPage(this);
- addPage (certpage, i18n( "Step 3: Set Up Certificates" ) );
- setHelpEnabled(TQWizard::page(2), false);
-
finishpage = new SecondaryRealmFinishPage(this);
- addPage (finishpage, i18n( "Step 4: Initialize New Realm" ) );
- setHelpEnabled(TQWizard::page(3), false);
+ addPage (finishpage, i18n( "Step 3: Initialize New Realm Controller" ) );
+ setHelpEnabled(TQWizard::page(2), false);
// Set up some defaults
realmpage->txtKDCPort->setValue(88);
@@ -96,19 +92,6 @@ SecondaryRealmWizard::SecondaryRealmWizard(LDAPController* controller, TQString
realmpage->txtKDC->setText(m_fqdn);
realmpage->txtAdminServer->setText(m_fqdn);
realmpage->realmNameChanged();
- certpage->generateKeysEnabled->setChecked(true);
- finishpage->ldapAdminGroupname->setText("realmadmins");
- finishpage->ldapMachineAdminGroupname->setText("machineadmins");
- finishpage->ldapStandardUserGroupname->setText("standardusers");
-
- // Load certificate info
- certpage->organizationName->setText(m_certconfig.organizationName);
- certpage->orgUnitName->setText(m_certconfig.orgUnitName);
- certpage->commonName->setText(m_certconfig.commonName);
- certpage->localityName->setText(m_certconfig.localityName);
- certpage->stateOrProvinceName->setText(m_certconfig.stateOrProvinceName);
- certpage->countryName->setText(m_certconfig.countryName);
- certpage->emailAddress->setText(m_certconfig.emailAddress);
// Other setup
finishpage->ldapAdminRealm->setEnabled(false);
@@ -116,7 +99,7 @@ SecondaryRealmWizard::SecondaryRealmWizard(LDAPController* controller, TQString
// Kerberos won't work unless the DNS suffix matches the realm name
realmpage->txtRealmName->setEnabled(false);
- setFinishEnabled(TQWizard::page(3), true);
+ setFinishEnabled(TQWizard::page(2), true);
setPosition();
}
@@ -148,73 +131,6 @@ void SecondaryRealmWizard::next() {
finishpage->ldapAdminRealm->setText(realmpage->txtRealmName->text());
TQWizard::next();
- certpage->processLockouts();
- certpage->validateEntries();
- }
- else if (currentPage()==certpage) {
- // Save certificate information
- m_certconfig.generate_certs = certpage->generateKeysEnabled->isOn();
- m_certconfig.provided_kerberos_pem = certpage->kerberosPEM->url();
- m_certconfig.provided_kerberos_pemkey = certpage->kerberosPEMKEY->url();
- m_certconfig.provided_kerberos_crt = certpage->kerberosCRT->url();
- m_certconfig.provided_kerberos_key = certpage->kerberosKEY->url();
- m_certconfig.provided_ldap_crt = certpage->ldapCRT->url();
- m_certconfig.provided_ldap_key = certpage->ldapKEY->url();
- if (m_certconfig.generate_certs) {
- m_certconfig.organizationName = certpage->organizationName->text();
- m_certconfig.orgUnitName = certpage->orgUnitName->text();
- m_certconfig.commonName = certpage->commonName->text();
- m_certconfig.localityName = certpage->localityName->text();
- m_certconfig.stateOrProvinceName = certpage->stateOrProvinceName->text();
- m_certconfig.countryName = certpage->countryName->text();
- m_certconfig.emailAddress = certpage->emailAddress->text();
- }
- else {
- // If generate_certs == false, we need to load m_certconfig structure with data from the provided certificate
- // If this is not done, the automatic certificate updater will fail!
- TQFile file(m_certconfig.provided_kerberos_pem);
- if (file.open(IO_ReadOnly)) {
- TQByteArray ba = file.readAll();
- file.close();
-
- TQCString ssldata(ba);
- ssldata.replace("-----BEGIN CERTIFICATE-----", "");
- ssldata.replace("-----END CERTIFICATE-----", "");
- ssldata.replace("\n", "");
- KSSLCertificate* cert = KSSLCertificate::fromString(ssldata);
- if (cert) {
- TQString subj = cert->getSubject();
- TQStringList subjList = TQStringList::split("/", subj, false);
- for (TQStringList::Iterator it = subjList.begin(); it != subjList.end(); ++it) {
- TQStringList kvPair = TQStringList::split("=", *it, false);
- if (kvPair[0] == "O") {
- m_certconfig.organizationName = kvPair[1];
- }
- else if (kvPair[0] == "OU") {
- m_certconfig.orgUnitName = kvPair[1];
- }
- else if (kvPair[0] == "CN") {
- m_certconfig.commonName = kvPair[1];
- }
- else if (kvPair[0] == "L") {
- m_certconfig.localityName = kvPair[1];
- }
- else if (kvPair[0] == "ST") {
- m_certconfig.stateOrProvinceName = kvPair[1];
- }
- else if (kvPair[0] == "C") {
- m_certconfig.countryName = kvPair[1];
- }
- else if (kvPair[0] == "emailAddress") {
- m_certconfig.emailAddress = kvPair[1];
- }
- }
- delete cert;
- }
- }
- }
-
- TQWizard::next();
finishpage->validateEntries();
}
if (currentPage()==finishpage) {
@@ -237,12 +153,12 @@ bool SecondaryRealmWizard::askClose(){
}
else {
if ((currentPage()==certpage) || (currentPage()==finishpage)) {
- text = i18n("<p>Are you sure you want to quit the LDAP Realm Wizard?</p>"
+ text = i18n("<p>Are you sure you want to quit the Secondary Realm Controller Wizard?</p>"
"<p>If yes, click <b>Quit</b> and all changes will be lost."
"<br>If not, click <b>Cancel</b> to return and finish your setup.</p>");
}
else {
- text = i18n("<p>Are you sure you want to quit the LDAP Realm Wizard?</p>"
+ text = i18n("<p>Are you sure you want to quit the Secondary Realm Controller Wizard?</p>"
"<p>If not, click <b>Cancel</b> to return and finish setup.</p>");
}
int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit());
@@ -275,12 +191,8 @@ void SecondaryRealmWizard::closeEvent(TQCloseEvent* e){
/** maybe call a dialog that the wizard has finished. */
void SecondaryRealmWizard::accept() {
// Validate entries
- if (TQString(finishpage->ldapAdminPassword->password()) != TQString(finishpage->ldapConfirmAdminPassword->password())) {
- KMessageBox::error(this, i18n("<qt><b>Passwords do not match!</b><p>Please re-enter the new administration account password</qt>"), i18n("Input Error"));
- return;
- }
if (TQString(finishpage->ldapAdminPassword->password()) == "") {
- KMessageBox::error(this, i18n("<qt><b>Password required!</b><p>Please enter the new administration account password</qt>"), i18n("Input Error"));
+ KMessageBox::error(this, i18n("<qt><b>Password required!</b><p>Please enter the administration account password</qt>"), i18n("Input Error"));
return;
}
@@ -293,11 +205,11 @@ void SecondaryRealmWizard::accept() {
nextButton()->setEnabled(false);
finishButton()->setEnabled(false);
cancelButton()->setEnabled(false);
- if (m_controller->createNewLDAPRealm(this, m_realmconfig, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminGroupname->text(), finishpage->ldapMachineAdminGroupname->text(), finishpage->ldapStandardUserGroupname->text(), finishpage->ldapAdminPassword->password(), "admin", finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), m_certconfig, &errorString) == 0) {
+ if (m_controller->createNewSecondaryController(this, m_realmconfig, finishpage->ldapAdminUsername->text(), finishpage->ldapAdminPassword->password(), finishpage->ldapAdminRealm->text(), &errorString) == 0) {
done(0);
}
else {
- KMessageBox::error(this, i18n("<qt><b>Unable to create new realm!</b><p>Details: %1</qt>").arg(errorString), i18n("Unable to create new realm"));
+ KMessageBox::error(this, i18n("<qt><b>Unable to add new secondary realm controller!</b><p>Details: %1</qt>").arg(errorString), i18n("Unable to add new secondary realm controller"));
}
backButton()->setEnabled(true);