optimize logging
This commit is contained in:
parent
f4139407a8
commit
bf7f4e8249
@ -24,9 +24,15 @@ public class CommandShell {
|
|||||||
int exitCode = 0;
|
int exitCode = 0;
|
||||||
try {
|
try {
|
||||||
String logCommand = command;
|
String logCommand = command;
|
||||||
if (stdInput != null) {
|
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";
|
||||||
|
} else {
|
||||||
logCommand += "<<EOF\n" + stdInput + "EOF";
|
logCommand += "<<EOF\n" + stdInput + "EOF";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
logCommand += "\n";
|
logCommand += "\n";
|
||||||
logger.log(Level.INFO, logCommand);
|
logger.log(Level.INFO, logCommand);
|
||||||
String[] cmdArray = { "/bin/bash", "-c", command };
|
String[] cmdArray = { "/bin/bash", "-c", command };
|
||||||
|
Loading…
Reference in New Issue
Block a user