Move dns lookup routine to ldap library

pull/1/head
Timothy Pearson 12 years ago
parent 24377abde3
commit 8e51437b63

@ -103,7 +103,7 @@ LDAPController::LDAPController(TQWidget *parent, const char *name, const TQStrin
connect(m_base->systemEnableSupport, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts()));
connect(m_base->systemRole, TQT_SIGNAL(activated(const TQString&)), this, TQT_SLOT(systemRoleChanged()));
m_fqdn = getMachineFQDN();
m_fqdn = LDAPManager::getMachineFQDN();
// FIXME
// This assumes Debian!
@ -122,33 +122,6 @@ LDAPController::LDAPController(TQWidget *parent, const char *name, const TQStrin
LDAPController::~LDAPController() {
}
// FIXME
// This should be moved to a TDE core library
TQString LDAPController::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 LDAPController::systemRoleChanged() {
if (m_base->systemRole->currentItem() != m_prevRole) {
if (m_base->systemRole->currentItem() == ROLE_REALM_CONTROLLER) {

@ -60,10 +60,6 @@ class LDAPController: public KCModule
public:
int createNewLDAPRealm(TQWidget* dialogparent, LDAPRealmConfig realmconfig, TQString adminUserName, TQString adminGroupName, TQString machineAdminGroupName, const char * adminPassword, TQString rootUserName, const char * rootPassword, TQString adminRealm, TQString *errstr);
// FIXME
// This should be moved to a TDE core library
TQString getMachineFQDN();
private slots:
void systemRoleChanged();
void processLockouts();

Loading…
Cancel
Save