optimize logging

This commit is contained in:
Peter Hormanns 2017-11-23 17:05:45 +01:00
parent 5591323259
commit 02e4e1adbc

View File

@ -27,8 +27,11 @@ public class CommandShell {
if (stdInput != null && !"newusers".equals(logCommand)) {
if (logCommand != null && (logCommand.startsWith("newusers") || logCommand.startsWith("chpasswd"))) {
// escape new password !
final String[] strings = stdInput.split(":", 3);
logCommand += "<<EOF\n" + strings[0] + ":***:" + strings[2] + "EOF";
final String[] strings = stdInput.split("\\:", 3);
logCommand += "<<EOF\n" + strings[0] + ":***:";
if (strings.length > 2) {
logCommand += strings[2] + "EOF";
}
} else {
logCommand += "<<EOF\n" + stdInput + "EOF";
}