summaryrefslogtreecommitdiffstats
path: root/src/libtdeldap.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2015-09-28 17:20:57 -0500
committerTimothy Pearson <[email protected]>2015-09-28 17:20:57 -0500
commit5ae128fb8b79192a6eab0be50b9c040b08a28fba (patch)
treea2b77df4d273ad733a6a35423030fc621fb9022f /src/libtdeldap.cpp
parent0fbc17ac57b74d637494d3546ccf5bfef100a67d (diff)
downloadlibtdeldap-5ae128fb8b79192a6eab0be50b9c040b08a28fba.tar.gz
libtdeldap-5ae128fb8b79192a6eab0be50b9c040b08a28fba.zip
Remove dead code from prior commit
Diffstat (limited to 'src/libtdeldap.cpp')
-rw-r--r--src/libtdeldap.cpp121
1 files changed, 0 insertions, 121 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index a227582..e341ce2 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -1986,127 +1986,6 @@ int LDAPManager::addMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
}
return retcode;
-
-#if 0
- // Use Kerberos kadmin to actually add the machine
- LDAPCredentials admincreds = currentLDAPCredentials();
- if ((admincreds.username == "") && (admincreds.password == "")) {
- // Probably GSSAPI
- // Get active ticket principal...
- KerberosTicketInfoList tickets = LDAPManager::getKerberosTicketList();
- TQStringList principalParts = TQStringList::split("@", tickets[0].cachePrincipal, false);
- admincreds.username = principalParts[0];
- admincreds.realm = principalParts[1];
- admincreds.use_gssapi = true;
- }
-
- TQCString command = "kadmin";
- QCStringList args;
- if (m_host.startsWith("ldapi://")) {
- args << TQCString("-l") << TQCString("-r") << TQCString(admincreds.realm.upper());
- }
- else {
- if (admincreds.username == "") {
- args << TQCString("-r") << TQCString(admincreds.realm.upper());
- }
- else {
- args << TQCString("-p") << TQCString(admincreds.username.lower()+"@"+(admincreds.realm.upper())) << TQCString("-r") << TQCString(admincreds.realm.upper());
- }
- }
-
- TQString hoststring = "host/"+machine.name+"."+admincreds.realm.lower();
-
- TQString prompt;
- PtyProcess kadminProc;
- kadminProc.exec(command, args);
- prompt = readFullLineFromPtyProcess(&kadminProc);
- prompt = prompt.stripWhiteSpace();
- if (prompt == "kadmin>") {
- if (machine.newPassword == "") {
- command = TQCString("ank --random-key "+hoststring);
- }
- else {
- command = TQCString("ank --password=\""+machine.newPassword+"\" "+hoststring);
- }
- kadminProc.enableLocalEcho(false);
- kadminProc.writeLine(command, true);
- do { // Discard our own input
- prompt = readFullLineFromPtyProcess(&kadminProc);
- printf("(kadmin) '%s'\n", prompt.ascii());
- } while ((prompt == TQString(command)) || (prompt == ""));
- prompt = prompt.stripWhiteSpace();
- // Use all defaults
- while (prompt != "kadmin>") {
- if (prompt.endsWith(" Password:")) {
- if (admincreds.password == "") {
- if (tqApp->type() != TQApplication::Tty) {
- TQCString password;
- int result = KPasswordDialog::getPassword(password, prompt);
- if (result == KPasswordDialog::Accepted) {
- admincreds.password = password;
- }
- }
- else {
- TQFile file;
- file.open(IO_ReadOnly, stdin);
- TQTextStream qtin(&file);
- admincreds.password = qtin.readLine();
- }
- }
- if (admincreds.password != "") {
- kadminProc.enableLocalEcho(false);
- kadminProc.writeLine(admincreds.password, true);
- do { // Discard our own input
- prompt = readFullLineFromPtyProcess(&kadminProc);
- printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == "");
- prompt = prompt.stripWhiteSpace();
- }
- }
- if (prompt.contains("authentication failed")) {
- if (errstr) *errstr = detailedKAdminErrorMessage(prompt);
- kadminProc.enableLocalEcho(false);
- kadminProc.writeLine("quit", true);
- return 1;
- }
- else {
- // Extract whatever default is in the [brackets] and feed it back to kadmin
- TQString defaultParam;
- int leftbracket = prompt.find("[");
- int rightbracket = prompt.find("]");
- if ((leftbracket >= 0) && (rightbracket >= 0)) {
- leftbracket++;
- defaultParam = prompt.mid(leftbracket, rightbracket-leftbracket);
- }
- command = TQCString(defaultParam);
- kadminProc.enableLocalEcho(false);
- kadminProc.writeLine(command, true);
- do { // Discard our own input
- prompt = readFullLineFromPtyProcess(&kadminProc);
- printf("(kadmin) '%s'\n", prompt.ascii());
- } while ((prompt == TQString(command)) || (prompt == ""));
- prompt = prompt.stripWhiteSpace();
- }
- }
- if (prompt != "kadmin>") {
- if (errstr) *errstr = detailedKAdminErrorMessage(prompt);
- kadminProc.enableLocalEcho(false);
- kadminProc.writeLine("quit", true);
- return 1;
- }
-
- // Success!
- kadminProc.enableLocalEcho(false);
- kadminProc.writeLine("quit", true);
- unbind(true); // Using kadmin can disrupt our LDAP connection
-
- return 0;
- }
-
- if (errstr) *errstr = "Internal error. Verify that kadmin exists and can be executed.";
- return 1; // Failure
-#endif
-
}
}