summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-06-05 01:05:35 -0500
committerTimothy Pearson <[email protected]>2012-06-05 01:05:35 -0500
commit0792d5408516a0a4c04e56cabefa7d1ffc440899 (patch)
tree52852852327efcbd4d0ae05453c5bde8202bf73d /src
parent9bde56028895a13a7a0139f37c3f6957fe92e158 (diff)
downloadkcmldap-0792d5408516a0a4c04e56cabefa7d1ffc440899.tar.gz
kcmldap-0792d5408516a0a4c04e56cabefa7d1ffc440899.zip
Move dns lookup routine to ldap library
Diffstat (limited to 'src')
-rw-r--r--src/ldap.desktop4
-rw-r--r--src/ldapbonding.cpp38
-rw-r--r--src/ldapbonding.h4
3 files changed, 7 insertions, 39 deletions
diff --git a/src/ldap.desktop b/src/ldap.desktop
index 5c4fe29..d931e39 100644
--- a/src/ldap.desktop
+++ b/src/ldap.desktop
@@ -13,7 +13,7 @@ X-KDE-SubstituteUID=true
[Desktop Entry]
Encoding=UTF-8
-Comment=A KControl tool for managing TDE connections to LDAP realms.
+Comment=A KControl tool for managing TDE bonding to LDAP realms.
Keywords=ldap manager
-Name=LDAP Realm Configuration
+Name=LDAP Realm Bonding
Categories=Qt;KDE;X-KDE-settings-components;
diff --git a/src/ldapbonding.cpp b/src/ldapbonding.cpp
index 9c9d9b5..d0d5346 100644
--- a/src/ldapbonding.cpp
+++ b/src/ldapbonding.cpp
@@ -18,10 +18,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
#include <tqlayout.h>
#include <klocale.h>
@@ -108,14 +104,17 @@ 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()));
- m_fqdn = getMachineFQDN();
+ m_fqdn = LDAPManager::getMachineFQDN();
base->hostFQDN->setEnabled(false);
base->hostFQDN->clear();
base->hostFQDN->insertItem(m_fqdn);
load();
- if (getuid() != 0 || !systemconfig->checkConfigFilesWritable( true )) {
+ systemconfig->setGroup(NULL);
+ TQString ldapRole = systemconfig->readEntry("LDAPRole", "Workstation");
+
+ if ((getuid() != 0) || (!systemconfig->checkConfigFilesWritable( true )) || (ldapRole != "Workstation")) {
base->systemEnableSupport->setEnabled(false);
}
@@ -126,33 +125,6 @@ LDAPConfig::~LDAPConfig() {
delete systemconfig;
}
-// FIXME
-// This should be moved to a TDE core library
-TQString LDAPConfig::getMachineFQDN() {
- struct addrinfo hints, *info, *p;
- int gai_result;
-
- char hostname[1024];
- hostname[1023] = '\0';
- gethostname(hostname, 1023);
-
- memset(&hints, 0, sizeof hints);
- hints.ai_family = AF_UNSPEC; // IPV4 or IPV6
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_CANONNAME;
-
- if ((gai_result = getaddrinfo(hostname, NULL, &hints, &info)) != 0) {
- return TQString(hostname);
- }
- TQString fqdn = TQString(hostname);
- for (p=info; p!=NULL; p=p->ai_next) {
- fqdn = TQString(p->ai_canonname);
- }
- freeaddrinfo(info);
-
- return fqdn;
-}
-
void LDAPConfig::load() {
kgs = new KGlobalSettings();
diff --git a/src/ldapbonding.h b/src/ldapbonding.h
index ac7979a..ebe4973 100644
--- a/src/ldapbonding.h
+++ b/src/ldapbonding.h
@@ -58,10 +58,6 @@ class LDAPConfig: public KCModule
int bondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, const char * adminPassword, TQString adminRealm, TQString *errstr=0);
int unbondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, const char * adminPassword, TQString adminRealm, TQString *errstr=0);
- // FIXME
- // This should be moved to a TDE core library
- TQString getMachineFQDN();
-
private slots:
void processLockouts();
void bondToNewRealm();