Can now add/remove realms to TDE config file

pull/1/head
Timothy Pearson 13 years ago
parent 96936f9f12
commit 37acc91cac

@ -4,7 +4,7 @@ METASOURCES = AUTO
# Install this plugin in the KDE modules directory # Install this plugin in the KDE modules directory
kde_module_LTLIBRARIES = kcm_ldap.la kde_module_LTLIBRARIES = kcm_ldap.la
kcm_ldap_la_SOURCES = ldap.cpp ldapconfigbase.ui realmpropertiesdialog.cpp realmpropertiesbase.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp kcm_ldap_la_SOURCES = ldap.cpp ldapconfigbase.ui realmpropertiesdialog.cpp realmpropertiesbase.ui bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp
kcm_ldap_la_LIBADD = -lkio $(LIB_TDEUI) kcm_ldap_la_LIBADD = -lkio $(LIB_TDEUI)
kcm_ldap_la_LDFLAGS = -avoid-version -module -no-undefined \ kcm_ldap_la_LDFLAGS = -avoid-version -module -no-undefined \
$(all_libraries) $(all_libraries)

@ -35,7 +35,7 @@
BondFinishPage::BondFinishPage(TQWidget *parent, const char *name ) : BondFinishPageDlg(parent,name) { BondFinishPage::BondFinishPage(TQWidget *parent, const char *name ) : BondFinishPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step2.png")); px_introSidebar->setPixmap(UserIcon("step3.png"));
} }
BondFinishPage::~BondFinishPage(){ BondFinishPage::~BondFinishPage(){

@ -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 "bondintropage.h"
BondIntroPage::BondIntroPage(TQWidget *parent, const char *name ) : BondIntroPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step1.png"));
}
BondIntroPage::~BondIntroPage(){
//
}
#include "bondintropage.moc"

@ -0,0 +1,41 @@
/***************************************************************************
* 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 BONDINTROPAGE_H
#define BONDINTROPAGE_H
#include "ldap.h"
#include "bondintropagedlg.h"
class TQStringList;
/**Abstract class for the first wizard page. Sets the according selection on save()
*@author Timothy Pearson
*/
class BondIntroPage : public BondIntroPageDlg {
Q_OBJECT
public:
BondIntroPage(TQWidget *parent=0, const char *name=0);
~BondIntroPage();
};
#endif

@ -0,0 +1,118 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>BondIntroPageDlg</class>
<widget class="TQWidget">
<property name="name">
<cstring>BondIntroPageDlg</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>&lt;h3&gt;Welcome to the TDE LDAP Bonding Wizard!&lt;/h3&gt;</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>&lt;p&gt;This Wizard will help you bond your machine to an LDAP realm in three quick, easy steps.&lt;/p&gt;
&lt;p&gt;Please note that you will need administrative access to the LDAP realm you will be bonding with.&lt;/p&gt;
&lt;p&gt;If you wish to quit the Wizard, click &lt;b&gt;Cancel&lt;/b&gt; at any time.&lt;/p&gt;</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>

@ -30,16 +30,35 @@
#include <kiconloader.h> #include <kiconloader.h>
#include <dcopclient.h> #include <dcopclient.h>
#include <kprocess.h> #include <kprocess.h>
#include <klineedit.h>
#include <kwizard.h>
#include "bondrealmpage.h" #include "bondrealmpage.h"
BondRealmPage::BondRealmPage(TQWidget *parent, const char *name ) : BondRealmPageDlg(parent,name) { BondRealmPage::BondRealmPage(TQWidget *parent, const char *name ) : BondRealmPageDlg(parent,name) {
px_introSidebar->setPixmap(UserIcon("step1.png")); 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()));
m_parentWizard = dynamic_cast<KWizard*>(parent);
} }
BondRealmPage::~BondRealmPage(){ BondRealmPage::~BondRealmPage() {
// //
} }
void BondRealmPage::validateEntries() {
if (m_parentWizard) {
if ((txtRealmName->text() != "") && (txtKDC->text() != "") && (txtAdminServer->text() != "")) {
m_parentWizard->nextButton()->setEnabled(true);
}
else {
m_parentWizard->nextButton()->setEnabled(false);
}
}
}
#include "bondrealmpage.moc" #include "bondrealmpage.moc"

