diff options
Diffstat (limited to 'src/primaryrealmwizard')
-rw-r--r-- | src/primaryrealmwizard/Makefile.am | 5 | ||||
-rw-r--r-- | src/primaryrealmwizard/certconfigpage.cpp | 147 | ||||
-rw-r--r-- | src/primaryrealmwizard/certconfigpage.h | 54 | ||||
-rw-r--r-- | src/primaryrealmwizard/certconfigpagedlg.ui | 319 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmconfigpage.cpp | 90 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmconfigpage.h | 50 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmconfigpagedlg.ui | 293 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmfinishpage.cpp | 77 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmfinishpage.h | 49 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmfinishpagedlg.ui | 181 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmintropage.cpp | 45 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmintropage.h | 39 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmintropagedlg.ui | 119 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmwizard.cpp | 293 | ||||
-rw-r--r-- | src/primaryrealmwizard/realmwizard.h | 87 |
15 files changed, 1848 insertions, 0 deletions
diff --git a/src/primaryrealmwizard/Makefile.am b/src/primaryrealmwizard/Makefile.am new file mode 100644 index 0000000..fd2c48a --- /dev/null +++ b/src/primaryrealmwizard/Makefile.am @@ -0,0 +1,5 @@ +INCLUDES = $(all_includes) $(KDE_INCLUDES)/tde -I$(top_srcdir)/src +METASOURCES = AUTO + +noinst_LTLIBRARIES = libprimaryrealmwizard.la +libprimaryrealmwizard_la_SOURCES = realmwizard.cpp realmintropagedlg.ui certconfigpagedlg.ui certconfigpage.cpp realmintropage.cpp realmconfigpagedlg.ui realmconfigpage.cpp realmfinishpagedlg.ui realmfinishpage.cpp
\ No newline at end of file diff --git a/src/primaryrealmwizard/certconfigpage.cpp b/src/primaryrealmwizard/certconfigpage.cpp new file mode 100644 index 0000000..2a5b6e6 --- /dev/null +++ b/src/primaryrealmwizard/certconfigpage.cpp @@ -0,0 +1,147 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <tqstringlist.h> +#include <tqlabel.h> +#include <tqmap.h> + +#include <kapplication.h> +#include <ksimpleconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <dcopclient.h> +#include <kprocess.h> +#include <klineedit.h> +#include <ktextedit.h> +#include <kwizard.h> +#include <kdialogbase.h> +#include <tqpushbutton.h> +#include <tqradiobutton.h> +#include <kurlrequester.h> + +#include "certconfigpage.h" + +CertConfigPage::CertConfigPage(TQWidget *parent, const char *name ) : CertConfigPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step2.png")); + + connect(generateKeysEnabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseGeneratedKeys(int))); + connect(generateKeysDisabled, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(setUseProvidedKeys(int))); + + connect(kerberosPEM, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(kerberosPEMKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(kerberosCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(kerberosKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapCRT, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapKEY, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + connect(organizationName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(orgUnitName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(commonName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(localityName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(stateOrProvinceName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(countryName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(emailAddress, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + m_parentWizard = dynamic_cast<KWizard*>(parent); + m_parentDialog = dynamic_cast<KDialogBase*>(parent); +} + +CertConfigPage::~CertConfigPage() { + // +} + +void CertConfigPage::setUseGeneratedKeys(int state) { + if (state == TQButton::On) { + generateKeysDisabled->setChecked(false); + + processLockouts(); + validateEntries(); + } +} + +void CertConfigPage::setUseProvidedKeys(int state) { + if (state == TQButton::On) { + generateKeysEnabled->setChecked(false); + + processLockouts(); + validateEntries(); + } +} + +void CertConfigPage::processLockouts() { + kerberosPEM->setEnabled(generateKeysDisabled->isOn()); + kerberosPEMKEY->setEnabled(generateKeysDisabled->isOn()); + kerberosCRT->setEnabled(generateKeysDisabled->isOn()); + kerberosKEY->setEnabled(generateKeysDisabled->isOn()); + ldapCRT->setEnabled(generateKeysDisabled->isOn()); + ldapKEY->setEnabled(generateKeysDisabled->isOn()); + + organizationName->setEnabled(generateKeysEnabled->isOn()); + orgUnitName->setEnabled(generateKeysEnabled->isOn()); + commonName->setEnabled(generateKeysEnabled->isOn()); + localityName->setEnabled(generateKeysEnabled->isOn()); + stateOrProvinceName->setEnabled(generateKeysEnabled->isOn()); + countryName->setEnabled(generateKeysEnabled->isOn()); + emailAddress->setEnabled(generateKeysEnabled->isOn()); +} + +void CertConfigPage::validateEntries() { + if (m_parentWizard) { + if (generateKeysEnabled->isOn()) { + if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) { + m_parentWizard->nextButton()->setEnabled(true); + } + else { + m_parentWizard->nextButton()->setEnabled(false); + } + } + else { + if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) { + m_parentWizard->nextButton()->setEnabled(true); + } + else { + m_parentWizard->nextButton()->setEnabled(false); + } + } + } + if (m_parentDialog) { + if (generateKeysEnabled->isOn()) { + if ((organizationName->text() != "") && (orgUnitName->text() != "") && (commonName->text() != "") && (localityName->text() != "") && (stateOrProvinceName->text() != "") && (countryName->text() != "") && (emailAddress->text() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } + else { + if ((kerberosPEM->url() != "") && (kerberosPEMKEY->url() != "") && (kerberosCRT->url() != "") && (kerberosKEY->url() != "") && (ldapCRT->url() != "") && (ldapKEY->url() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } + } +} + +#include "certconfigpage.moc" diff --git a/src/primaryrealmwizard/certconfigpage.h b/src/primaryrealmwizard/certconfigpage.h new file mode 100644 index 0000000..57259fc --- /dev/null +++ b/src/primaryrealmwizard/certconfigpage.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef CERTCONFIGPAGE_H +#define CERTCONFIGPAGE_H + +#include <kwizard.h> + +#include "certconfigpagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class CertConfigPage : public CertConfigPageDlg { + Q_OBJECT + +public: + CertConfigPage(TQWidget *parent=0, const char *name=0); + ~CertConfigPage(); + +public slots: + void validateEntries(); + void processLockouts(); + +private slots: + void setUseGeneratedKeys(int state); + void setUseProvidedKeys(int state); + +private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/primaryrealmwizard/certconfigpagedlg.ui b/src/primaryrealmwizard/certconfigpagedlg.ui new file mode 100644 index 0000000..0fad03d --- /dev/null +++ b/src/primaryrealmwizard/certconfigpagedlg.ui @@ -0,0 +1,319 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> + <class>CertConfigPageDlg</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>CertConfigPageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>678</width> + <height>452</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0" rowspan="9" colspan="1"> + <property name="name"> + <cstring>px_introSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQGroupBox" row="0" column="1"> + <property name="name"> + <cstring>groupCertInfo</cstring> + </property> + <property name="title"> + <string>Realm Certificate Information (required)</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQRadioButton" row="0" column="0"> + <property name="name"> + <cstring>generateKeysEnabled</cstring> + </property> + <property name="text"> + <string>Generate New Certificates and Keys</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Organization</string> + </property> + </widget> + <widget class="TQLineEdit" row="1" column="1" colspan="3"> + <property name="name"> + <cstring>organizationName</cstring> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Division/Unit</string> + </property> + </widget> + <widget class="TQLineEdit" row="2" column="1" colspan="3"> + <property name="name"> + <cstring>orgUnitName</cstring> + </property> + </widget> + <widget class="TQLabel" row="3" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Certificate Owner</string> + </property> + </widget> + <widget class="TQLineEdit" row="3" column="1" colspan="3"> + <property name="name"> + <cstring>commonName</cstring> + </property> + </widget> + <widget class="TQLabel" row="4" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>City/Locality</string> + </property> + </widget> + <widget class="TQLineEdit" row="4" column="1" colspan="3"> + <property name="name"> + <cstring>localityName</cstring> + </property> + </widget> + <widget class="TQLabel" row="5" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>State/Province</string> + </property> + </widget> + <widget class="TQLineEdit" row="5" column="1" colspan="1"> + <property name="name"> + <cstring>stateOrProvinceName</cstring> + </property> + </widget> + <widget class="TQLabel" row="5" column="2"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Country</string> + </property> + </widget> + <widget class="TQLineEdit" row="5" column="3" colspan="1"> + <property name="name"> + <cstring>countryName</cstring> + </property> + <property name="maxLength"> + <number>2</number> + </property> + </widget> + <widget class="TQLabel" row="6" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Administrative Email</string> + </property> + </widget> + <widget class="TQLineEdit" row="6" column="1" colspan="3"> + <property name="name"> + <cstring>emailAddress</cstring> + </property> + </widget> + <widget class="TQRadioButton" row="10" column="0"> + <property name="name"> + <cstring>generateKeysDisabled</cstring> + </property> + <property name="text"> + <string>Install Provided Certificates and Keys</string> + </property> + </widget> + <widget class="TQLabel" row="11" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Kerberos PKI CA Public Certificate</string> + </property> + </widget> + <widget class="KURLRequester" row="11" column="1" colspan="3"> + <property name="name"> + <cstring>kerberosPEM</cstring> + </property> + <property name="mode"> + <number>25</number> + </property> + <property name="filter"> + <cstring>*.pem|PKI Certificate Files (*.pem)</cstring> + </property> + </widget> + <widget class="TQLabel" row="12" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Kerberos PKI CA Private Key</string> + </property> + </widget> + <widget class="KURLRequester" row="12" column="1" colspan="3"> + <property name="name"> + <cstring>kerberosPEMKEY</cstring> + </property> + <property name="mode"> + <number>25</number> + </property> + <property name="filter"> + <cstring>*.key|Private Key (*.key)</cstring> + </property> + </widget> + <widget class="TQLabel" row="13" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Kerberos Public Certificate</string> + </property> + </widget> + <widget class="KURLRequester" row="13" column="1" colspan="3"> + <property name="name"> + <cstring>kerberosCRT</cstring> + </property> + <property name="mode"> + <number>25</number> + </property> + <property name="filter"> + <cstring>*.crt|Public Certificate (*.crt)</cstring> + </property> + </widget> + <widget class="TQLabel" row="14" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Kerberos Private Key</string> + </property> + </widget> + <widget class="KURLRequester" row="14" column="1" colspan="3"> + <property name="name"> + <cstring>kerberosKEY</cstring> + </property> + <property name="mode"> + <number>25</number> + </property> + <property name="filter"> + <cstring>*.key|Private Key (*.key)</cstring> + </property> + </widget> + <widget class="TQLabel" row="15" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>LDAP TLS Public Certificate</string> + </property> + </widget> + <widget class="KURLRequester" row="15" column="1" colspan="3"> + <property name="name"> + <cstring>ldapCRT</cstring> + </property> + <property name="mode"> + <number>25</number> + </property> + <property name="filter"> + <cstring>*.crt|Public Certificate (*.crt)</cstring> + </property> + </widget> + <widget class="TQLabel" row="16" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>LDAP TLS Private Key</string> + </property> + </widget> + <widget class="KURLRequester" row="16" column="1" colspan="3"> + <property name="name"> + <cstring>ldapKEY</cstring> + </property> + <property name="mode"> + <number>25</number> + </property> + <property name="filter"> + <cstring>*.key|Private Key (*.key)</cstring> + </property> + </widget> + </grid> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <spacer row="7" column="1"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </grid> + </widget> + <layoutdefaults spacing="3" margin="6"/> + <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/src/primaryrealmwizard/realmconfigpage.cpp b/src/primaryrealmwizard/realmconfigpage.cpp new file mode 100644 index 0000000..03df77d --- /dev/null +++ b/src/primaryrealmwizard/realmconfigpage.cpp @@ -0,0 +1,90 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <tqstringlist.h> +#include <tqlabel.h> +#include <tqmap.h> + +#include <kapplication.h> +#include <ksimpleconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <dcopclient.h> +#include <kprocess.h> +#include <klineedit.h> +#include <ktextedit.h> +#include <kwizard.h> +#include <kdialogbase.h> +#include <tqpushbutton.h> + +#include "realmconfigpage.h" + +RealmConfigPage::RealmConfigPage(TQWidget *parent, const char *name ) : RealmConfigPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step2.png")); + + connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(txtKDC, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(txtAdminServer, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + connect(txtRealmName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(realmNameChanged())); + + m_parentWizard = dynamic_cast<KWizard*>(parent); + m_parentDialog = dynamic_cast<KDialogBase*>(parent); +} + +RealmConfigPage::~RealmConfigPage() { + // +} + +void RealmConfigPage::validateEntries() { + if (m_parentWizard) { + if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) { + m_parentWizard->nextButton()->setEnabled(true); + } + else { + m_parentWizard->nextButton()->setEnabled(false); + } + } + if (m_parentDialog) { + if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } +} + +void RealmConfigPage::realmNameChanged() { + TQString realmName = txtRealmName->text(); + txtRealmName->setText(realmName.upper()); + + TQString defaultDomainAliases; + defaultDomainAliases = realmName.lower(); + defaultDomainAliases += "\n"; + defaultDomainAliases += "."; + defaultDomainAliases += realmName.lower(); + txtDomains->setText(defaultDomainAliases); +} + +#include "realmconfigpage.moc" diff --git a/src/primaryrealmwizard/realmconfigpage.h b/src/primaryrealmwizard/realmconfigpage.h new file mode 100644 index 0000000..99ff81f --- /dev/null +++ b/src/primaryrealmwizard/realmconfigpage.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef REALMCONFIGPAGE_H +#define REALMCONFIGPAGE_H + +#include <kwizard.h> + +#include "realmconfigpagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class RealmConfigPage : public RealmConfigPageDlg { + Q_OBJECT + +public: + RealmConfigPage(TQWidget *parent=0, const char *name=0); + ~RealmConfigPage(); + +public slots: + void validateEntries(); + void realmNameChanged(); + +private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/primaryrealmwizard/realmconfigpagedlg.ui b/src/primaryrealmwizard/realmconfigpagedlg.ui new file mode 100644 index 0000000..1661407 --- /dev/null +++ b/src/primaryrealmwizard/realmconfigpagedlg.ui @@ -0,0 +1,293 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> + <class>RealmConfigPageDlg</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>RealmConfigPageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>678</width> + <height>452</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0" rowspan="9" colspan="1"> + <property name="name"> + <cstring>px_introSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQGroupBox" row="0" column="1"> + <property name="name"> + <cstring>groupRealmInfo</cstring> + </property> + <property name="title"> + <string>Basic Realm Information (required)</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Realm Name</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1" colspan="3"> + <property name="name"> + <cstring>txtRealmName</cstring> + </property> + </widget> + <widget class="TQLabel" row="1" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Key Distribution Server [KDC]</string> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>txtKDC</cstring> + </property> + </widget> + <widget class="TQLabel" row="1" column="2"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>port</string> + </property> + </widget> + <widget class="KIntNumInput" row="1" column="3"> + <property name="name"> + <cstring>txtKDCPort</cstring> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="maxValue"> + <number>99999</number> + </property> + </widget> + <widget class="TQLabel" row="2" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Administration Server</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="1"> + <property name="name"> + <cstring>txtAdminServer</cstring> + </property> + </widget> + <widget class="TQLabel" row="2" column="2"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>port</string> + </property> + </widget> + <widget class="KIntNumInput" row="2" column="3"> + <property name="name"> + <cstring>txtAdminServerPort</cstring> + </property> + <property name="minValue"> + <number>1</number> + </property> + <property name="maxValue"> + <number>99999</number> + </property> + </widget> + <widget class="TQLabel" row="3" column="0"> + <property name="name"> + <cstring>labelUIDOffset</cstring> + </property> + <property name="text"> + <string>UID offset</string> + </property> + <property name="hidden"> + <string>true</string> + </property> + </widget> + <widget class="KIntNumInput" row="3" column="1" colspan="3"> + <property name="name"> + <cstring>txtUIDOffset</cstring> + </property> + <property name="minValue"> + <number>100</number> + </property> + <property name="maxValue"> + <number>99999</number> + </property> + <property name="hidden"> + <string>true</string> + </property> + </widget> + <widget class="TQLabel" row="4" column="0"> + <property name="name"> + <cstring>labelGIDOffset</cstring> + </property> + <property name="text"> + <string>GID offset</string> + </property> + <property name="hidden"> + <string>true</string> + </property> + </widget> + <widget class="KIntNumInput" row="4" column="1" colspan="3"> + <property name="name"> + <cstring>txtGIDOffset</cstring> + </property> + <property name="minValue"> + <number>100</number> + </property> + <property name="maxValue"> + <number>99999</number> + </property> + <property name="hidden"> + <string>true</string> + </property> + </widget> + </grid> + </widget> + <widget class="TQGroupBox" row="1" column="1"> + <property name="name"> + <cstring>groupDomainAliases</cstring> + </property> + <property name="title"> + <string>Realm Domain Aliases (optional)</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Enter each domain alias on a new line below</string> + </property> + </widget> + <widget class="KTextEdit" row="1" column="0"> + <property name="name"> + <cstring>txtDomains</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="TQGroupBox" row="2" column="1"> + <property name="name"> + <cstring>groupAdvancedPKInit</cstring> + </property> + <property name="title"> + <string>Advanced PKInit Settings (optional)</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox" row="0" column="0"> + <property name="name"> + <cstring>checkRequireEKU</cstring> + </property> + <property name="text"> + <string>Require EKU</string> + </property> + </widget> + <widget class="TQCheckBox" row="0" column="1"> + <property name="name"> + <cstring>checkRequireKrbtgtOtherName</cstring> + </property> + <property name="text"> + <string>Require KRB TGT Other Name</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="0"> + <property name="name"> + <cstring>checkWin2k</cstring> + </property> + <property name="text"> + <string>Windows 2000 Compatibility</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="1"> + <property name="name"> + <cstring>checkWin2kPkinitRequireBinding</cstring> + </property> + <property name="text"> + <string>Require Windows 2000 Binding</string> + </property> + </widget> + </grid> + </widget> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <spacer row="7" column="1"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </grid> + </widget> + <layoutdefaults spacing="3" margin="6"/> + <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/src/primaryrealmwizard/realmfinishpage.cpp b/src/primaryrealmwizard/realmfinishpage.cpp new file mode 100644 index 0000000..ec5b8de --- /dev/null +++ b/src/primaryrealmwizard/realmfinishpage.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <tqstringlist.h> +#include <tqlabel.h> +#include <tqmap.h> + +#include <kapplication.h> +#include <ksimpleconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <dcopclient.h> +#include <kprocess.h> +#include <klineedit.h> +#include <ktextedit.h> +#include <kwizard.h> +#include <kdialogbase.h> +#include <tqpushbutton.h> + +#include "realmfinishpage.h" + +RealmFinishPage::RealmFinishPage(TQWidget *parent, const char *name ) : RealmFinishPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step3.png")); + + connect(ldapAdminUsername, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapMachineAdminGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + connect(ldapStandardUserGroupname, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(validateEntries())); + + m_parentWizard = dynamic_cast<KWizard*>(parent); + m_parentDialog = dynamic_cast<KDialogBase*>(parent); +} + +RealmFinishPage::~RealmFinishPage(){ + // +} + +void RealmFinishPage::validateEntries() { + if (m_parentWizard) { + if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) { + m_parentWizard->finishButton()->setEnabled(true); + } + else { + m_parentWizard->finishButton()->setEnabled(false); + } + } + if (m_parentDialog) { + if ((ldapAdminUsername->text() != "") && (ldapAdminGroupname->text() != "") && (ldapMachineAdminGroupname->text() != "") && (ldapStandardUserGroupname->text() != "")) { + m_parentDialog->enableButton(KDialogBase::Ok, true); + } + else { + m_parentDialog->enableButton(KDialogBase::Ok, false); + } + } +} + +#include "realmfinishpage.moc" diff --git a/src/primaryrealmwizard/realmfinishpage.h b/src/primaryrealmwizard/realmfinishpage.h new file mode 100644 index 0000000..969d13b --- /dev/null +++ b/src/primaryrealmwizard/realmfinishpage.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef REALMFINISHPAGE_H +#define REALMFINISHPAGE_H + +#include <kwizard.h> + +#include "realmfinishpagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class RealmFinishPage : public RealmFinishPageDlg { + Q_OBJECT + + public: + RealmFinishPage(TQWidget *parent=0, const char *name=0); + ~RealmFinishPage(); + + public slots: + void validateEntries(); + + private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/primaryrealmwizard/realmfinishpagedlg.ui b/src/primaryrealmwizard/realmfinishpagedlg.ui new file mode 100644 index 0000000..514bbc7 --- /dev/null +++ b/src/primaryrealmwizard/realmfinishpagedlg.ui @@ -0,0 +1,181 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> + <class>RealmFinishPageDlg</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>RealmFinishPageDlg</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0" rowspan="11" colspan="1"> + <property name="name"> + <cstring>px_introSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQLabel" row="0" column="1" colspan="2"> + <property name="name"> + <cstring>yad_string</cstring> + </property> + <property name="text"> + <string><h3>You're almost done!</h3></string> + </property> + </widget> + <widget class="TQLabel" row="1" column="1" colspan="2"> + <property name="name"> + <cstring>passprompt</cstring> + </property> + <property name="text"> + <string>Please provide new LDAP realm administrator credentials below to finish setup</string> + </property> + </widget> + <widget class="TQLabel" row="2" column="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Username</string> + </property> + </widget> + <widget class="KLineEdit" row="2" column="2"> + <property name="name"> + <cstring>ldapAdminUsername</cstring> + </property> + </widget> + <widget class="TQLabel" row="3" column="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Password</string> + </property> + </widget> + <widget class="KPasswordEdit" row="3" column="2"> + <property name="name"> + <cstring>ldapAdminPassword</cstring> + </property> + </widget> + <widget class="TQLabel" row="4" column="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Confirm Password</string> + </property> + </widget> + <widget class="KPasswordEdit" row="4" column="2"> + <property name="name"> + <cstring>ldapConfirmAdminPassword</cstring> + </property> + </widget> + <widget class="TQLabel" row="5" column="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Realm Administration Group</string> + </property> + </widget> + <widget class="KLineEdit" row="5" column="2"> + <property name="name"> + <cstring>ldapAdminGroupname</cstring> + </property> + </widget> + <widget class="TQLabel" row="6" column="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Machine Administration Group</string> + </property> + </widget> + <widget class="KLineEdit" row="6" column="2"> + <property name="name"> + <cstring>ldapMachineAdminGroupname</cstring> + </property> + </widget> + <widget class="TQLabel" row="7" column="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Standard User Group</string> + </property> + </widget> + <widget class="KLineEdit" row="7" column="2"> + <property name="name"> + <cstring>ldapStandardUserGroupname</cstring> + </property> + </widget> + <widget class="TQLabel" row="8" column="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>LDAP Realm</string> + </property> + </widget> + <widget class="KLineEdit" row="8" column="2"> + <property name="name"> + <cstring>ldapAdminRealm</cstring> + </property> + </widget> + <spacer row="9" column="1"> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <spacer row="10" column="1"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </grid> + </widget> + <layoutdefaults spacing="3" margin="6"/> + <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/src/primaryrealmwizard/realmintropage.cpp b/src/primaryrealmwizard/realmintropage.cpp new file mode 100644 index 0000000..a1f2450 --- /dev/null +++ b/src/primaryrealmwizard/realmintropage.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <tqstringlist.h> +#include <tqlabel.h> +#include <tqmap.h> + +#include <kapplication.h> +#include <ksimpleconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <dcopclient.h> +#include <kprocess.h> + +#include "realmintropage.h" + +RealmIntroPage::RealmIntroPage(TQWidget *parent, const char *name ) : RealmIntroPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step1.png")); +} + +RealmIntroPage::~RealmIntroPage(){ + // +} + +#include "realmintropage.moc" diff --git a/src/primaryrealmwizard/realmintropage.h b/src/primaryrealmwizard/realmintropage.h new file mode 100644 index 0000000..1c5a9e0 --- /dev/null +++ b/src/primaryrealmwizard/realmintropage.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef REALMINTROPAGE_H +#define REALMINTROPAGE_H + +#include "realmintropagedlg.h" + +class TQStringList; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Timothy Pearson + */ + +class RealmIntroPage : public RealmIntroPageDlg { + Q_OBJECT +public: + RealmIntroPage(TQWidget *parent=0, const char *name=0); + ~RealmIntroPage(); +}; + +#endif diff --git a/src/primaryrealmwizard/realmintropagedlg.ui b/src/primaryrealmwizard/realmintropagedlg.ui new file mode 100644 index 0000000..fabd670 --- /dev/null +++ b/src/primaryrealmwizard/realmintropagedlg.ui @@ -0,0 +1,119 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>RealmIntroPageDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>RealmIntroPageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>678</width> + <height>452</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0" rowspan="9" colspan="1"> + <property name="name"> + <cstring>px_introSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>txt_welcome</cstring> + </property> + <property name="text"> + <string><h3>Welcome to the TDE LDAP Realm Setup Wizard!</h3></string> + </property> + </widget> + <widget class="TQLabel" row="1" column="1"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><p>This Wizard will help you create a new LDAP realm in four quick, easy steps.</p> + <p>Please note that this Wizard will overwrite any existing LDAP realms and data.</p> + <p>If you wish to quit the Wizard, click <b>Cancel</b> at any time.</p> + <p><b>NOTE:</b> Kerberos and LDAP rely heavily on proper DNS resolution in order to function correctly. Therefore, you must have functional forward and reverse DNS entries for this system in order to complete this Wizard.</p></string> + </property> + <property name="textFormat"> + <enum>RichText</enum> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop|AlignLeft</set> + </property> + <property name="vAlign" stdset="0"> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + <spacer row="2" column="1"> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <spacer row="7" column="1"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </grid> +</widget> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/src/primaryrealmwizard/realmwizard.cpp b/src/primaryrealmwizard/realmwizard.cpp new file mode 100644 index 0000000..2b10dc5 --- /dev/null +++ b/src/primaryrealmwizard/realmwizard.cpp @@ -0,0 +1,293 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <unistd.h> + +#include <tqpushbutton.h> +#include <tqlabel.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqfile.h> +#include <tqtimer.h> +#include <tqcursor.h> +#include <tqspinbox.h> +#include <tqcheckbox.h> +#include <tqradiobutton.h> + +#include <ksimpleconfig.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kstandarddirs.h> +#include <klocale.h> +#include <kapplication.h> +#include <klistview.h> +#include <krun.h> +#include <kmessagebox.h> +#include <kconfig.h> +#include <knuminput.h> +#include <klineedit.h> +#include <ktextedit.h> +#include <kpassdlg.h> +#include <kurlrequester.h> + +#include <stdlib.h> + +#include <kdebug.h> + +#include "realmintropage.h" +#include "realmconfigpage.h" +#include "certconfigpage.h" +#include "realmfinishpage.h" + +#include "realmwizard.h" +#include "realmwizard.moc" + +RealmWizard::RealmWizard(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")); + + intropage = new RealmIntroPage(this); + addPage (intropage, i18n( "Step 1: Introduction" ) ); + setHelpEnabled(TQWizard::page(0), false); + + realmpage = new RealmConfigPage(this); + addPage (realmpage, i18n( "Step 2: Set Up New Realm" ) ); + setHelpEnabled(TQWizard::page(1), false); + + certpage = new CertConfigPage(this); + addPage (certpage, i18n( "Step 3: Set Up Certificates" ) ); + setHelpEnabled(TQWizard::page(2), false); + + finishpage = new RealmFinishPage(this); + addPage (finishpage, i18n( "Step 4: Initialize New Realm" ) ); + setHelpEnabled(TQWizard::page(3), false); + + // Set up some defaults + realmpage->txtKDCPort->setValue(88); + realmpage->txtAdminServerPort->setValue(749); + realmpage->txtUIDOffset->setValue(5000); + realmpage->txtGIDOffset->setValue(5000); + realmpage->txtGIDOffset->setValue(5000); + TQString domainGuess = m_fqdn; + int firstDot = domainGuess.find("."); + if (firstDot >= 0) { + domainGuess.remove(0, firstDot+1); + } + realmpage->txtRealmName->setText(domainGuess); + 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); + + // Kerberos won't work unless the DNS suffix matches the realm name + realmpage->txtRealmName->setEnabled(false); + + setFinishEnabled(TQWizard::page(3), true); + + setPosition(); +} + +RealmWizard::~RealmWizard() { +} + + +void RealmWizard::next() { + if (currentPage()==intropage) { + TQWizard::next(); + realmpage->validateEntries(); + } + else if (currentPage()==realmpage) { + // Save realm information + m_realmconfig.name = realmpage->txtRealmName->text(); + m_realmconfig.bonded = false; + m_realmconfig.uid_offset = realmpage->txtUIDOffset->value(); + m_realmconfig.gid_offset = realmpage->txtGIDOffset->value(); + m_realmconfig.domain_mappings = TQStringList::split("\n", realmpage->txtDomains->text(), FALSE); + m_realmconfig.kdc = realmpage->txtKDC->text(); + m_realmconfig.kdc_port = realmpage->txtKDCPort->value(); + m_realmconfig.admin_server = realmpage->txtAdminServer->text(); + m_realmconfig.admin_server_port = realmpage->txtAdminServerPort->value(); + m_realmconfig.pkinit_require_eku = realmpage->checkRequireEKU->isChecked(); + m_realmconfig.pkinit_require_krbtgt_otherName = realmpage->checkRequireKrbtgtOtherName->isChecked(); + m_realmconfig.win2k_pkinit = realmpage->checkWin2k->isChecked(); + m_realmconfig.win2k_pkinit_require_binding = realmpage->checkWin2kPkinitRequireBinding->isChecked(); + + finishpage->ldapAdminRealm->setText(realmpage->txtRealmName->text()); + TQWizard::next(); + certpage->processLockouts(); + certpage->validateEntries(); + } + else if (currentPage()==certpage) { + // Save certificate information + // RAJA FIXME + // 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!!! + 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(); + 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(); + + TQWizard::next(); + finishpage->validateEntries(); + } + if (currentPage()==finishpage) { + finishButton()->setFocus(); + } +} + +void RealmWizard::slotNext() { + TQWizard::next(); +} + +void RealmWizard::back() { + TQWizard::back(); +} + +bool RealmWizard::askClose(){ + TQString text; + if (currentPage()==intropage) { + return true; + } + else { + if ((currentPage()==certpage) || (currentPage()==finishpage)) { + text = i18n("<p>Are you sure you want to quit the LDAP Realm 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>" + "<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()); + if(status==KMessageBox::Continue){ + setDefaults(); + return true; + } else { + return false; + } + } +} + +/** the cancel button is connected to the reject() slot of TQDialog, + * so we have to reimplement this here to add a dialogbox to ask if we + * really want to quit the wizard. + */ +void RealmWizard::reject() { + if (askClose()){ + done(-1); + } +} + +void RealmWizard::closeEvent(TQCloseEvent* e){ + if ( askClose() ) + done(0); + else + e->ignore(); +} + +/** maybe call a dialog that the wizard has finished. */ +void RealmWizard::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")); + return; + } + + // Try to create realm + TQString errorString; + // FIXME + // root account should not be locked to "admin"! + // when fixing, please fix the other instance of locked "admin" in ldapcontroller.cpp ::load() + backButton()->setEnabled(false); + 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) { + 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")); + } + + backButton()->setEnabled(true); + finishButton()->setEnabled(true); + cancelButton()->setEnabled(true); +} + +/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */ +void RealmWizard::setDefaults() { +// if(realm_dirty) +// realmpage->save(false); +} + +/** there seems to be a bug in TQWizard, that makes this evil hack necessary */ +void RealmWizard::setPosition() { + TQSize hint = intropage->sizeHint(); + TQSize realm_size = realmpage->sizeHint(); + TQSize finish_size = finishpage->sizeHint(); + + // get the width of the broadest child-widget + if ( hint.width() < realm_size.width() ) + hint.setWidth(realm_size.width()); + if ( hint.width() < finish_size.width() ) + hint.setWidth(finish_size.width()); + + // get the height of the highest child-widget + if ( hint.height() < realm_size.height() ) + hint.setHeight(realm_size.height()); + if ( hint.height() < finish_size.height() ) + hint.setHeight(finish_size.height()); + + // set the position + TQRect rect = KGlobalSettings::desktopGeometry(TQCursor::pos()); + int w = rect.x() + (rect.width() - hint.width())/2 - 9; + int h = rect.y() + (rect.height() - hint.height())/2; + move(w, h); +} diff --git a/src/primaryrealmwizard/realmwizard.h b/src/primaryrealmwizard/realmwizard.h new file mode 100644 index 0000000..34de72b --- /dev/null +++ b/src/primaryrealmwizard/realmwizard.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef BONDWIZARD_H +#define BONDWIZARD_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kapplication.h> +#include <kwizard.h> + +#include "ldapcontroller.h" + +/** prototypes */ +class KLanguageCombo; +class RealmIntroPage; +class RealmConfigPage; +class CertConfigPage; +class RealmFinishPage; + +/** RealmWizard is the base class of the project */ +class RealmWizard : public KWizard { + Q_OBJECT +public: + /** construtor */ + RealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget* parent=0, const char *name=0); + /** destructor */ + ~RealmWizard(); + + virtual void next(); + virtual void back(); + +public slots: // Public slots + /** calls all save functions after resetting all fields to Trinity default */ + void setDefaults(); + /** the cancel button is connected to the reject() slot of TQDialog, + * so we have to reimplement this here to add a dialogbox to + * ask if we really want to quit the wizard. + */ + void reject(); + /** maybe call a dialog that the wizard has finished. + * Calls applySettings() to save the current selection. + */ + void accept(); + /** We need this to use it in a TQTimer */ + void slotNext(); + +private: + void setPosition(); + +private: + RealmIntroPage* intropage; + RealmConfigPage* realmpage; + CertConfigPage* certpage; + RealmFinishPage* finishpage; + bool realm_dirty; + LDAPController* m_controller; + LDAPRealmConfig m_realmconfig; + TQString m_fqdn; + LDAPCertConfig m_certconfig; + +protected: // Protected methods + // the close button on the titlebar sets e->accept() which we don't want. + virtual void closeEvent(TQCloseEvent*); + bool askClose(); +}; + +#endif |