diff options
Diffstat (limited to 'src/secondaryrealmwizard')
-rw-r--r-- | src/secondaryrealmwizard/Makefile.am | 5 | ||||
-rw-r--r-- | src/secondaryrealmwizard/certconfigpage.cpp | 147 | ||||
-rw-r--r-- | src/secondaryrealmwizard/certconfigpage.h | 54 | ||||
-rw-r--r-- | src/secondaryrealmwizard/certconfigpagedlg.ui | 319 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmconfigpage.cpp | 90 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmconfigpage.h | 50 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmconfigpagedlg.ui | 293 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmfinishpage.cpp | 77 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmfinishpage.h | 49 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmfinishpagedlg.ui | 181 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmintropage.cpp | 45 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmintropage.h | 39 | ||||
-rw-r--r-- | src/secondaryrealmwizard/realmintropagedlg.ui | 119 | ||||
-rw-r--r-- | src/secondaryrealmwizard/secondaryrealmwizard.cpp | 337 | ||||
-rw-r--r-- | src/secondaryrealmwizard/secondaryrealmwizard.h | 87 |
15 files changed, 1892 insertions, 0 deletions
diff --git a/src/secondaryrealmwizard/Makefile.am b/src/secondaryrealmwizard/Makefile.am new file mode 100644 index 0000000..883f260 --- /dev/null +++ b/src/secondaryrealmwizard/Makefile.am @@ -0,0 +1,5 @@ +INCLUDES = $(all_includes) $(KDE_INCLUDES)/tde -I$(top_srcdir)/src +METASOURCES = AUTO + +noinst_LTLIBRARIES = libsecondaryrealmwizard.la +libsecondaryrealmwizard_la_SOURCES = secondaryrealmwizard.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/secondaryrealmwizard/certconfigpage.cpp b/src/secondaryrealmwizard/certconfigpage.cpp new file mode 100644 index 0000000..fd289e9 --- /dev/null +++ b/src/secondaryrealmwizard/certconfigpage.cpp @@ -0,0 +1,147 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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" + +SecondaryCertConfigPage::SecondaryCertConfigPage(TQWidget *parent, const char *name ) : SecondaryCertConfigPageDlg(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); +} + +SecondaryCertConfigPage::~SecondaryCertConfigPage() { + // +} + +void SecondaryCertConfigPage::setUseGeneratedKeys(int state) { + if (state == TQButton::On) { + generateKeysDisabled->setChecked(false); + + processLockouts(); + validateEntries(); + } +} + +void SecondaryCertConfigPage::setUseProvidedKeys(int state) { + if (state == TQButton::On) { + generateKeysEnabled->setChecked(false); + + processLockouts(); + validateEntries(); + } +} + +void SecondaryCertConfigPage::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 SecondaryCertConfigPage::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/secondaryrealmwizard/certconfigpage.h b/src/secondaryrealmwizard/certconfigpage.h new file mode 100644 index 0000000..6c5e404 --- /dev/null +++ b/src/secondaryrealmwizard/certconfigpage.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 SecondaryCertConfigPage : public SecondaryCertConfigPageDlg { + Q_OBJECT + +public: + SecondaryCertConfigPage(TQWidget *parent=0, const char *name=0); + ~SecondaryCertConfigPage(); + +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/secondaryrealmwizard/certconfigpagedlg.ui b/src/secondaryrealmwizard/certconfigpagedlg.ui new file mode 100644 index 0000000..52053dc --- /dev/null +++ b/src/secondaryrealmwizard/certconfigpagedlg.ui @@ -0,0 +1,319 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> + <class>SecondaryCertConfigPageDlg</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>SecondaryCertConfigPageDlg</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/secondaryrealmwizard/realmconfigpage.cpp b/src/secondaryrealmwizard/realmconfigpage.cpp new file mode 100644 index 0000000..f561e3f --- /dev/null +++ b/src/secondaryrealmwizard/realmconfigpage.cpp @@ -0,0 +1,90 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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" + +SecondaryRealmConfigPage::SecondaryRealmConfigPage(TQWidget *parent, const char *name ) : SecondaryRealmConfigPageDlg(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); +} + +SecondaryRealmConfigPage::~SecondaryRealmConfigPage() { + // +} + +void SecondaryRealmConfigPage::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 SecondaryRealmConfigPage::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/secondaryrealmwizard/realmconfigpage.h b/src/secondaryrealmwizard/realmconfigpage.h new file mode 100644 index 0000000..f9ab6ce --- /dev/null +++ b/src/secondaryrealmwizard/realmconfigpage.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 SecondaryRealmConfigPage : public SecondaryRealmConfigPageDlg { + Q_OBJECT + +public: + SecondaryRealmConfigPage(TQWidget *parent=0, const char *name=0); + ~SecondaryRealmConfigPage(); + +public slots: + void validateEntries(); + void realmNameChanged(); + +private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/secondaryrealmwizard/realmconfigpagedlg.ui b/src/secondaryrealmwizard/realmconfigpagedlg.ui new file mode 100644 index 0000000..844b37e --- /dev/null +++ b/src/secondaryrealmwizard/realmconfigpagedlg.ui @@ -0,0 +1,293 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> + <class>SecondaryRealmConfigPageDlg</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>SecondaryRealmConfigPageDlg</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/secondaryrealmwizard/realmfinishpage.cpp b/src/secondaryrealmwizard/realmfinishpage.cpp new file mode 100644 index 0000000..27c09df --- /dev/null +++ b/src/secondaryrealmwizard/realmfinishpage.cpp @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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" + +SecondaryRealmFinishPage::SecondaryRealmFinishPage(TQWidget *parent, const char *name ) : SecondaryRealmFinishPageDlg(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); +} + +SecondaryRealmFinishPage::~SecondaryRealmFinishPage(){ + // +} + +void SecondaryRealmFinishPage::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/secondaryrealmwizard/realmfinishpage.h b/src/secondaryrealmwizard/realmfinishpage.h new file mode 100644 index 0000000..88e2f0a --- /dev/null +++ b/src/secondaryrealmwizard/realmfinishpage.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 SecondaryRealmFinishPage : public SecondaryRealmFinishPageDlg { + Q_OBJECT + + public: + SecondaryRealmFinishPage(TQWidget *parent=0, const char *name=0); + ~SecondaryRealmFinishPage(); + + public slots: + void validateEntries(); + + private: + KWizard* m_parentWizard; + KDialogBase* m_parentDialog; +}; + +#endif diff --git a/src/secondaryrealmwizard/realmfinishpagedlg.ui b/src/secondaryrealmwizard/realmfinishpagedlg.ui new file mode 100644 index 0000000..4d93234 --- /dev/null +++ b/src/secondaryrealmwizard/realmfinishpagedlg.ui @@ -0,0 +1,181 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> + <class>SecondaryRealmFinishPageDlg</class> + <widget class="TQWidget"> + <property name="name"> + <cstring>SecondaryRealmFinishPageDlg</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/secondaryrealmwizard/realmintropage.cpp b/src/secondaryrealmwizard/realmintropage.cpp new file mode 100644 index 0000000..6c5841f --- /dev/null +++ b/src/secondaryrealmwizard/realmintropage.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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" + +SecondaryRealmIntroPage::SecondaryRealmIntroPage(TQWidget *parent, const char *name ) : SecondaryRealmIntroPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step1.png")); +} + +SecondaryRealmIntroPage::~SecondaryRealmIntroPage(){ + // +} + +#include "realmintropage.moc" diff --git a/src/secondaryrealmwizard/realmintropage.h b/src/secondaryrealmwizard/realmintropage.h new file mode 100644 index 0000000..56fce83 --- /dev/null +++ b/src/secondaryrealmwizard/realmintropage.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 SecondaryRealmIntroPage : public SecondaryRealmIntroPageDlg { + Q_OBJECT +public: + SecondaryRealmIntroPage(TQWidget *parent=0, const char *name=0); + ~SecondaryRealmIntroPage(); +}; + +#endif diff --git a/src/secondaryrealmwizard/realmintropagedlg.ui b/src/secondaryrealmwizard/realmintropagedlg.ui new file mode 100644 index 0000000..59774ae --- /dev/null +++ b/src/secondaryrealmwizard/realmintropagedlg.ui @@ -0,0 +1,119 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>SecondaryRealmIntroPageDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>SecondaryRealmIntroPageDlg</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/secondaryrealmwizard/secondaryrealmwizard.cpp b/src/secondaryrealmwizard/secondaryrealmwizard.cpp new file mode 100644 index 0000000..ef37f04 --- /dev/null +++ b/src/secondaryrealmwizard/secondaryrealmwizard.cpp @@ -0,0 +1,337 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 <ksslcertificate.h> + +#include <stdlib.h> + +#include <kdebug.h> + +#include "realmintropage.h" +#include "realmconfigpage.h" +#include "certconfigpage.h" +#include "realmfinishpage.h" + +#include "secondaryrealmwizard.h" +#include "secondaryrealmwizard.moc" + +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")); + + 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" ) ); + 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); + + // 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(); +} + +SecondaryRealmWizard::~SecondaryRealmWizard() { +} + + +void SecondaryRealmWizard::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 + 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) { + finishButton()->setFocus(); + } +} + +void SecondaryRealmWizard::slotNext() { + TQWizard::next(); +} + +void SecondaryRealmWizard::back() { + TQWizard::back(); +} + +bool SecondaryRealmWizard::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 SecondaryRealmWizard::reject() { + if (askClose()){ + done(-1); + } +} + +void SecondaryRealmWizard::closeEvent(TQCloseEvent* e){ + if ( askClose() ) + done(0); + else + e->ignore(); +} + +/** 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")); + 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 SecondaryRealmWizard::setDefaults() { +// if(realm_dirty) +// realmpage->save(false); +} + +/** there seems to be a bug in TQWizard, that makes this evil hack necessary */ +void SecondaryRealmWizard::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/secondaryrealmwizard/secondaryrealmwizard.h b/src/secondaryrealmwizard/secondaryrealmwizard.h new file mode 100644 index 0000000..0fb5f48 --- /dev/null +++ b/src/secondaryrealmwizard/secondaryrealmwizard.h @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * [email protected] * + * * + * 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 SECONDARYREALMWIZARD_H +#define SECONDARYREALMWIZARD_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kapplication.h> +#include <kwizard.h> + +#include "ldapcontroller.h" + +/** prototypes */ +class KLanguageCombo; +class SecondaryRealmIntroPage; +class SecondaryRealmConfigPage; +class SecondaryCertConfigPage; +class SecondaryRealmFinishPage; + +/** SecondaryRealmWizard is the base class of the project */ +class SecondaryRealmWizard : public KWizard { + Q_OBJECT +public: + /** construtor */ + SecondaryRealmWizard(LDAPController* controller, TQString fqdn, LDAPCertConfig certinfo, TQWidget* parent=0, const char *name=0); + /** destructor */ + ~SecondaryRealmWizard(); + + 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: + SecondaryRealmIntroPage* intropage; + SecondaryRealmConfigPage* realmpage; + SecondaryCertConfigPage* certpage; + SecondaryRealmFinishPage* 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 |