org.eclipse.jsch.core_1.1.400.v20120522-1148

16:45:37.180 INFO  jd.cli.Main - Decompiling org.eclipse.jsch.core_1.1.400.v20120522-1148.jar
package org.eclipse.jsch.core;

public abstract interface IJSchLocation
{
  public static final int USE_DEFAULT_PORT = 0;
  
  public abstract String getHost();
  
  public abstract int getPort();
  
  public abstract void setUsername(String paramString);
  
  public abstract String getUsername();
  
  public abstract void setPassword(String paramString);
  
  public abstract String getPassword();
  
  public abstract void setComment(String paramString);
  
  public abstract String getComment();
  
  public abstract void setPasswordStore(IPasswordStore paramIPasswordStore);
  
  public abstract IPasswordStore getPasswordStore();
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.core.IJSchLocation
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.core;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Proxy;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.UserInfo;
import org.eclipse.core.runtime.IProgressMonitor;

public abstract interface IJSchService
{
  public abstract Session createSession(String paramString1, int paramInt, String paramString2)
    throws JSchException;
  
  public abstract Session createSession(IJSchLocation paramIJSchLocation, UserInfo paramUserInfo)
    throws JSchException;
  
  public abstract void connect(Session paramSession, int paramInt, IProgressMonitor paramIProgressMonitor)
    throws JSchException;
  
  public abstract Proxy getProxyForHost(String paramString1, String paramString2);
  
  public abstract void connect(Proxy paramProxy, String paramString, int paramInt1, int paramInt2, IProgressMonitor paramIProgressMonitor)
    throws JSchException;
  
  public abstract IJSchLocation getLocation(String paramString1, String paramString2, int paramInt);
  
  public abstract JSch getJSch();
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.core.IJSchService
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.core;

public abstract interface IPasswordStore
{
  public abstract void clear(IJSchLocation paramIJSchLocation);
  
  public abstract boolean isCached(IJSchLocation paramIJSchLocation);
  
  public abstract void update(IJSchLocation paramIJSchLocation);
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.core.IPasswordStore
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

public abstract interface IConstants
{
  public static final String KEY_PROXY = "CVSSSH2PreferencePage.PROXY";
  public static final String KEY_PROXY_TYPE = "CVSSSH2PreferencePage.PROXY_TYPE";
  public static final String KEY_PROXY_HOST = "CVSSSH2PreferencePage.PROXY_HOST";
  public static final String KEY_PROXY_PORT = "CVSSSH2PreferencePage.PROXY_PORT";
  public static final String KEY_PROXY_AUTH = "CVSSSH2PreferencePage.PROXY_AUTH";
  public static final String KEY_PROXY_USER = "CVSSSH2PreferencePage.PROXY_USER";
  public static final String KEY_PROXY_PASS = "CVSSSH2PreferencePage.PROXY_PASS";
  public static final String KEY_OLD_SSH2HOME = "CVSSSH2PreferencePage.SSH2HOME";
  public static final String KEY_OLD_PRIVATEKEY = "CVSSSH2PreferencePage.PRIVATEKEY";
  public static final String KEY_KEYFILE = "CVSSSH2PreferencePage.KEYFILE";
  public static final String KEY_SSH2HOME = "SSH2HOME";
  public static final String KEY_PRIVATEKEY = "PRIVATEKEY";
  public static final String PROXY_TYPE_SOCKS5 = "SOCKS5";
  public static final String PROXY_TYPE_HTTP = "HTTP";
  public static final String HTTP_DEFAULT_PORT = "80";
  public static final String SOCKS5_DEFAULT_PORT = "1080";
  public static final String PRIVATE_KEYS_DEFAULT = "id_dsa,id_rsa";
  public static final String DSA = "DSA";
  public static final String RSA = "RSA";
  public static final int SSH_DEFAULT_PORT = 22;
  public static final String SSH_DEFAULT_HOME = ".ssh";
  public static final String SSH_OLD_DEFAULT_WIN32_HOME = "ssh";
  public static final String SYSTEM_PROPERTY_USER_HOME = "user.home";
  public static final String PREF_USE_PROXY = "proxyEnabled";
  public static final String PREF_PROXY_TYPE = "proxyType";
  public static final String PREF_PROXY_HOST = "proxyHost";
  public static final String PREF_PROXY_PORT = "proxyPort";
  public static final String PREF_PROXY_AUTH = "proxyAuth";
  public static final String PREF_HAS_MIGRATED_SSH2_PREFS = "org.eclipse.jsch.core.hasMigratedSsh2Preferences";
  public static final String PREF_HAS_CHANGED_DEFAULT_WIN32_SSH_HOME = "org.eclipse.jsch.core.hasChangedDefaultWin32SshHome";
  public static final String PREF_PREFERRED_AUTHENTICATION_METHODS = "CVSSSH2PreferencePage.PREF_AUTH_METHODS";
  public static final String PREF_PREFERRED_AUTHENTICATION_METHODS_ORDER = "CVSSSH2PreferencePage.PREF_AUTH_METHODS_ORDER";
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.IConstants
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import org.eclipse.jsch.core.IJSchLocation;

public abstract interface IUserAuthenticator
{
  public static final int OK_ID = 0;
  public static final int CANCEL_ID = 1;
  public static final int YES_ID = 2;
  public static final int NO_ID = 3;
  public static final int NONE = 0;
  public static final int ERROR = 1;
  public static final int INFORMATION = 2;
  public static final int QUESTION = 3;
  public static final int WARNING = 4;
  