@ -26,6 +26,7 @@
#include "bondrealmpagedlg.h" #include "bondrealmpagedlg.h"
class TQStringList; class TQStringList;
class KWizard;
/**Abstract class for the first wizard page. Sets the according selection on save() /**Abstract class for the first wizard page. Sets the according selection on save()
*@author Timothy Pearson *@author Timothy Pearson
@ -33,11 +34,16 @@ class TQStringList;
class BondRealmPage : public BondRealmPageDlg { class BondRealmPage : public BondRealmPageDlg {
Q_OBJECT Q_OBJECT
public: public:
BondRealmPage(TQWidget *parent=0, const char *name=0); BondRealmPage(TQWidget *parent=0, const char *name=0);
~BondRealmPage(); ~BondRealmPage();
LDAPRealmConfig m_realmConfig; public slots:
void validateEntries();
private:
KWizard* m_parentWizard;
}; };
#endif #endif

@ -47,7 +47,206 @@
<number>0</number> <number>0</number>
</property> </property>
</widget> </widget>
<spacer row="2" column="1"> <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>unnamed</cstring>
</property>
<property name="text">
<string>UID offset</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>
</widget>
<widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>GID offset</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>
</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"> <property name="name">
<cstring>Spacer6</cstring> <cstring>Spacer6</cstring>
</property> </property>

@ -27,6 +27,7 @@
#include <tqfile.h> #include <tqfile.h>
#include <tqtimer.h> #include <tqtimer.h>
#include <tqcursor.h> #include <tqcursor.h>
#include <tqspinbox.h>
#include <ksimpleconfig.h> #include <ksimpleconfig.h>
#include <kglobal.h> #include <kglobal.h>
@ -38,29 +39,45 @@
#include <krun.h> #include <krun.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <kconfig.h> #include <kconfig.h>
#include <knuminput.h>
#include <klineedit.h>
#include <ktextedit.h>
#include <stdlib.h> #include <stdlib.h>
#include <kdebug.h> #include <kdebug.h>
#include "bondintropage.h"
#include "bondrealmpage.h" #include "bondrealmpage.h"
#include "bondfinishpage.h" #include "bondfinishpage.h"
#include "bondwizard.h" #include "bondwizard.h"
#include "bondwizard.moc" #include "bondwizard.moc"
BondWizard::BondWizard(TQWidget *parent, const char *name) BondWizard::BondWizard(LDAPRealmConfigList *realmlist, LDAPConfig *ldapconfig, TQWidget *parent, const char *name)
: KWizard(parent, name, true) { : KWizard(parent, name, true), m_realmList(realmlist), m_ldapConfig(ldapconfig) {
realmpage= new BondRealmPage(this); setCaption(i18n("LDAP Bonding Wizard"));
addPage( realmpage, i18n( "Step 1: Introduction" ) );
intropage = new BondIntroPage(this);
addPage (intropage, i18n( "Step 1: Introduction" ) );
setHelpEnabled(TQWizard::page(0), false); setHelpEnabled(TQWizard::page(0), false);
finishpage= new BondFinishPage(this); realmpage = new BondRealmPage(this);
addPage(finishpage, i18n( "Step 2: I want it my Way..." ) ); addPage (realmpage, i18n( "Step 2: Add New Realm" ) );
setHelpEnabled(TQWizard::page(1), false); setHelpEnabled(TQWizard::page(1), false);
setFinishEnabled(TQWizard::page(1), true); finishpage = new BondFinishPage(this);
addPage (finishpage, i18n( "Step 3: Bond to New Realm" ) );
setHelpEnabled(TQWizard::page(2), false);
// Set up some defaults
realmpage->txtKDCPort->setValue(88);
realmpage->txtAdminServerPort->setValue(749);
realmpage->txtUIDOffset->setValue(5000);
realmpage->txtGIDOffset->setValue(5000);
setFinishEnabled(TQWizard::page(2), true);
setPosition(); setPosition();
} }
@ -70,12 +87,38 @@ BondWizard::~BondWizard() {
void BondWizard::next() { void BondWizard::next() {
if(currentPage()==realmpage) { if (currentPage()==intropage) {
realm_dirty=true; // set the dirty flag, changes done that need reverting
// realmpage->save();
TQWizard::next(); TQWizard::next();
realmpage->validateEntries();
} }
if(currentPage()==finishpage) { else if (currentPage()==realmpage) {
// Save realm information
LDAPRealmConfig realm;
realm.name = realmpage->txtRealmName->text();
realm.bonded = false;
realm.uid_offset = realmpage->txtUIDOffset->value();
realm.gid_offset = realmpage->txtGIDOffset->value();
realm.domain_mappings = TQStringList::split("\n", realmpage->txtDomains->text(), FALSE);
realm.kdc = realmpage->txtKDC->text();
realm.kdc_port = realmpage->txtKDCPort->value();
realm.admin_server = realmpage->txtAdminServer->text();
realm.admin_server_port = realmpage->txtAdminServerPort->value();
realm.pkinit_require_eku = realmpage->checkRequireEKU->isChecked();
realm.pkinit_require_krbtgt_otherName = realmpage->checkRequireKrbtgtOtherName->isChecked();
realm.win2k_pkinit = realmpage->checkWin2k->isChecked();
realm.win2k_pkinit_require_binding = realmpage->checkWin2kPkinitRequireBinding->isChecked();
if (!m_realmList->contains(realm.name)) {
m_realmList->insert(realm.name, realm);
m_ldapConfig->save();
TQWizard::next();
}
else {
KMessageBox::error(this, i18n("<qt><b>The specified realm is already known to this system.</b><p>If the realm name is correct, please exit the Wizard and select 'Re-Bond to Realm' in the LDAP configuration module.</qt>"), i18n("Duplicate Realm Entry Detected"));
}
}
if (currentPage()==finishpage) {
finishButton()->setFocus(); finishButton()->setFocus();
} }
} }
@ -90,20 +133,25 @@ void BondWizard::back() {
bool BondWizard::askClose(){ bool BondWizard::askClose(){
TQString text; TQString text;
if (currentPage()==realmpage) { if (currentPage()==intropage) {
text = i18n("<p>Are you sure you want to quit the LDAP Bonding 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 Bonding Wizard?</p>"
"<p>If not, click <b>Cancel</b> to return and finish bonding.</p>");
}
int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit());
if(status==KMessageBox::Continue){
setDefaults();
return true; return true;
} else { }
return false; else {
if (currentPage()==realmpage) {
text = i18n("<p>Are you sure you want to quit the LDAP Bonding 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 Bonding Wizard?</p>"
"<p>If not, click <b>Cancel</b> to return and finish bonding.</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;
}
} }
} }
@ -137,14 +185,19 @@ void BondWizard::setDefaults(){
/** there seems to be a bug in TQWizard, that makes this evil hack necessary */ /** there seems to be a bug in TQWizard, that makes this evil hack necessary */
void BondWizard::setPosition() { void BondWizard::setPosition() {
TQSize hint = realmpage->sizeHint(); TQSize hint = intropage->sizeHint();
TQSize realm_size = realmpage->sizeHint();
TQSize finish_size = finishpage->sizeHint(); TQSize finish_size = finishpage->sizeHint();
// get the width of the broadest child-widget // 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() ) if ( hint.width() < finish_size.width() )
hint.setWidth(finish_size.width()); hint.setWidth(finish_size.width());
// get the height of the highest child-widget // 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() ) if ( hint.height() < finish_size.height() )
hint.setHeight(finish_size.height()); hint.setHeight(finish_size.height());

@ -28,8 +28,11 @@
#include <kapplication.h> #include <kapplication.h>
#include <kwizard.h> #include <kwizard.h>
#include "ldap.h"
/** prototypes */ /** prototypes */
class KLanguageCombo; class KLanguageCombo;
class BondIntroPage;
class BondRealmPage; class BondRealmPage;
class BondFinishPage; class BondFinishPage;
@ -38,7 +41,7 @@ class BondWizard : public KWizard {
Q_OBJECT Q_OBJECT
public: public:
/** construtor */ /** construtor */
BondWizard(TQWidget* parent=0, const char *name=0); BondWizard(LDAPRealmConfigList *realmlist, LDAPConfig *ldapconfig, TQWidget* parent=0, const char *name=0);
/** destructor */ /** destructor */
~BondWizard(); ~BondWizard();
@ -64,9 +67,12 @@ private:
void setPosition(); void setPosition();
private: private:
BondIntroPage* intropage;
BondRealmPage* realmpage; BondRealmPage* realmpage;
BondFinishPage* finishpage; BondFinishPage* finishpage;
bool realm_dirty; bool realm_dirty;
LDAPRealmConfigList* m_realmList;
LDAPConfig* m_ldapConfig;
protected: // Protected methods protected: // Protected methods
// the close button on the titlebar sets e->accept() which we don't want. // the close button on the titlebar sets e->accept() which we don't want.

@ -64,14 +64,17 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&)
base = new LDAPConfigBase(this); base = new LDAPConfigBase(this);
layout->add(base); layout->add(base);
base->ldapRealmList->setAllColumnsShowFocus(true);
setRootOnlyMsg(i18n("<b>Bonded LDAP realms take effect system wide, and require administrator access to modify</b><br>To alter the system's bonded LDAP realms, click on the \"Administrator Mode\" button below.")); setRootOnlyMsg(i18n("<b>Bonded LDAP realms take effect system wide, and require administrator access to modify</b><br>To alter the system's bonded LDAP realms, click on the \"Administrator Mode\" button below."));
setUseRootOnlyMsg(true); setUseRootOnlyMsg(true);
connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(changed())); connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed()));
connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(processLockouts())); connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts()));
connect(base->ldapRealmList, TQT_SIGNAL(selectionChanged()), this, TQT_SLOT(processLockouts()));
connect(base->btnBondRealm, TQT_SIGNAL(clicked()), TQT_SLOT(bondToNewRealm())); connect(base->btnBondRealm, TQT_SIGNAL(clicked()), TQT_SLOT(bondToNewRealm()));
connect(base->btnRemoveRealm, TQT_SIGNAL(clicked()), TQT_SLOT(removeRealm()));
load(); load();
@ -102,12 +105,13 @@ void LDAPConfig::load(bool useDefaults )
base->systemEnableSupport->setChecked(systemconfig->readBoolEntry("EnableLDAP", false)); base->systemEnableSupport->setChecked(systemconfig->readBoolEntry("EnableLDAP", false));
// Load realms // Load realms
m_realms.clear();
TQStringList cfgRealms = systemconfig->groupList(); TQStringList cfgRealms = systemconfig->groupList();
for (TQStringList::Iterator it(cfgRealms.begin()); it != cfgRealms.end(); ++it) { for (TQStringList::Iterator it(cfgRealms.begin()); it != cfgRealms.end(); ++it) {
if ((*it).startsWith("LDAPRealm-")) { if ((*it).startsWith("LDAPRealm-")) {
systemconfig->setGroup(*it); systemconfig->setGroup(*it);
TQString realmName=*it; TQString realmName=*it;
realmName.remove(strlen("LDAPRealm-")); realmName.remove(0,strlen("LDAPRealm-"));
if (!m_realms.contains(realmName)) { if (!m_realms.contains(realmName)) {
// Read in realm data // Read in realm data
LDAPRealmConfig realmcfg; LDAPRealmConfig realmcfg;
@ -124,18 +128,28 @@ void LDAPConfig::load(bool useDefaults )
realmcfg.pkinit_require_krbtgt_otherName = systemconfig->readBoolEntry("pkinit_require_krbtgt_otherName"); realmcfg.pkinit_require_krbtgt_otherName = systemconfig->readBoolEntry("pkinit_require_krbtgt_otherName");
realmcfg.win2k_pkinit = systemconfig->readBoolEntry("win2k_pkinit"); realmcfg.win2k_pkinit = systemconfig->readBoolEntry("win2k_pkinit");
realmcfg.win2k_pkinit_require_binding = systemconfig->readBoolEntry("win2k_pkinit_require_binding"); realmcfg.win2k_pkinit_require_binding = systemconfig->readBoolEntry("win2k_pkinit_require_binding");
// Add realm to lists // Add realm to list
m_realms.insert(realmName, realmcfg); m_realms.insert(realmName, realmcfg);
(void)new TQListViewItem(base->ldapRealmList, ((realmcfg.bonded)?i18n("Bonded"):i18n("Deactivated")), realmName);
} }
} }
} }
updateRealmList();
processLockouts(); processLockouts();
emit changed(useDefaults); emit changed(useDefaults);
} }
void LDAPConfig::updateRealmList() {
base->ldapRealmList->clear();
LDAPRealmConfigList::Iterator it;
for (it = m_realms.begin(); it != m_realms.end(); ++it) {
LDAPRealmConfig realmcfg = it.data();
(void)new TQListViewItem(base->ldapRealmList, ((realmcfg.bonded)?i18n("Bonded"):i18n("Deactivated")), realmcfg.name);
}
}
void LDAPConfig::defaults() { void LDAPConfig::defaults() {
} }
@ -165,6 +179,23 @@ void LDAPConfig::save() {
systemconfig->writeEntry("win2k_pkinit", realmcfg.win2k_pkinit); systemconfig->writeEntry("win2k_pkinit", realmcfg.win2k_pkinit);
systemconfig->writeEntry("win2k_pkinit_require_binding", realmcfg.win2k_pkinit_require_binding); systemconfig->writeEntry("win2k_pkinit_require_binding", realmcfg.win2k_pkinit_require_binding);
} }
// Delete any realms that do not exist in the m_realms database
TQStringList cfgRealms = systemconfig->groupList();
for (TQStringList::Iterator it(cfgRealms.begin()); it != cfgRealms.end(); ++it) {
if ((*it).startsWith("LDAPRealm-")) {
systemconfig->setGroup(*it);
TQString realmName=*it;
realmName.remove(0,strlen("LDAPRealm-"));
if (!m_realms.contains(realmName)) {
systemconfig->deleteGroup(*it);
}
}
}
systemconfig->sync();
load();
} }
void LDAPConfig::processLockouts() { void LDAPConfig::processLockouts() {
@ -174,11 +205,19 @@ void LDAPConfig::processLockouts() {
TQListViewItem *selrealm = base->ldapRealmList->selectedItem(); TQListViewItem *selrealm = base->ldapRealmList->selectedItem();
if (selrealm) { if (selrealm) {
LDAPRealmConfig realmcfg = m_realms[selrealm->text(1)];
base->btnBondRealm->setEnabled(true); base->btnBondRealm->setEnabled(true);
base->btnReBondRealm->setEnabled(true); base->btnReBondRealm->setEnabled(true);
base->btnDeactivateRealm->setEnabled(true); // RAJA FIXME only if realm is bonded if (realmcfg.bonded) {
base->btnRemoveRealm->setEnabled(true); // RAJA FIXME only if realm is not bonded base->btnDeactivateRealm->setEnabled(true);
base->btnRealmProperties->setEnabled(true); // RAJA FIXME only if realm is not bonded base->btnRemoveRealm->setEnabled(false);
base->btnRealmProperties->setEnabled(false);
}
else {
base->btnDeactivateRealm->setEnabled(false);
base->btnRemoveRealm->setEnabled(true);
base->btnRealmProperties->setEnabled(true);
}
} }
else { else {
base->btnBondRealm->setEnabled(true); base->btnBondRealm->setEnabled(true);
@ -195,13 +234,22 @@ void LDAPConfig::bondToNewRealm() {
// Something will probably change // Something will probably change
save(); save();
BondWizard *bondwizard = new BondWizard(this); BondWizard bondwizard(&m_realms, this, this);
bondwizard->exec(); bondwizard.exec();
// Something probably changed // Something probably changed
load(); load();
} }
void LDAPConfig::removeRealm() {
TQListViewItem *selrealm = base->ldapRealmList->selectedItem();
if (selrealm) {
m_realms.remove(selrealm->text(1));
updateRealmList();
changed();
}
}
int LDAPConfig::buttons() { int LDAPConfig::buttons() {
return KCModule::Apply|KCModule::Help; return KCModule::Apply|KCModule::Help;
} }

@ -77,6 +77,10 @@ class LDAPConfig: public KCModule
private slots: private slots:
void processLockouts(); void processLockouts();
void bondToNewRealm(); void bondToNewRealm();
void removeRealm();
private:
void updateRealmList();
private: private:
KAboutData *myAboutData; KAboutData *myAboutData;

@ -137,7 +137,7 @@
</property> </property>
</widget> </widget>
</grid> </grid>
</widget> </widget>
<spacer row="4" column="0"> <spacer row="4" column="0">
<property name="name" stdset="0"> <property name="name" stdset="0">
<cstring>Spacer4</cstring> <cstring>Spacer4</cstring>

Loading…
Cancel
Save