|
|
@ -18,6 +18,10 @@
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
* 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 <tqlayout.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <klocale.h>
|
|
|
|
#include <klocale.h>
|
|
|
@ -98,6 +102,11 @@ LDAPConfig::LDAPConfig(TQWidget *parent, const char *name, const TQStringList&)
|
|
|
|
connect(base->passwordHash, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changed()));
|
|
|
|
connect(base->passwordHash, TQT_SIGNAL(activated(int)), this, TQT_SLOT(changed()));
|
|
|
|
connect(base->ignoredUsers, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(changed()));
|
|
|
|
connect(base->ignoredUsers, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(changed()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_fqdn = getMachineFQDN();
|
|
|
|
|
|
|
|
base->hostFQDN->setEnabled(false);
|
|
|
|
|
|
|
|
base->hostFQDN->clear();
|
|
|
|
|
|
|
|
base->hostFQDN->insertItem(m_fqdn);
|
|
|
|
|
|
|
|
|
|
|
|
load();
|
|
|
|
load();
|
|
|
|
|
|
|
|
|
|
|
|
if (getuid() != 0 || !systemconfig->checkConfigFilesWritable( true )) {
|
|
|
|
if (getuid() != 0 || !systemconfig->checkConfigFilesWritable( true )) {
|
|
|
@ -111,6 +120,33 @@ LDAPConfig::~LDAPConfig() {
|
|
|
|
delete systemconfig;
|
|
|
|
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() {
|
|
|
|
void LDAPConfig::load() {
|
|
|
|
kgs = new KGlobalSettings();
|
|
|
|
kgs = new KGlobalSettings();
|
|
|
|
|
|
|
|
|
|
|
@ -120,6 +156,7 @@ void LDAPConfig::load() {
|
|
|
|
void LDAPConfig::load(bool useDefaults )
|
|
|
|
void LDAPConfig::load(bool useDefaults )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
bool thisIsMyMachine;
|
|
|
|
|
|
|
|
|
|
|
|
//Update the toggle buttons with the current configuration
|
|
|
|
//Update the toggle buttons with the current configuration
|
|
|
|
systemconfig->setReadDefaults( useDefaults );
|
|
|
|
systemconfig->setReadDefaults( useDefaults );
|
|
|
@ -128,6 +165,12 @@ void LDAPConfig::load(bool useDefaults )
|
|
|
|
base->systemEnableSupport->setChecked(systemconfig->readBoolEntry("EnableLDAP", false));
|
|
|
|
base->systemEnableSupport->setChecked(systemconfig->readBoolEntry("EnableLDAP", false));
|
|
|
|
m_defaultRealm = systemconfig->readEntry("DefaultRealm", TQString::null);
|
|
|
|
m_defaultRealm = systemconfig->readEntry("DefaultRealm", TQString::null);
|
|
|
|
m_ticketLifetime = systemconfig->readNumEntry("TicketLifetime", 86400);
|
|
|
|
m_ticketLifetime = systemconfig->readNumEntry("TicketLifetime", 86400);
|
|
|
|
|
|
|
|
if (m_fqdn == systemconfig->readEntry("HostFQDN", "")) {
|
|
|
|
|
|
|
|
thisIsMyMachine = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
thisIsMyMachine = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_ldapVersion = systemconfig->readNumEntry("ConnectionLDAPVersion", 3);
|
|
|
|
m_ldapVersion = systemconfig->readNumEntry("ConnectionLDAPVersion", 3);
|
|
|
|
m_ldapTimeout = systemconfig->readNumEntry("ConnectionLDAPTimeout", 2);
|
|
|
|
m_ldapTimeout = systemconfig->readNumEntry("ConnectionLDAPTimeout", 2);
|
|
|
@ -148,7 +191,12 @@ void LDAPConfig::load(bool useDefaults )
|
|
|
|
// Read in realm data
|
|
|
|
// Read in realm data
|
|
|
|
LDAPRealmConfig realmcfg;
|
|
|
|
LDAPRealmConfig realmcfg;
|
|
|
|
realmcfg.name = realmName;
|
|
|
|
realmcfg.name = realmName;
|
|
|
|
|
|
|
|
if (thisIsMyMachine) {
|
|
|
|
realmcfg.bonded = systemconfig->readBoolEntry("bonded");
|
|
|
|
realmcfg.bonded = systemconfig->readBoolEntry("bonded");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
realmcfg.bonded = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
realmcfg.uid_offset = systemconfig->readNumEntry("uid_offset");
|
|
|
|
realmcfg.uid_offset = systemconfig->readNumEntry("uid_offset");
|
|
|
|
realmcfg.gid_offset = systemconfig->readNumEntry("gid_offset");
|
|
|
|
realmcfg.gid_offset = systemconfig->readNumEntry("gid_offset");
|
|
|
|
realmcfg.domain_mappings = systemconfig->readListEntry("domain_mappings");
|
|
|
|
realmcfg.domain_mappings = systemconfig->readListEntry("domain_mappings");
|
|
|
@ -220,6 +268,7 @@ void LDAPConfig::save() {
|
|
|
|
// Write system configuration
|
|
|
|
// Write system configuration
|
|
|
|
systemconfig->setGroup(NULL);
|
|
|
|
systemconfig->setGroup(NULL);
|
|
|
|
systemconfig->writeEntry("EnableLDAP", base->systemEnableSupport->isChecked());
|
|
|
|
systemconfig->writeEntry("EnableLDAP", base->systemEnableSupport->isChecked());
|
|
|
|
|
|
|
|
systemconfig->writeEntry("HostFQDN", m_fqdn);
|
|
|
|
m_defaultRealm = base->defaultRealm->currentText();
|
|
|
|
m_defaultRealm = base->defaultRealm->currentText();
|
|
|
|
m_ticketLifetime = base->ticketLifetime->value();
|
|
|
|
m_ticketLifetime = base->ticketLifetime->value();
|
|
|
|
|
|
|
|
|
|
|
|