Fix failure when long Kerberos commands are used

This failure was due to an obscure ASCII sequence used in the output of kadmin
pull/1/head
Timothy Pearson 12 years ago
parent 8899bee01d
commit 5b8ec508a0

@ -1 +1 @@
Subproject commit 65ecce459d54e772303052de50d08557ba9cc7ed
Subproject commit 307fab5fdad542247fa11a418be0e9635f4b5ebf

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

Loading…
Cancel
Save