Unable to use < as part of a password (admin-cli) (#24939)

* escaped angle bracket characters in password

Closes #21951

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
This commit is contained in:
Peter Zaoral
2023-12-06 17:27:44 +01:00
committed by GitHub
parent f5dc034c0a
commit 340eb99412
4 changed files with 26 additions and 11 deletions

View File

@@ -84,19 +84,14 @@ public class KcAdmMain {
StringBuilder b = new StringBuilder();
for (String s : args) {
// quote if necessary
boolean needQuote = false;
needQuote = s.indexOf(' ') != -1 || s.indexOf('\"') != -1 || s.indexOf('\'') != -1;
b.append(' ');
if (needQuote) {
b.append('\'');
}
s = s.replace("'", "\\'");
b.append('\'');
b.append(s);
if (needQuote) {
b.append('\'');
}
b.append('\'');
}
console.setEcho(false);
console.execute("kcadm" + b.toString());
console.start();