diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-04-12 10:20:56 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-04-12 10:20:56 -0500 |
commit | 27b49086f03315c32d30a0658e44958abd47a3ef (patch) | |
tree | b2334b80a04c4982c135a1ad228172ea2c8b3c66 /src | |
parent | 3caa3ef1be6a44a10df19ab95d01f69528667368 (diff) | |
download | kcmldap-27b49086f03315c32d30a0658e44958abd47a3ef.tar.gz kcmldap-27b49086f03315c32d30a0658e44958abd47a3ef.zip |
Add ability to control PAM options including credential caching and home directory creation
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/ldapbonding.cpp | 29 | ||||
-rw-r--r-- | src/ldapconfigbase.ui | 84 | ||||
-rw-r--r-- | src/tdeumaskinput.cpp | 61 | ||||
-rw-r--r-- | src/tdeumaskinput.h | 83 |
5 files changed, 257 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 980e2b9..dc29cb1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ METASOURCES = AUTO # Install this plugin in the KDE modules directory kde_module_LTLIBRARIES = kcm_ldapbonding.la -kcm_ldapbonding_la_SOURCES = ldapbonding.cpp ldapconfigbase.ui realmpropertiesdialog.cpp bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp ldappasswddlg.cpp +kcm_ldapbonding_la_SOURCES = tdeumaskinput.cpp ldapbonding.cpp ldapconfigbase.ui realmpropertiesdialog.cpp bondintropage.cpp bondintropagedlg.ui bondrealmpage.cpp bondrealmpagedlg.ui bondfinishpage.cpp bondfinishpagedlg.ui bondwizard.cpp ldappasswddlg.cpp kcm_ldapbonding_la_LIBADD = $(LIB_KIO) $(LIB_TDEUI) -ltdeldap kcm_ldapbonding_la_LDFLAGS = -avoid-version -module -no-undefined \ $(all_libraries) diff --git a/src/ldapbonding.cpp b/src/ldapbonding.cpp index fbf1006..9bc23db 100644 --- a/src/ldapbonding.cpp +++ b/src/ldapbonding.cpp @@ -44,6 +44,7 @@ #include <tdesu/process.h> +#include "tdeumaskinput.h" #include "ldapbonding.h" #include "bondwizard.h" #include "ldappasswddlg.h" @@ -101,6 +102,12 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&) connect(base->passwordHash, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changed())); connect(base->ignoredUsers, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(changed())); + connect(base->pamEnableCachedLogons, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); + connect(base->pamCreateHomeDirectory, TQT_SIGNAL(clicked()), this, TQT_SLOT(changed())); + connect(base->pamCreateHomeDirectory, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts())); + connect(base->pamCreateHomeDirectoryUmask, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(changed())); + connect(base->pamCreateHomeDirectorySkelDir, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(changed())); + hostFQDN = LDAPManager::getMachineFQDN(); base->hostFQDN->setEnabled(false); base->hostFQDN->clear(); @@ -158,6 +165,11 @@ void LDAPConfig::load(bool useDefaults ) } base->ignoredUsers->setText(m_clientRealmConfig.ignoredUsers); + base->pamEnableCachedLogons->setChecked(m_clientRealmConfig.pamConfig.enable_cached_credentials); + base->pamCreateHomeDirectory->setChecked(m_clientRealmConfig.pamConfig.autocreate_user_directories_enable); + base->pamCreateHomeDirectoryUmask->setValue(m_clientRealmConfig.pamConfig.autocreate_user_directories_umask); + base->pamCreateHomeDirectorySkelDir->setURL(m_clientRealmConfig.pamConfig.autocreate_user_directories_skel); + updateRealmList(); processLockouts(); @@ -205,6 +217,11 @@ void LDAPConfig::save() { m_clientRealmConfig.passwordHash = base->passwordHash->currentText(); m_clientRealmConfig.ignoredUsers = base->ignoredUsers->text(); + m_clientRealmConfig.pamConfig.enable_cached_credentials = base->pamEnableCachedLogons->isChecked(); + m_clientRealmConfig.pamConfig.autocreate_user_directories_enable = base->pamCreateHomeDirectory->isChecked(); + m_clientRealmConfig.pamConfig.autocreate_user_directories_umask = base->pamCreateHomeDirectoryUmask->value(); + m_clientRealmConfig.pamConfig.autocreate_user_directories_skel = base->pamCreateHomeDirectorySkelDir->url(); + // Write system configuration if (LDAPManager::saveClientRealmConfig(m_clientRealmConfig, systemconfig, &errorstring) != 0) { KMessageBox::error(this, i18n("<qt><b>Unable to save configuration!</b><p>Details: %2</qt>").arg(errorstring), i18n("Unable to Save Configuration")); @@ -231,7 +248,7 @@ void LDAPConfig::save() { return; } // Write the PAM configuration files - if (LDAPManager::writePAMFiles(&errorstring) != 0) { + if (LDAPManager::writePAMFiles(m_clientRealmConfig.pamConfig, &errorstring) != 0) { KMessageBox::error(this, i18n("<qt><b>Unable to save configuration!</b><p>Details: %2</qt>").arg(errorstring), i18n("Unable to Save Configuration")); return; } @@ -284,6 +301,7 @@ void LDAPConfig::processLockouts() { base->groupRealms->setEnabled(panelIsEnabled); base->groupKrbDefaults->setEnabled(panelIsEnabled); base->groupConnectionParameters->setEnabled(panelIsEnabled); + base->groupPamConfig->setEnabled(panelIsEnabled); TQListViewItem *selrealm = base->ldapRealmList->selectedItem(); if (selrealm) { @@ -308,6 +326,15 @@ void LDAPConfig::processLockouts() { base->btnRemoveRealm->setEnabled(false); base->btnRealmProperties->setEnabled(false); } + + if (base->pamCreateHomeDirectory->isChecked()) { + base->pamCreateHomeDirectoryUmask->setEnabled(true); + base->pamCreateHomeDirectorySkelDir->setEnabled(true); + } + else { + base->pamCreateHomeDirectoryUmask->setEnabled(false); + base->pamCreateHomeDirectorySkelDir->setEnabled(false); + } } void LDAPConfig::bondToNewRealm() { diff --git a/src/ldapconfigbase.ui b/src/ldapconfigbase.ui index bbc48fa..a889ac9 100644 --- a/src/ldapconfigbase.ui +++ b/src/ldapconfigbase.ui @@ -427,6 +427,89 @@ </widget> </grid> </widget> + <widget class="TQGroupBox" row="2" column="0"> + <property name="name"> + <cstring>groupPamConfig</cstring> + </property> + <property name="title"> + <string>Authentication Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQCheckBox" row="0" column="0" colspan="1"> + <property name="name"> + <cstring>pamCreateHomeDirectory</cstring> + </property> + <property name="text"> + <string>&Create home directory on first logon</string> + </property> + </widget> + <widget class="TQCheckBox" row="1" column="0" colspan="2"> + <property name="name"> + <cstring>pamEnableCachedLogons</cstring> + </property> + <property name="text"> + <string>&Enable logon credentials cache</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="2"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Home directory mode creation mask</string> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TDEUmaskInput" row="0" column="3" > + <property name="name"> + <cstring>pamCreateHomeDirectoryUmask</cstring> + </property> + <property name="base"> + <number>8</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>7777</number> + </property> + </widget> + <widget class="TQLabel" row="1" column="2"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Home directory skeleton location</string> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KURLRequester" row="1" column="3" > + <property name="name"> + <cstring>pamCreateHomeDirectorySkelDir</cstring> + </property> + <property name="mode"> + <number>18</number> + </property> + </widget> + </grid> + </widget> <spacer row="4" column="0"> <property name="name" stdset="0"> <cstring>Spacer4</cstring> @@ -454,6 +537,7 @@ </includes> <includes> <include location="local" impldecl="in implementation">kdialog.h</include> + <include location="local" impldecl="in implementation">tdeumaskinput.h</include> </includes> <layoutdefaults spacing="3" margin="6"/> <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> diff --git a/src/tdeumaskinput.cpp b/src/tdeumaskinput.cpp new file mode 100644 index 0000000..b1b2513 --- /dev/null +++ b/src/tdeumaskinput.cpp @@ -0,0 +1,61 @@ +/* + * tdeumaskinput.cpp + * + * Copyright (c) 2013 Timothy Pearson <kb9vqf@pearsoncomputing.net> + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "tdeumaskinput.h" + +TDEUmaskInput::TDEUmaskInput(TQWidget *parent, const char *name) + : KIntSpinBox(parent, name) +{ + // +} + +TDEUmaskInput::TDEUmaskInput(int lower, int upper, int step, int value, int base, + TQWidget* parent, const char* name) + : KIntSpinBox(lower, upper, step, value, base, parent, name) +{ + // +} + +TDEUmaskInput::~TDEUmaskInput() +{ + // +} + +void TDEUmaskInput::setBase(int base) +{ + KIntSpinBox::setBase(base); +} + +int TDEUmaskInput::base() const +{ + return KIntSpinBox::base(); +} + +TQString TDEUmaskInput::mapValueToText (int v) { + TQString baseText = KIntSpinBox::mapValueToText(v); + while (baseText.length() < 4) { + baseText.prepend("0"); + } + return baseText; +}
\ No newline at end of file diff --git a/src/tdeumaskinput.h b/src/tdeumaskinput.h new file mode 100644 index 0000000..e2c1898 --- /dev/null +++ b/src/tdeumaskinput.h @@ -0,0 +1,83 @@ +/* + * tdeumaskinput.h + * + * Copyright (c) 2013 Timothy Pearson <kb9vqf@pearsoncomputing.net> + * + * Requires the Qt widget libraries, available at no cost at + * http://www.troll.no/ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef TDE_UMASKINPUT_H +#define TDE_UMASKINPUT_H + +#include <knuminput.h> + +class TDEUI_EXPORT TDEUmaskInput : public KIntSpinBox +{ + Q_OBJECT + + TQ_PROPERTY( int base READ base WRITE setBase ) + + public: + /** + * Constructor. + * + * Constructs a widget with an integer inputline with a little scrollbar + * and a slider, with minimal value 0, maximal value 99, step 1, base 10 + * and initial value 0. + */ + TDEUmaskInput( TQWidget *parent=0, const char *name=0); + + /** + * Constructor. + * + * Constructs a widget with an integer inputline with a little scrollbar + * and a slider. + * + * @param lower The lowest valid value. + * @param upper The greatest valid value. + * @param step The step size of the scrollbar. + * @param value The actual value. + * @param base The base of the used number system. + * @param parent The parent of the widget. + * @param name The Name of the widget. + */ + TDEUmaskInput(int lower, int upper, int step, int value, int base = 10, TQWidget* parent = 0, const char* name = 0); + + /** + * Destructor. + */ + virtual ~TDEUmaskInput(); + + public: + /** + * Sets the base in which the numbers in the spin box are represented. + */ + void setBase(int base); + + /** + * @return the base in which numbers in the spin box are represented. + */ + int base() const; + + protected: + virtual TQString mapValueToText(int); + +}; + +#endif // TDE_UMASKINPUT_H
\ No newline at end of file |