Quote usernames in the sshd_log if necessary
If the incoming username contains a space it would throw off any program reading the log file. Instead quote the value so that a parser could detect the quoted entry and recover. Change-Id: If74e8c1f6820df9ba9369b039e6285fefff62549 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -308,7 +308,12 @@ class SshLog implements LifecycleListener {
|
||||
Object val = event.getMDC(key);
|
||||
buf.append(' ');
|
||||
if (val != null) {
|
||||
buf.append(val);
|
||||
String s = val.toString();
|
||||
if (0 <= s.indexOf(' ')) {
|
||||
buf.append(QuotedString.BOURNE.quote(s));
|
||||
} else {
|
||||
buf.append(val);
|
||||
}
|
||||
} else {
|
||||
buf.append('-');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user