From 8b63e0aaf044b36627e9ce02a1d73618e50700e4 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 10 Apr 2014 18:58:08 -0400
Subject: [PATCH] Listen for ssh clients on all interfaces, by default
---
src/main/java/com/gitblit/transport/ssh/SshDaemon.java | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/gitblit/transport/ssh/SshDaemon.java b/src/main/java/com/gitblit/transport/ssh/SshDaemon.java
index dd4a2d8..cc938bc 100644
--- a/src/main/java/com/gitblit/transport/ssh/SshDaemon.java
+++ b/src/main/java/com/gitblit/transport/ssh/SshDaemon.java
@@ -35,6 +35,8 @@
import com.gitblit.manager.IGitblit;
import com.gitblit.transport.ssh.commands.CreateRepository;
import com.gitblit.transport.ssh.commands.DispatchCommand;
+import com.gitblit.transport.ssh.commands.Receive;
+import com.gitblit.transport.ssh.commands.Upload;
import com.gitblit.transport.ssh.commands.VersionCommand;
import com.gitblit.utils.IdGenerator;
import com.gitblit.utils.StringUtils;
@@ -42,7 +44,7 @@
/**
* Manager for the ssh transport. Roughly analogous to the
- * {@link com.gitblit.git.GitDaemon} class.
+ * {@link com.gitblit.transport.git.GitDaemon} class.
*
* @author Eric Myhre
*
@@ -65,9 +67,6 @@
@SuppressWarnings("unused")
private final IGitblit gitblit;
-
- private final IdGenerator idGenerator;
-
private final SshServer sshd;
/**
@@ -77,7 +76,6 @@
*/
public SshDaemon(IGitblit gitblit, IdGenerator idGenerator) {
this.gitblit = gitblit;
- this.idGenerator = idGenerator;
IStoredSettings settings = gitblit.getSettings();
int port = settings.getInteger(Keys.git.sshPort, 0);
@@ -106,15 +104,21 @@
gitblitCmd.registerCommand(CreateRepository.class);
gitblitCmd.registerCommand(VersionCommand.class);
- DispatchCommand dispatcher = new DispatchCommand();
- dispatcher.registerDispatcher("gitblit", gitblitCmd);
+ DispatchCommand gitCmd = new DispatchCommand();
+ gitCmd.registerCommand(Upload.class);
+ gitCmd.registerCommand(Receive.class);
+
+ DispatchCommand root = new DispatchCommand();
+ root.registerDispatcher("gitblit", gitblitCmd);
+ root.registerDispatcher("git", gitCmd);
+
+ root.setRepositoryResolver(new RepositoryResolver<SshSession>(gitblit));
+ root.setUploadPackFactory(new GitblitUploadPackFactory<SshSession>(gitblit));
+ root.setReceivePackFactory(new GitblitReceivePackFactory<SshSession>(gitblit));
SshCommandFactory commandFactory = new SshCommandFactory(
- new RepositoryResolver<SshSession>(gitblit),
- new GitblitUploadPackFactory<SshSession>(gitblit),
- new GitblitReceivePackFactory<SshSession>(gitblit),
new WorkQueue(idGenerator),
- dispatcher);
+ root);
sshd.setCommandFactory(commandFactory);
--
Gitblit v1.9.1