TW-52308 configure ssh client version for all auth methods
authorDmitry Neverov <dmitry.neverov@gmail.com>
Mon, 4 Dec 2017 11:26:30 +0000 (12:26 +0100)
committerDmitry Neverov <dmitry.neverov@gmail.com>
Mon, 4 Dec 2017 11:26:30 +0000 (12:26 +0100)
git-server/src/jetbrains/buildServer/buildTriggers/vcs/git/TransportFactoryImpl.java

index eebd7d91c58777d8d4f91f59af2252e63cd765de..97d2d9d7ce567278784fb888b7a26dc0f94acd91 100644 (file)
@@ -180,6 +180,7 @@ public class TransportFactoryImpl implements TransportFactory {
 
     @Override
     protected void configure(OpenSshConfig.Host hc, Session session) {
+      configureClientVersion(session);
       session.setProxy(myConfig.getJschProxy());//null proxy is allowed
       if (myAuthSettings.isIgnoreKnownHosts())
         session.setConfig("StrictHostKeyChecking", "no");
@@ -292,10 +293,6 @@ public class TransportFactoryImpl implements TransportFactory {
     protected void configure(OpenSshConfig.Host hc, Session session) {
       super.configure(hc, session);
       session.setConfig("StrictHostKeyChecking", "no");
-      String teamCityVersion = getTeamCityVersion();
-      if (teamCityVersion != null) {
-        session.setClientVersion(GitUtils.getSshClientVersion(session.getClientVersion(), teamCityVersion));
-      }
     }
   }
 
@@ -385,6 +382,13 @@ public class TransportFactoryImpl implements TransportFactory {
     return builder.toString();
   }
 
+  private static void configureClientVersion(@NotNull Session session) {
+    String teamCityVersion = getTeamCityVersion();
+    if (teamCityVersion != null) {
+      session.setClientVersion(GitUtils.getSshClientVersion(session.getClientVersion(), teamCityVersion));
+    }
+  }
+
   @Nullable
   private static String getTeamCityVersion() {
     try {