  public abstract void promptForUserInfo(IJSchLocation paramIJSchLocation, IUserInfo paramIUserInfo, String paramString);
  
  public abstract String[] promptForKeyboradInteractive(IJSchLocation paramIJSchLocation, String paramString1, String paramString2, String paramString3, String[] paramArrayOfString, boolean[] paramArrayOfBoolean);
  
  public abstract int prompt(IJSchLocation paramIJSchLocation, int paramInt1, String paramString1, String paramString2, int[] paramArrayOfInt, int paramInt2);
  
  public abstract boolean promptForHostKeyChange(IJSchLocation paramIJSchLocation);
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.IUserAuthenticator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

public abstract interface IUserInfo
{
  public abstract String getUsername();
  
  public abstract void setUsername(String paramString);
  
  public abstract boolean isUsernameMutable();
  
  public abstract void setPassword(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.IUserInfo
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import java.io.File;
import java.util.Hashtable;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.jsch.core.IJSchService;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.util.tracker.ServiceTracker;

public class JSchCorePlugin
  extends Plugin
{
  public static String ID = "org.eclipse.jsch.core";
  public static final int DEFAULT_TIMEOUT = 60;
  private int communicationsTimeout = 60;
  private boolean needToLoadKnownHosts = true;
  private boolean needToLoadKeys = true;
  private JSch jsch;
  private String current_pkeys = "";
  public static final String PT_AUTHENTICATOR = "authenticator";
  private static JSchCorePlugin plugin;
  private ServiceTracker tracker;
  private ServiceRegistration jschService;
  
  public JSchCorePlugin()
  {
    plugin = this;
  }
  
  public static JSchCorePlugin getPlugin()
  {
    return plugin;
  }
  
  public static void log(CoreException e)
  {
    log(e.getStatus().getSeverity(), e.getMessage(), e);
  }
  
  public static void log(IStatus status)
  {
    getPlugin().getLog().log(status);
  }
  
  public static void log(int severity, String message, Throwable e)
  {
    log(new Status(severity, ID, 0, message, e));
  }
  
  public int getTimeout()
  {
    return communicationsTimeout;
  }
  
  public void setTimeout(int timeout)
  {
    communicationsTimeout = Math.max(0, timeout);
  }
  
  public synchronized JSch getJSch()
  {
    if (jsch == null) {
      jsch = new JSch();
    }
    return jsch;
  }
  
  public void loadKnownHosts()
  {
    Preferences preferences = getPlugin().getPluginPreferences();
    String ssh_home = preferences.getString("SSH2HOME");
    if (ssh_home.length() == 0) {
      ssh_home = PreferenceInitializer.SSH_HOME_DEFAULT;
    }
    File file = new File(ssh_home, "known_hosts");
    try
    {
      getJSch().setKnownHosts(file.getPath());
    }
    catch (JSchException e)
    {
      log(4, NLS.bind(
        "An error occurred while loading the know hosts file {0}", file
        .getAbsolutePath()), e);
    }
    needToLoadKnownHosts = false;
  }
  
  public boolean isNeedToLoadKnownHosts()
  {
    return needToLoadKnownHosts;
  }
  
  public void setNeedToLoadKnownHosts(boolean needToLoadKnownHosts)
  {
    this.needToLoadKnownHosts = needToLoadKnownHosts;
  }
  
  public boolean isNeedToLoadKeys()
  {
    return needToLoadKeys;
  }
  
  public void setNeedToLoadKeys(boolean needToLoadKeys)
  {
    this.needToLoadKeys = needToLoadKeys;
  }
  
  public void loadPrivateKeys()
  {
    current_pkeys = Utils.loadPrivateKeys(getJSch(), current_pkeys);
    setNeedToLoadKeys(false);
  }
  
  public IProxyService getProxyService()
  {
    return (IProxyService)tracker.getService();
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    tracker = new ServiceTracker(getBundle().getBundleContext(), 
      IProxyService.class.getName(), null);
    tracker.open();
    jschService = getBundle().getBundleContext().registerService(
      IJSchService.class.getName(), JSchProvider.getInstance(), 
      new Hashtable());
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
    tracker.close();
    jschService.unregister();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.JSchCorePlugin
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jsch.core.IJSchLocation;
import org.eclipse.jsch.core.IPasswordStore;

public class JSchLocation
  extends PlatformObject
  implements IJSchLocation
{
  private static int DEFAULT_PORT = 22;
  private String user;
  private String password;
  private String host;
  private int port = DEFAULT_PORT;
  private boolean userFixed = true;
  private String comment = null;
  private IPasswordStore passwordStore = null;
  
  public JSchLocation(String user, String host, int port)
  {
    this.user = user;
    this.host = host;
    this.port = port;
  }
  
  public JSchLocation(String user, String host)
  {
    this(user, host, DEFAULT_PORT);
  }
  
  public String getHost()
  {
    return host;
  }
  
  public int getPort()
  {
    return port;
  }
  
  public void setUsername(String user)
  {
    if (userFixed) {
      throw new UnsupportedOperationException();
    }
    this.user = user;
  }
  
  public String getUsername()
  {
    return user == null ? "" : user;
  }
  
  public void setPassword(String password)
  {
    if (password != null) {
      this.password = password;
    }
  }
  
  public String getPassword()
  {
    return password;
  }
  
  public void setComment(String comment)
  {
    this.comment = comment;
  }
  
  public String getComment()
  {
    return comment;
  }
  
  public void setPasswordStore(IPasswordStore store)
  {
    passwordStore = store;
  }
  
  public IPasswordStore getPasswordStore()
  {
    return passwordStore;
  }
  
  public String toString()
  {
    return 
      user + "@" + host + (port == DEFAULT_PORT ? "" : new StringBuffer(":").append(new Integer(port).toString()).toString());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.JSchLocation
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Proxy;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.UserInfo;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jsch.core.IJSchLocation;
import org.eclipse.jsch.core.IJSchService;
import org.eclipse.osgi.util.NLS;

class JSchProvider
  implements IJSchService
{
  private static JSchProvider instance;
  
  public Session createSession(String host, int port, String username)
    throws JSchException
  {
    if (JSchCorePlugin.getPlugin().isNeedToLoadKnownHosts()) {
      JSchCorePlugin.getPlugin().loadKnownHosts();
    }
    if (JSchCorePlugin.getPlugin().isNeedToLoadKeys()) {
      JSchCorePlugin.getPlugin().loadPrivateKeys();
    }
    return Utils.createSession(JSchCorePlugin.getPlugin().getJSch(), username, host, port);
  }
  
  public Session createSession(IJSchLocation location, UserInfo uinfo)
    throws JSchException
  {
    Session session = createSession(location.getHost(), location.getPort(), location.getUsername());
    if (uinfo == null)
    {
      IUserAuthenticator authenticator = getPluggedInAuthenticator();
      if (authenticator == null) {
        authenticator = new NullUserAuthenticator();
      }
      uinfo = new UserInfoImpl(location, authenticator, JSchCorePlugin.getPlugin().getTimeout() * 1000);
    }
    if (uinfo != null) {
      session.setUserInfo(uinfo);
    }
    return session;
  }
  
  public Session createSession(IJSchLocation location)
    throws JSchException
  {
    return createSession(location, null);
  }
  
  public void connect(Session session, int timeout, IProgressMonitor monitor)
    throws JSchException
  {
    session.setSocketFactory(new ResponsiveSocketFactory(monitor, timeout));
    
    UserInfo ui = session.getUserInfo();
    if ((ui != null) && ((ui instanceof UserInfoImpl))) {
      ((UserInfoImpl)ui).aboutToConnect();
    }
    try
    {
      session.connect();
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
      throw new JSchException("invalid server's version string");
    }
    catch (JSchException e)
    {
      if ((isAuthenticationFailure(e)) && 
        (ui != null) && ((ui instanceof UserInfoImpl)) && 
        (hasPromptExceededTimeout(session)) && 
        (((UserInfoImpl)ui).incReuse() == 0))
      {
        String host = session.getHost();
        String user = session.getUserName();
        int port = session.getPort();
        session = Utils.createSession(getJSch(), user, host, port);
        session.setUserInfo(ui);
        session.setTimeout(timeout);
        connect(session, timeout, monitor);
        return;
      }
      if (session.isConnected()) {
        session.disconnect();
      }
      throw e;
    }
    if ((ui != null) && ((ui instanceof UserInfoImpl))) {
      ((UserInfoImpl)ui).connectionMade();
    }
  }
  
  public Proxy getProxyForHost(String host, String proxyType)
  {
    return Utils.getProxyForHost(host, proxyType);
  }
  
  public static IJSchService getInstance()
  {
    if (instance == null) {
      instance = new JSchProvider();
    }
    return instance;
  }
  
  public void connect(Proxy proxy, String host, int port, int timeout, IProgressMonitor monitor)
    throws JSchException
  {
    try
    {
      proxy.connect(new ResponsiveSocketFactory(monitor, timeout), host, port, timeout);
    }
    catch (JSchException e)
    {
      throw e;
    }
    catch (Exception e)
    {
      new JSchException(e.getMessage());
    }
  }
  
  private IUserAuthenticator getPluggedInAuthenticator()
  {
    IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(
      JSchCorePlugin.ID, "authenticator").getExtensions();
    if (extensions.length == 0) {
      return null;
    }
    IExtension extension = extensions[0];
    IConfigurationElement[] configs = extension.getConfigurationElements();
    if (configs.length == 0)
    {
      JSchCorePlugin.log(
        4, 
        
        NLS.bind(
        "User autheticator {0} is missing required fields", new Object[] { extension.getUniqueIdentifier() }), null);
      return null;
    }
    try
    {
      IConfigurationElement config = configs[0];
      return (IUserAuthenticator)config.createExecutableExtension("run");
    }
    catch (CoreException ex)
    {
      JSchCorePlugin.log(
        4, 
        
        NLS.bind(
        "Unable to instantiate user authenticator {0}", new Object[] { extension.getUniqueIdentifier() }), ex);
    }
    return null;
  }
  
  public JSch getJSch()
  {
    return JSchCorePlugin.getPlugin().getJSch();
  }
  
  private boolean isAuthenticationFailure(JSchException ee)
  {
    return ee.getMessage().equals("Auth fail");
  }
  
  private boolean hasPromptExceededTimeout(Session session)
  {
    if ((session.getUserInfo() == null) || (!(session.getUserInfo() instanceof UserInfoImpl))) {
      return false;
    }
    return ((UserInfoImpl)session.getUserInfo()).hasPromptExceededTimeout();
  }
  
  public IJSchLocation getLocation(String user, String host, int port)
  {
    IJSchLocation location = null;
    location = new JSchLocation(user, host, port);
    return location;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.JSchProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.jsch.internal.core.messages";
  public static String JSchSession_5;
  public static String Util_timeout;
  public static String JSchAuthenticationException_detail;
  public static String JSchRepositoryLocation_locationForm;
  public static String JSchRepositoryLocation_invalidFormat;
  public static String KnownRepositories_0;
  public static String JSchRepositoryLocation_73;
  public static String JSchRepositoryLocation_74;
  public static String JSchRepositoryLocation_75;
  
  static
  {
    NLS.initializeMessages("org.eclipse.jsch.internal.core.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.Messages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import org.eclipse.jsch.core.IJSchLocation;

class NullUserAuthenticator
  implements IUserAuthenticator
{
  public int prompt(IJSchLocation location, int promptType, String title, String message, int[] promptResponses, int defaultResponseIndex)
  {
    return 1;
  }
  
  public boolean promptForHostKeyChange(IJSchLocation location)
  {
    return false;
  }
  
  public String[] promptForKeyboradInteractive(IJSchLocation location, String destination, String name, String instruction, String[] prompt, boolean[] echo)
  {
    return null;
  }
  
  public void promptForUserInfo(IJSchLocation location, IUserInfo userInfo, String message) {}
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.NullUserAuthenticator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubProgressMonitor;

public class Policy
{
  public static void checkCanceled(IProgressMonitor monitor)
  {
    if (monitor.isCanceled()) {
      throw new OperationCanceledException();
    }
  }
  
  public static IProgressMonitor monitorFor(IProgressMonitor monitor)
  {
    if (monitor == null) {
      return new NullProgressMonitor();
    }
    return monitor;
  }
  
  public static IProgressMonitor subMonitorFor(IProgressMonitor monitor, int ticks)
  {
    if (monitor == null) {
      return new NullProgressMonitor();
    }
    if ((monitor instanceof NullProgressMonitor)) {
      return monitor;
    }
    return new SubProgressMonitor(monitor, ticks);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.Policy
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import java.io.File;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.osgi.service.prefs.BackingStoreException;

public class PreferenceInitializer
  extends AbstractPreferenceInitializer
{
  public static String SSH_HOME_DEFAULT = null;
  public static String SSH_OLD_WIN32_HOME_DEFAULT = null;
  
  static
  {
    SSH_HOME_DEFAULT = System.getProperty("user.home");
    if (SSH_HOME_DEFAULT != null)
    {
      SSH_OLD_WIN32_HOME_DEFAULT = 
        SSH_HOME_DEFAULT + File.separator + "ssh";
      SSH_HOME_DEFAULT = SSH_HOME_DEFAULT + File.separator + 
        ".ssh";
    }
  }
  
  public void initializeDefaultPreferences()
  {
    IEclipsePreferences defaultNode = DefaultScope.INSTANCE
      .getNode(JSchCorePlugin.ID);
    if (SSH_HOME_DEFAULT != null) {
      defaultNode.put("SSH2HOME", SSH_HOME_DEFAULT);
    }
    defaultNode.put("PRIVATEKEY", "id_dsa,id_rsa");
    changeDefaultWin32SshHome();
    Utils.migrateSSH2Preferences();
  }
  
  private void changeDefaultWin32SshHome()
  {
    if (!Platform.getOS().equals("win32")) {
      return;
    }
    IEclipsePreferences preferences = InstanceScope.INSTANCE
      .getNode(JSchCorePlugin.ID);
    
    boolean defaultWin32SshHomeChanged = preferences.getBoolean(
      "org.eclipse.jsch.core.hasChangedDefaultWin32SshHome", false);
    
    boolean existingWorkspace = true;
    if (!defaultWin32SshHomeChanged)
    {
      if ((preferences.get("SSH2HOME", null) == null) && 
        (SSH_OLD_WIN32_HOME_DEFAULT != null) && 
        (new File(SSH_OLD_WIN32_HOME_DEFAULT).exists()) && (
        (SSH_HOME_DEFAULT == null) || (!new File(SSH_HOME_DEFAULT).exists()) || 
        (existingWorkspace))) {
        preferences.put("SSH2HOME", SSH_OLD_WIN32_HOME_DEFAULT);
      }
      preferences.putBoolean(
        "org.eclipse.jsch.core.hasChangedDefaultWin32SshHome", true);
      try
      {
        preferences.flush();
      }
      catch (BackingStoreException e)
      {
        JSchCorePlugin.log(new Status(1, JSchCorePlugin.ID, 
          "Could not flush preferences.", e));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.PreferenceInitializer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import org.eclipse.core.runtime.preferences.IEclipsePreferences;

public class PreferenceModifyListener
  extends org.eclipse.core.runtime.preferences.PreferenceModifyListener
{
  public IEclipsePreferences preApply(IEclipsePreferences node)
  {
    Utils.migrateSSH2Preferences(node.node("instance"));
    return super.preApply(node);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.PreferenceModifyListener
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

class ResponsiveSocketFactory$1
  implements Runnable
{
  final ResponsiveSocketFactory this$0;
  private final String val$host;
  private final int val$port;
  private final Socket[] val$socket;
  private final Exception[] val$exception;
  
  ResponsiveSocketFactory$1(ResponsiveSocketFactory paramResponsiveSocketFactory, String paramString, int paramInt, Socket[] paramArrayOfSocket, Exception[] paramArrayOfException)
  {
    this$0 = paramResponsiveSocketFactory;val$host = paramString;val$port = paramInt;val$socket = paramArrayOfSocket;val$exception = paramArrayOfException;
  }
  
  public void run()
  {
    try
    {
      Socket newSocket = this$0.internalCreateSocket(val$host, val$port);
      synchronized (val$socket)
      {
        if (Thread.interrupted()) {
          newSocket.close();
        } else {
          val$socket[0] = newSocket;
        }
      }
    }
    catch (UnknownHostException e)
    {
      val$exception[0] = e;
    }
    catch (IOException e)
    {
      val$exception[0] = e;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.ResponsiveSocketFactory.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import com.jcraft.jsch.SocketFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.osgi.util.NLS;

public class ResponsiveSocketFactory
  implements SocketFactory
{
  private static final String JAVA_NET_PROXY = "java.net.Proxy";
  private static final int DEFAULT_TIMEOUT = 60;
  InputStream in = null;
  OutputStream out = null;
  private IProgressMonitor monitor;
  private final int timeout;
  private static Class proxyClass;
  private static boolean hasProxyClass = true;
  
  public ResponsiveSocketFactory(IProgressMonitor monitor, int timeout)
  {
    if (monitor == null) {
      monitor = new NullProgressMonitor();
    }
    this.monitor = monitor;
    this.timeout = timeout;
  }
  
  public InputStream getInputStream(Socket socket)
    throws IOException
  {
    if (in == null) {
      in = socket.getInputStream();
    }
    return in;
  }
  
  public OutputStream getOutputStream(Socket socket)
    throws IOException
  {
    if (out == null) {
      out = socket.getOutputStream();
    }
    return out;
  }
  
  public Socket createSocket(String host, int port)
    throws IOException, UnknownHostException
  {
    Socket socket = null;
    socket = createSocket(host, port, timeout / 1000, monitor);
    
    monitor = new NullProgressMonitor();
    
    socket.setSoTimeout(timeout);
    return socket;
  }
  
  private Socket createSocket(String host, int port, int timeout, IProgressMonitor monitor)
    throws UnknownHostException, IOException
  {
    Socket[] socket = new Socket[1];
    Exception[] exception = new Exception[1];
    Thread thread = new Thread(new Runnable()
    {
      private final String val$host;
      private final int val$port;
      private final Socket[] val$socket;
      private final Exception[] val$exception;
      
      public void run()
      {
        try
        {
          Socket newSocket = internalCreateSocket(val$host, val$port);
          synchronized (val$socket)
          {
            if (Thread.interrupted()) {
              newSocket.close();
            } else {
              val$socket[0] = newSocket;
            }
          }
        }
        catch (UnknownHostException e)
        {
          val$exception[0] = e;
        }
        catch (IOException e)
        {
          val$exception[0] = e;
        }
      }
    });
    thread.start();
    if (timeout == 0) {
      timeout = 60;
    }
    for (int i = 0; i < timeout; i++)
    {
      try
      {
        thread.join(1000L);
      }
      catch (InterruptedException localInterruptedException) {}
      synchronized (socket)
      {
        if (monitor.isCanceled())
        {
          if (thread.isAlive()) {
            thread.interrupt();
          }
          if (socket[0] != null) {
            socket[0].close();
          }
          Policy.checkCanceled(monitor);
        }
      }
    }
    synchronized (socket)
    {
      if (thread.isAlive()) {
        thread.interrupt();
      }
    }
    if (exception[0] != null)
    {
      if ((exception[0] instanceof UnknownHostException)) {
        throw ((UnknownHostException)exception[0]);
      }
      throw ((IOException)exception[0]);
    }
    if (socket[0] == null) {
      throw new InterruptedIOException(NLS.bind(Messages.Util_timeout, new String[] { host }));
    }
    return socket[0];
  }
  
  Socket internalCreateSocket(String host, int port)
    throws UnknownHostException, IOException
  {
    Class proxyClass = getProxyClass();
    if (proxyClass != null) {
      try
      {
        Field field = proxyClass.getField("NO_PROXY");
        Object noProxyObject = field.get(null);
        Constructor constructor = tmp28_25.getConstructor(new Class[] { proxyClass });
        Object o = constructor.newInstance(new Object[] { noProxyObject });
        if ((o instanceof Socket))
        {
          Socket socket = (Socket)o;
          socket.connect(new InetSocketAddress(host, port), timeout * 1000);
          return socket;
        }
      }
      catch (SecurityException e)
      {
        JSchCorePlugin.log(4, NLS.bind("An internal error occurred while connecting to {0}", host), e);
      }
      catch (NoSuchFieldException e)
      {
        JSchCorePlugin.log(4, NLS.bind("An internal error occurred while connecting to {0}", host), e);
      }
      catch (IllegalArgumentException e)
      {
        JSchCorePlugin.log(4, NLS.bind("An internal error occurred while connecting to {0}", host), e);
      }
      catch (IllegalAccessException e)
      {
        JSchCorePlugin.log(4, NLS.bind("An internal error occurred while connecting to {0}", host), e);
      }
      catch (NoSuchMethodException e)
      {
        JSchCorePlugin.log(4, NLS.bind("An internal error occurred while connecting to {0}", host), e);
      }
      catch (InstantiationException e)
      {
        JSchCorePlugin.log(4, NLS.bind("An internal error occurred while connecting to {0}", host), e);
      }
      catch (InvocationTargetException e)
      {
        JSchCorePlugin.log(4, NLS.bind("An internal error occurred while connecting to {0}", host), e);
      }
    }
    return new Socket(host, port);
  }
  
  private synchronized Class getProxyClass()
  {
    if ((hasProxyClass) && (proxyClass == null)) {
      try
      {
        proxyClass = Class.forName("java.net.Proxy");
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        hasProxyClass = false;
      }
    }
    return proxyClass;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.ResponsiveSocketFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

class UserInfoImpl$1
  implements IUserInfo
{
  final UserInfoImpl this$0;
  private final String val$username;
  private final String[] val$_password;
  
  UserInfoImpl$1(UserInfoImpl paramUserInfoImpl, String paramString, String[] paramArrayOfString)
  {
    this$0 = paramUserInfoImpl;val$username = paramString;val$_password = paramArrayOfString;
  }
  
  public String getUsername()
  {
    return val$username;
  }
  
  public boolean isUsernameMutable()
  {
    return false;
  }
  
  public void setPassword(String password)
  {
    val$_password[0] = password;
  }
  
  public void setUsername(String username) {}
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.UserInfoImpl.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import com.jcraft.jsch.UIKeyboardInteractive;
import com.jcraft.jsch.UserInfo;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jsch.core.IJSchLocation;

class UserInfoImpl
  implements UserInfo, UIKeyboardInteractive
{
  private String username;
  private String password;
  private String passphrase;
  private IJSchLocation location;
  private IUserAuthenticator authenticator;
  private int attemptCount;
  private boolean passwordChanged;
  private long startTime;
  private long endTime;
  private boolean prompting;
  private long timeout;
  private int reuse = 0;
  
  UserInfoImpl(IJSchLocation location, IUserAuthenticator authenticator, long timeout)
  {
    this.location = location;
    username = location.getUsername();
    password = location.getPassword();
    this.authenticator = authenticator;
    this.timeout = timeout;
  }
  
  public String getPassword()
  {
    return password;
  }
  
  public String getPassphrase()
  {
    return passphrase;
  }
  
  public boolean promptYesNo(String str)
  {
    int prompt = authenticator.prompt(location, 3, 
      Messages.JSchSession_5, str, new int[] { 2, 
      3 }, 0);
    
    return prompt == 0;
  }
  
  private String promptSecret(String message, boolean includeLocation)
  {
    String[] _password = new String[1];
    String username = location.getUsername();
    IUserInfo info = new IUserInfo()
    {
      private final String val$username;
      private final String[] val$_password;
      
      public String getUsername()
      {
        return val$username;
      }
      
      public boolean isUsernameMutable()
      {
        return false;
      }
      
      public void setPassword(String password)
      {
        val$_password[0] = password;
      }
      
      public void setUsername(String username) {}
    };
    try
    {
      authenticator.promptForUserInfo(includeLocation ? location : null, 
        info, message);
    }
    catch (OperationCanceledException localOperationCanceledException)
    {
      _password[0] = null;
    }
    return _password[0];
  }
  
  public boolean promptPassphrase(String message)
  {
    try
    {
      startTimer();
      String _passphrase = promptSecret(message, false);
      if (_passphrase != null) {
        passphrase = _passphrase;
      }
      return _passphrase != null;
    }
    catch (OperationCanceledException localOperationCanceledException)
    {
      return false;
    }
    finally
    {
      endTimer();
    }
  }
  
  public boolean promptPassword(String message)
  {
    try
    {
      startTimer();
      
      String _password = promptSecret(message, true);
      if (_password != null)
      {
        password = _password;
        if (location != null) {
          location.setPassword(password);
        }
      }
      return _password != null;
    }
    finally
    {
      endTimer();
    }
  }
  
  public void showMessage(String message)
  {
    authenticator.prompt(location, 2, 
      Messages.JSchSession_5, message, 
      new int[1], 0);
  }
  
  public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo)
  {
    if (prompt.length == 0) {
      return new String[0];
    }
    try
    {
      startTimer();
      String[] arrayOfString1;
      if ((attemptCount == 0) && (password != null) && (prompt.length == 1) && 
        (prompt[0].trim().equalsIgnoreCase("password:")))
      {
        attemptCount += 1;
        return new String[] { password };
      }
      String[] result = authenticator.promptForKeyboradInteractive(location, 
        destination, name, instruction, prompt, echo);
      if (result == null) {
        return null;
      }
      if ((result.length == 1) && (prompt.length == 1) && 
        (prompt[0].trim().equalsIgnoreCase("password:")))
      {
        password = result[0];
        passwordChanged = true;
      }
      attemptCount += 1;
      return result;
    }
    catch (OperationCanceledException localOperationCanceledException)
    {
      return null;
    }
    finally
    {
      endTimer();
    }
  }
  
  public void aboutToConnect()
  {
    attemptCount = 0;
    passwordChanged = false;
  }
  
  public void connectionMade()
  {
    attemptCount = 0;
    if ((passwordChanged) && (password != null) && (location != null)) {
      location.setPassword(password);
    }
  }
  
  private synchronized void startTimer()
  {
    prompting = true;
    startTime = System.currentTimeMillis();
  }
  
  private synchronized void endTimer()
  {
    prompting = false;
    endTime = System.currentTimeMillis();
  }
  
  public long getLastDuration()
  {
    return Math.max(0L, endTime - startTime);
  }
  
  public boolean hasPromptExceededTimeout()
  {
    if (!isPrompting()) {
      return getLastDuration() > timeout;
    }
    return false;
  }
  
  public boolean isPrompting()
  {
    return prompting;
  }
  
  public synchronized int incReuse()
  {
    return reuse++;
  }
  
  String getUsername()
  {
    return username;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jsch.internal.core.UserInfoImpl
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jsch.internal.core;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Proxy;
import com.jcraft.jsch.ProxyHTTP;
import com.jcraft.jsch.ProxySOCKS5;
import com.jcraft.jsch.Session;
import java.io.File;
import java.util.Hashtable;
import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;

public class Utils
{
  private static final String[] PREFERRED_AUTH_METHODS = {
    "gssapi-with-mic", "publickey", "password", "keyboard-interactive" };
  
  public static String getDefaultAuthMethods()
  {
    String defaultValue = PREFERRED_AUTH_METHODS[0];
    for (int i = 1; i < PREFERRED_AUTH_METHODS.length; i++) {
      defaultValue = defaultValue + "," + PREFERRED_AUTH_METHODS[i];
    }
    return defaultValue;
  }
  
  public static String loadPrivateKeys(JSch jsch, String current_pkeys)
  {
    org.eclipse.core.runtime.Preferences preferences = JSchCorePlugin.getPlugin().getPluginPreferences();
    String ssh_home = preferences.getString("SSH2HOME");
    String pkeys = preferences.getString("PRIVATEKEY");
    if (ssh_home.length() == 0) {
      ssh_home = PreferenceInitializer.SSH_HOME_DEFAULT;
    }
    String[] pkey = pkeys.split(",");
    String[] _pkey = current_pkeys.split(",");
    String result = "";
    for (int i = 0; i < pkey.length; i++)
    {
      File file = new File(pkey[i]);
      if (!file.isAbsolute()) {
        file = new File(ssh_home, pkey[i]);
      }
      if (file.exists())
      {
        boolean notyet = true;
        for (int j = 0; j < _pkey.length; j++) {
          if (pkey[i].equals(_pkey[j]))
          {
            notyet = false;
            break;
          }
        }
        try
        {
          if (notyet) {
            jsch.addIdentity(file.getPath());
          }
          if (result.length() == 0) {
            result = pkey[i];
          } else {
            result = result + "," + pkey[i];
          }
        }
        catch (JSchException e)
        {
          JSchCorePlugin.log(4, 
            "An err
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd