Do not use GUI dialog to prompt for password when operating in CLI mode

pull/1/head
Timothy Pearson 12 years ago
parent bdb1c6b002
commit ebe5fa27bf

@ -978,10 +978,18 @@ int LDAPManager::setPasswordForUser(LDAPUserInfo user, TQString *errstr) {
}
if (prompt.endsWith(" Password:")) {
if (admincreds.password == "") {
TQCString password;
int result = KPasswordDialog::getPassword(password, prompt);
if (result == KPasswordDialog::Accepted) {
admincreds.password = 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 != "") {
@ -1633,10 +1641,18 @@ int LDAPManager::addServiceInfo(LDAPServiceInfo service, TQString *errstr) {
while (prompt != "kadmin>") {
if (prompt.endsWith(" Password:")) {
if (admincreds.password == "") {
TQCString password;
int result = KPasswordDialog::getPassword(password, prompt);
if (result == KPasswordDialog::Accepted) {
admincreds.password = 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 != "") {

Loading…
Cancel
Save