summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-07 12:32:47 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-07 12:32:47 -0600
commit6ce8eaff9947b48c19ddcf14cbbabb7ac990b0cb (patch)
treed9bd454ad18e531f2db38270beea80842553aca9
parentbfc8d9945dc4b1af439d52216b8c4ee9d9682c42 (diff)
downloadkcmldap-6ce8eaff.tar.gz
kcmldap-6ce8eaff.zip
Fix kadmin output parsing
-rw-r--r--src/ldapbonding.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/ldapbonding.cpp b/src/ldapbonding.cpp
index 45ad4ba..51eb7ec 100644
--- a/src/ldapbonding.cpp
+++ b/src/ldapbonding.cpp
@@ -390,17 +390,33 @@ void LDAPConfig::deactivateRealm() {
updateRealmList();
}
+// WARNING
+// kadmin does not have a standard "waiting for user input" character or sequence
+// To make matters worse, the colon does not uniquely designate the end of a line; for example the response "kadmin: ext openldap/foo.bar.baz: Principal does not exist"
+// One way around this would be to see if the first colon is part of a "kadmin:" string; if so, then the colon is not a reliable end of line indicator for the current line
+// (in fact only '\r' should be used as the end of line indicator in that case)
TQString readFullLineFromPtyProcess(PtyProcess* proc) {
TQString result = "";
- while ((!result.contains("\r")) && (!result.contains(":")) && (!result.contains(">"))) {
+ while ((!result.contains("\r")) &&
+ (!result.contains(">")) &&
+ (!((!result.contains("kadmin:")) && result.contains(":"))) &&
+ (!((result.contains("kadmin:")) && result.contains("\r")))
+ ) {
result = result + TQString(proc->readLine(false));
tqApp->processEvents();
+ if (!TQFile::exists(TQString("/proc/%1/exe").arg(proc->pid()))) {
+ result.replace("\n", "");
+ result.replace("\r", "");
+ if (result == "") {
+ result = "TDE process terminated";
+ }
+ break;
+ }
}
result.replace("\n", "");
result.replace("\r", "");
return result;
}
-
int LDAPConfig::bondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, const char * adminPassword, TQString adminRealm, TQString *errstr) {
TQCString command = "kadmin";
QCStringList args;