summaryrefslogtreecommitdiffstats
path: root/src/ldapbonding.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-05 01:05:35 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-06-05 01:05:35 -0500
commit0792d5408516a0a4c04e56cabefa7d1ffc440899 (patch)
tree52852852327efcbd4d0ae05453c5bde8202bf73d /src/ldapbonding.cpp
parent9bde56028895a13a7a0139f37c3f6957fe92e158 (diff)
downloadkcmldap-0792d5408516a0a4c04e56cabefa7d1ffc440899.tar.gz
kcmldap-0792d5408516a0a4c04e56cabefa7d1ffc440899.zip
Move dns lookup routine to ldap library
Diffstat (limited to 'src/ldapbonding.cpp')
-rw-r--r--src/ldapbonding.cpp38
1 files changed, 5 insertions, 33 deletions
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();