|
|
@ -409,17 +409,22 @@ int LDAPConfig::bondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, cons
|
|
|
|
TQString prompt;
|
|
|
|
TQString prompt;
|
|
|
|
PtyProcess kadminProc;
|
|
|
|
PtyProcess kadminProc;
|
|
|
|
kadminProc.exec(command, args);
|
|
|
|
kadminProc.exec(command, args);
|
|
|
|
prompt = kadminProc.readLine(true);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
if (prompt == "kadmin>") {
|
|
|
|
if (prompt == "kadmin>") {
|
|
|
|
kadminProc.writeLine(TQCString("ext "+hoststring), true);
|
|
|
|
command = TQCString("ext "+hoststring);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
kadminProc.writeLine(command, true);
|
|
|
|
|
|
|
|
do { // Discard our own input
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == TQString(command));
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
if (prompt.endsWith(" Password:")) {
|
|
|
|
if (prompt.endsWith(" Password:")) {
|
|
|
|
kadminProc.writeLine(adminPassword, true);
|
|
|
|
kadminProc.writeLine(adminPassword, true);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
do { // Discard our own input
|
|
|
|
prompt = kadminProc.readLine(true);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == "");
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (prompt.contains("authentication failed")) {
|
|
|
|
if (prompt.contains("authentication failed")) {
|
|
|
@ -428,16 +433,21 @@ int LDAPConfig::bondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, cons
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (prompt.endsWith("Principal does not exist")) {
|
|
|
|
else if (prompt.endsWith("Principal does not exist")) {
|
|
|
|
kadminProc.writeLine(TQCString("ank --random-key "+hoststring), true);
|
|
|
|
command = TQCString("ank --random-key "+hoststring);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
kadminProc.writeLine(command, true);
|
|
|
|
|
|
|
|
do { // Discard our own input
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == TQString(command));
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
// Use all defaults
|
|
|
|
// Use all defaults
|
|
|
|
while (prompt != "kadmin>") {
|
|
|
|
while (prompt != "kadmin>") {
|
|
|
|
if (prompt.endsWith(" Password:")) {
|
|
|
|
if (prompt.endsWith(" Password:")) {
|
|
|
|
kadminProc.writeLine(adminPassword, true);
|
|
|
|
kadminProc.writeLine(adminPassword, true);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
do { // Discard our own input
|
|
|
|
prompt = kadminProc.readLine(true);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == "");
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (prompt.contains("authentication failed")) {
|
|
|
|
if (prompt.contains("authentication failed")) {
|
|
|
@ -454,15 +464,21 @@ int LDAPConfig::bondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, cons
|
|
|
|
leftbracket++;
|
|
|
|
leftbracket++;
|
|
|
|
defaultParam = prompt.mid(leftbracket, rightbracket-leftbracket);
|
|
|
|
defaultParam = prompt.mid(leftbracket, rightbracket-leftbracket);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kadminProc.writeLine(TQCString(defaultParam), true);
|
|
|
|
command = TQCString(defaultParam);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
kadminProc.writeLine(command, true);
|
|
|
|
prompt = kadminProc.readLine(true);
|
|
|
|
do { // Discard our own input
|
|
|
|
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == TQString(command));
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kadminProc.writeLine(TQCString("ext "+hoststring), true);
|
|
|
|
command = TQCString("ext "+hoststring);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
kadminProc.writeLine(command, true);
|
|
|
|
|
|
|
|
do { // Discard our own input
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == TQString(command));
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
if (prompt != "kadmin>") {
|
|
|
|
if (prompt != "kadmin>") {
|
|
|
|
if (errstr) *errstr = prompt;
|
|
|
|
if (errstr) *errstr = prompt;
|
|
|
@ -500,17 +516,22 @@ int LDAPConfig::unbondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, co
|
|
|
|
TQString prompt;
|
|
|
|
TQString prompt;
|
|
|
|
PtyProcess kadminProc;
|
|
|
|
PtyProcess kadminProc;
|
|
|
|
kadminProc.exec(command, args);
|
|
|
|
kadminProc.exec(command, args);
|
|
|
|
prompt = kadminProc.readLine(true);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
if (prompt == "kadmin>") {
|
|
|
|
if (prompt == "kadmin>") {
|
|
|
|
kadminProc.writeLine(TQCString("delete "+hoststring), true);
|
|
|
|
command = TQCString("delete "+hoststring);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
kadminProc.writeLine(command, true);
|
|
|
|
|
|
|
|
do { // Discard our own input
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == TQString(command));
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
if (prompt.endsWith(" Password:")) {
|
|
|
|
if (prompt.endsWith(" Password:")) {
|
|
|
|
kadminProc.writeLine(adminPassword, true);
|
|
|
|
kadminProc.writeLine(adminPassword, true);
|
|
|
|
prompt = kadminProc.readLine(true); // Discard our own input
|
|
|
|
do { // Discard our own input
|
|
|
|
prompt = kadminProc.readLine(true);
|
|
|
|
prompt = readFullLineFromPtyProcess(&kadminProc);
|
|
|
|
|
|
|
|
printf("(kadmin) '%s'\n\r", prompt.ascii());
|
|
|
|
|
|
|
|
} while (prompt == "");
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
prompt = prompt.stripWhiteSpace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (prompt != "kadmin>") {
|
|
|
|
if (prompt != "kadmin>") {
|
|
|
|