From: James Moger Date: Mon, 15 Jun 2015 16:56:23 +0000 (-0400) Subject: Renamed ssh.Display(Host|Port) to ssh.Advertised(Host|Port) X-Git-Tag: v1.7.0~1^2~54^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Ftickets%2F59%2F259%2F2;p=gitblit.git Renamed ssh.Display(Host|Port) to ssh.Advertised(Host|Port) --- diff --git a/src/main/distrib/data/defaults.properties b/src/main/distrib/data/defaults.properties index 272eec08..60c914ba 100644 --- a/src/main/distrib/data/defaults.properties +++ b/src/main/distrib/data/defaults.properties @@ -116,13 +116,13 @@ git.sshBindInterface = # This may be useful in complex forwarding setups. # # SINCE 1.7.0 -git.sshDisplayHost = +git.sshAdvertisedHost = # Manually specify the port to use in advertised SSH repository urls. # This may be useful in complex forwarding setups. # # SINCE 1.7.0 -git.sshDisplayPort = +git.sshAdvertisedPort = # Specify the SSH key manager to use for retrieving, storing, and removing # SSH keys. diff --git a/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java b/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java index d2ddc2c8..e989ece3 100644 --- a/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java +++ b/src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java @@ -19,8 +19,6 @@ import java.io.IOException; import java.net.URL; import java.text.MessageFormat; -import com.google.inject.Inject; -import com.google.inject.Singleton; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -34,6 +32,8 @@ import com.gitblit.manager.IUserManager; import com.gitblit.models.RepositoryModel; import com.gitblit.models.UserModel; import com.gitblit.utils.StringUtils; +import com.google.inject.Inject; +import com.google.inject.Singleton; /** * Handles requests for Sparkleshare Invites @@ -89,7 +89,7 @@ public class SparkleShareInviteServlet extends HttpServlet { response.getWriter().append("SSH is not active on this server!"); return; } - int sshDisplayPort = settings.getInteger(Keys.git.sshDisplayPort, sshPort); + int sshDisplayPort = settings.getInteger(Keys.git.sshAdvertisedPort, sshPort); // extract repo name from request String repoUrl = request.getPathInfo().substring(1); @@ -114,7 +114,7 @@ public class SparkleShareInviteServlet extends HttpServlet { if (!StringUtils.isEmpty(url) && url.indexOf("localhost") == -1) { host = new URL(url).getHost(); } - String sshDisplayHost = settings.getString(Keys.git.sshDisplayHost, ""); + String sshDisplayHost = settings.getString(Keys.git.sshAdvertisedHost, ""); if(sshDisplayHost.isEmpty()) { sshDisplayHost = host; } diff --git a/src/main/java/com/gitblit/transport/ssh/SshDaemon.java b/src/main/java/com/gitblit/transport/ssh/SshDaemon.java index 4756d967..68a2e901 100644 --- a/src/main/java/com/gitblit/transport/ssh/SshDaemon.java +++ b/src/main/java/com/gitblit/transport/ssh/SshDaemon.java @@ -35,8 +35,8 @@ import org.apache.sshd.common.io.mina.MinaServiceFactoryFactory; import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory; import org.apache.sshd.common.keyprovider.FileKeyPairProvider; import org.apache.sshd.common.util.SecurityUtils; -import org.apache.sshd.server.auth.CachingPublicKeyAuthenticator; import org.apache.sshd.server.UserAuth; +import org.apache.sshd.server.auth.CachingPublicKeyAuthenticator; import org.apache.sshd.server.auth.UserAuthKeyboardInteractive; import org.apache.sshd.server.auth.UserAuthPassword; import org.apache.sshd.server.auth.UserAuthPublicKey; @@ -130,7 +130,7 @@ public class SshDaemon { } else { addr = new InetSocketAddress(bindInterface, port); } - + //Will do GSS ? GSSAuthenticator gssAuthenticator = null; if(settings.getBoolean(Keys.git.sshWithKrb5, false)) { @@ -144,9 +144,9 @@ public class SshDaemon { ""); if(! servicePrincipalName.isEmpty()) { gssAuthenticator.setServicePrincipalName(servicePrincipalName); - } + } } - + //Sort the authenticators for sshd List> userAuthFactories = new ArrayList<>(); String sshAuthenticatorsOrderString = settings.getString(Keys.git.sshAuthenticatorsOrder, @@ -156,7 +156,7 @@ public class SshDaemon { switch (authenticatorName) { case "gssapi-with-mic": if(gssAuthenticator != null) { - userAuthFactories.add(new UserAuthGSS.Factory()); + userAuthFactories.add(new UserAuthGSS.Factory()); } break; case "publickey": @@ -172,7 +172,7 @@ public class SshDaemon { log.error("Unknown ssh authenticator: '{}'", authenticatorName); } } - + // Create the SSH server sshd = SshServer.setUpDefaultServer(); sshd.setPort(addr.getPort()); @@ -203,8 +203,8 @@ public class SshDaemon { IStoredSettings settings = gitblit.getSettings(); int port = sshd.getPort(); - int displayPort = settings.getInteger(Keys.git.sshDisplayPort, port); - String displayServername = settings.getString(Keys.git.sshDisplayHost, ""); + int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port); + String displayServername = settings.getString(Keys.git.sshAdvertisedHost, ""); if(displayServername.isEmpty()) { displayServername = servername; } diff --git a/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java b/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java index 267082ac..ec6f7291 100644 --- a/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java +++ b/src/main/java/com/gitblit/transport/ssh/WelcomeShell.java @@ -200,8 +200,8 @@ public class WelcomeShell implements Factory { } private String formatUrl(String hostname, int port, String username) { - int displayPort = settings.getInteger(Keys.git.sshDisplayPort, port); - String displayHostname = settings.getString(Keys.git.sshDisplayHost, ""); + int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port); + String displayHostname = settings.getString(Keys.git.sshAdvertisedHost, ""); if(displayHostname.isEmpty()) { displayHostname = hostname; } diff --git a/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java b/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java index 06b0e8d8..02764db6 100644 --- a/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java +++ b/src/main/java/com/gitblit/transport/ssh/commands/SshCommand.java @@ -16,7 +16,6 @@ */ package com.gitblit.transport.ssh.commands; -import com.gitblit.IStoredSettings; import java.io.IOException; import java.io.PrintWriter; import java.net.MalformedURLException; @@ -28,6 +27,7 @@ import org.eclipse.jgit.util.SystemReader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.gitblit.IStoredSettings; import com.gitblit.Keys; import com.gitblit.manager.IGitblit; import com.gitblit.utils.StringUtils; @@ -75,12 +75,12 @@ public abstract class SshCommand extends BaseCommand { protected String getRepositoryUrl(String repository) { String username = getContext().getClient().getUsername(); IStoredSettings settings = getContext().getGitblit().getSettings(); - String displayHostname = settings.getString(Keys.git.sshDisplayHost, ""); + String displayHostname = settings.getString(Keys.git.sshAdvertisedHost, ""); if(displayHostname.isEmpty()) { displayHostname = getHostname(); } int port = settings.getInteger(Keys.git.sshPort, 0); - int displayPort = settings.getInteger(Keys.git.sshDisplayPort, port); + int displayPort = settings.getInteger(Keys.git.sshAdvertisedPort, port); if (displayPort == 22) { // standard port return MessageFormat.format("{0}@{1}/{2}.git", username, displayHostname, repository);