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