Move dns lookup routine to ldap library

pull/1/head
Timothy Pearson 12 years ago
parent 9bde560288
commit 0792d54085

@ -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;

@ -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();

@ -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();

Loading…
Cancel
Save