summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-06-26 10:21:55 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-06-26 10:21:55 -0500
commit5b8ec508a097798e42408f3bd03ce96985cfc90e (patch)
tree747f363e151f55e48a7c60088026432d58330327 /src
parent8899bee01d4ebd2f1a087218133ec9520afbd5f1 (diff)
downloadlibtdeldap-5b8ec508a097798e42408f3bd03ce96985cfc90e.tar.gz
libtdeldap-5b8ec508a097798e42408f3bd03ce96985cfc90e.zip
Fix failure when long Kerberos commands are used
This failure was due to an obscure ASCII sequence used in the output of kadmin
Diffstat (limited to 'src')
-rw-r--r--src/libtdeldap.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/libtdeldap.cpp b/src/libtdeldap.cpp
index 37ddea7..8209501 100644
--- a/src/libtdeldap.cpp
+++ b/src/libtdeldap.cpp
@@ -1017,6 +1017,7 @@ TQString LDAPManager::readFullLineFromPtyProcess(PtyProcess* proc) {
}
result.replace("\n", "");
result.replace("\r", "");
+ result.replace("\x20\x08", ""); // Backspace + Space. This one caused all kinds of fun with long distinguished names and/or passwords!
return result;
}
@@ -1061,7 +1062,7 @@ int LDAPManager::setPasswordForUser(LDAPUserInfo user, TQString *errstr) {
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
if ((prompt.endsWith(" Password:")) && (prompt.startsWith(TQString(user.name + "@")))) {
kadminProc.enableLocalEcho(false);
@@ -1754,7 +1755,7 @@ int LDAPManager::addMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
// Use all defaults
while (prompt != "kadmin>") {
@@ -1805,7 +1806,7 @@ int LDAPManager::addMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
}
}
@@ -1874,7 +1875,7 @@ int LDAPManager::addServiceInfo(LDAPServiceInfo service, TQString *errstr) {
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
// Use all defaults
while (prompt != "kadmin>") {
@@ -1925,7 +1926,7 @@ int LDAPManager::addServiceInfo(LDAPServiceInfo service, TQString *errstr) {
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
}
}
@@ -2584,7 +2585,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
// Use all defaults
while (prompt != "kadmin>") {
@@ -2635,7 +2636,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
}
}
@@ -3535,7 +3536,7 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
if (prompt.endsWith(" Password:")) {
kadminProc.writeLine(adminPassword, true);
@@ -3560,7 +3561,7 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
// Use all defaults
while (prompt != "kadmin>") {
@@ -3591,7 +3592,7 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
}
}
@@ -3600,7 +3601,7 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
if (prompt != "kadmin>") {
if (errstr) *errstr = prompt;
@@ -3653,7 +3654,7 @@ int LDAPManager::unbondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, c
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n", prompt.ascii());
- } while (prompt == TQString(command));
+ } while ((prompt == TQString(command)) || (prompt == ""));
prompt = prompt.stripWhiteSpace();
if (prompt.endsWith(" Password:")) {
kadminProc.writeLine(adminPassword, true);