From 1f03f54a8247da940967abdc6cd06b0a233f5d82 Mon Sep 17 00:00:00 2001 From: Ben Beetle Date: Mon, 20 Oct 2014 17:23:05 -0400 Subject: [PATCH] Include all command arguments in SSH log entry Previously the SSH log only included the first argument. This prevented the repository name from being logged when 'git receive-pack' was executed instead of 'git-receive-pack'. Now the SSH log includes all command arguments in the log ensuring that the repository name is always logged. This is desirable behavior for anyone looking to monitor repository access via the SSH log. Change-Id: Idff950e5480a122a2cb366a443d25aa9e0a8f5c8 (cherry picked from commit a56057f97620ae7b958c338149853d605d8d3604) --- gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java index 7df8db4c4a..fc80f5a9bb 100644 --- a/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java +++ b/gerrit-sshd/src/main/java/com/google/gerrit/sshd/SshLog.java @@ -269,9 +269,8 @@ class SshLog implements LifecycleListener { private String extractWhat(DispatchCommand dcmd) { String commandName = dcmd.getCommandName(); - String[] args = dcmd.getArguments(); - if (args.length > 1) { - return commandName + "." + args[1]; + for (String arg : dcmd.getArguments()) { + commandName = commandName + "." + arg; } return commandName; }