diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-02 03:09:14 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-02 03:09:14 -0500 |
commit | 8daa9e9e96c6b088bfe8ed1a69947238c7d6e62e (patch) | |
tree | 71727d7af1f0f514591270b4702ed5613b1f1c56 /src/ldapcontroller.cpp | |
parent | 67f4ccf0b694f8a6f4aaa923b3500a095d9e5457 (diff) | |
download | kcmldapcontroller-8daa9e9e96c6b088bfe8ed1a69947238c7d6e62e.tar.gz kcmldapcontroller-8daa9e9e96c6b088bfe8ed1a69947238c7d6e62e.zip |
Start working on kerberos
Diffstat (limited to 'src/ldapcontroller.cpp')
-rw-r--r-- | src/ldapcontroller.cpp | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/src/ldapcontroller.cpp b/src/ldapcontroller.cpp index 427148b..4bcf59d 100644 --- a/src/ldapcontroller.cpp +++ b/src/ldapcontroller.cpp @@ -294,6 +294,24 @@ void replacePlaceholdersInFile(TQString infile, TQString outfile, LDAPRealmConfi tqApp->processEvents(); } +int LDAPController::controlHeimdalServer(sc_command command) { + if (command == SC_START) { + // FIXME + // This assumes Debian! + return system("/etc/init.d/heimdal-kdc start"); + } + if (command == SC_STOP) { + // FIXME + // This assumes Debian! + return system("/etc/init.d/heimdal-kdc stop"); + } + if (command == SC_RESTART) { + // FIXME + // This assumes Debian! + return system("/etc/init.d/heimdal-kdc restart"); + } +} + int LDAPController::controlLDAPServer(sc_command command, uid_t userid, gid_t groupid) { if (command == SC_START) { // FIXME @@ -318,6 +336,8 @@ int LDAPController::controlLDAPServer(sc_command command, uid_t userid, gid_t gr } if (command == SC_SETDBPERMS) { if ((userid > 0) && (groupid > 0)) { + // FIXME + // This assumes Debian! TQString command; command = TQString("chown -R %1 /var/lib/ldap/*").arg(userid); system(command.ascii()); @@ -357,7 +377,7 @@ configTempDir.setAutoDelete(false); // RAJA DEBUG ONLY replacePlaceholdersInFile(templateDir + "heimdal/heimdal.defaults", destDir + "heimdal.defaults", realmconfig, adminUserName, adminGroupName, adminPassword, rootUserName, rootPassword); replacePlaceholdersInFile(templateDir + "heimdal/kadmind.acl", destDir + "kadmind.acl", realmconfig, adminUserName, adminGroupName, adminPassword, rootUserName, rootPassword); - replacePlaceholdersInFile(templateDir + "heimdal/kdc.conf", destDir + "kdc.conf", realmconfig, adminUserName, adminGroupName, adminPassword, rootUserName, rootPassword); + replacePlaceholdersInFile(templateDir + "heimdal/kdc.conf", destDir + "heimdal-kdc/kdc.conf", realmconfig, adminUserName, adminGroupName, adminPassword, rootUserName, rootPassword); replacePlaceholdersInFile(templateDir + "heimdal/krb5.conf", destDir + "krb5.conf", realmconfig, adminUserName, adminGroupName, adminPassword, rootUserName, rootPassword); replacePlaceholdersInFile(templateDir + "openldap/skel.ldif", configTempDir.name() + "skel.ldif", realmconfig, adminUserName, adminGroupName, adminPassword, rootUserName, rootPassword); @@ -387,20 +407,21 @@ configTempDir.setAutoDelete(false); // RAJA DEBUG ONLY // Set permissions chmod(TQString(destDir + "heimdal.defaults").ascii(), S_IRUSR|S_IWUSR|S_IRGRP); chmod(TQString(destDir + "kadmind.acl").ascii(), S_IRUSR|S_IWUSR|S_IRGRP); - chmod(TQString(destDir + "kdc.conf").ascii(), S_IRUSR|S_IWUSR|S_IRGRP); + chmod(TQString(destDir + "heimdal-kdc/kdc.conf").ascii(), S_IRUSR|S_IWUSR|S_IRGRP); chmod(TQString(destDir + "krb5.conf").ascii(), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); chmod(TQString(configTempDir.name() + "skel.ldif").ascii(), S_IRUSR|S_IWUSR); chmod(TQString(destDir + "ldap/slapd.conf").ascii(), S_IRUSR|S_IWUSR); chmod(TQString(destDir + "ldap/slapd.defaults").ascii(), S_IRUSR|S_IWUSR|S_IRGRP); - pdialog.setStatusMessage(i18n("Purging existing LDAP database...")); - tqApp->processEvents(); - controlLDAPServer(SC_PURGE); - - pdialog.setStatusMessage(i18n("Loading initial database into LDAP...")); - tqApp->processEvents(); + pdialog.setStatusMessage(i18n("Stopping servers...")); + // Stop Heimdal + if (controlHeimdalServer(SC_STOP) != 0) { + if (errstr) *errstr = i18n("Unable to stop Kerberos server"); + pdialog.closeDialog(); + return -1; + } // Stop slapd if (controlLDAPServer(SC_STOP) != 0) { if (errstr) *errstr = i18n("Unable to stop LDAP server"); @@ -408,6 +429,13 @@ configTempDir.setAutoDelete(false); // RAJA DEBUG ONLY return -1; } + pdialog.setStatusMessage(i18n("Purging existing LDAP database...")); + tqApp->processEvents(); + controlLDAPServer(SC_PURGE); + + pdialog.setStatusMessage(i18n("Loading initial database into LDAP...")); + tqApp->processEvents(); + // Load database KProcess slapadd; slapadd << "slapadd" << "-l" << configTempDir.name() + "skel.ldif"; @@ -432,6 +460,12 @@ configTempDir.setAutoDelete(false); // RAJA DEBUG ONLY pdialog.closeDialog(); return -1; } + // Start Heimdal + if (controlHeimdalServer(SC_START) != 0) { + if (errstr) *errstr = i18n("Unable to start Kerberos server"); + pdialog.closeDialog(); + return -1; + } // RAJA FIXME pdialog.closeDialog(); |