# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: C:\Documents and Settings\ymnk\nb_all\javacvs\cvsmodule # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: src/org/netbeans/modules/versioning/system/cvss/SSHConnection.java *** C:\Documents and Settings\ymnk\nb_all\javacvs\cvsmodule\src\org\netbeans\modules\versioning\system\cvss\SSHConnection.java Base (1.7) --- C:\Documents and Settings\ymnk\nb_all\javacvs\cvsmodule\src\org\netbeans\modules\versioning\system\cvss\SSHConnection.java Locally Modified (Based On 1.7) *************** *** 44,50 **** private final String username; private final String password; ! private Session session; private ChannelExec channel; /** --- 44,51 ---- private final String username; private final String password; ! private JSch jsch; ! private static Hashtable session_pool=new Hashtable(); private ChannelExec channel; /** *************** *** 65,86 **** } public void open() throws AuthenticationException, CommandAbortedException { - Properties props = new Properties(); - props.put("StrictHostKeyChecking", "no"); // NOI18N - - JSch jsch = new JSch(); try { - session = jsch.getSession(username, host, port); - session.setSocketFactory(new SocketFactoryBridge()); - session.setConfig(props); - session.setUserInfo(new SSHUserInfo()); - session.connect(); - } catch (JSchException e) { - throw new AuthenticationException(e, NbBundle.getMessage(SSHConnection.class, "BK3001")); - } - - try { channel = (ChannelExec) session.openChannel("exec"); // NOI18N channel.setCommand(CVS_SERVER_COMMAND); setInputStream(new LoggedDataInputStream(new SshChannelInputStream(channel))); --- 66,77 ---- } public void open() throws AuthenticationException, CommandAbortedException { + Session session=getSession(); try { channel = (ChannelExec) session.openChannel("exec"); // NOI18N channel.setCommand(CVS_SERVER_COMMAND); *************** *** 122,128 **** } private void reset() { - session = null; channel = null; setInputStream(null); setOutputStream(null); --- 110,115 ---- *************** *** 130,136 **** public void close() throws IOException { if (channel != null) channel.disconnect(); - if (session != null) session.disconnect(); reset(); } --- 117,122 ---- *************** *** 155,161 **** */ private class SSHUserInfo implements UserInfo, UIKeyboardInteractive { public String getPassphrase() { ! return null; } public String getPassword() { --- 141,147 ---- */ private class SSHUserInfo implements UserInfo, UIKeyboardInteractive { public String getPassphrase() { ! return password; } public String getPassword() { *************** *** 228,234 **** --- 214,263 ---- if (exitStatus == 0 || channel.isEOF()) throw new EOFException(NbBundle.getMessage(SSHConnection.class, "BK3007")); } } + + private Session getSession() throws AuthenticationException{ + String key=username+":"+host+":"+port; + Session session=null; + synchronized(session_pool){ + session=(Session) session_pool.get(key); + if(session!=null && !session.isConnected()){ + session_pool.remove(key); + session=null; } + if(session==null){ + if(jsch==null){ + jsch = new JSch(); + String ssh_home=System.getProperty("user.home")+java.io.File.separator + ".ssh"; + String[] pkey={"id_rsa", "id_dsa"}; + for(int i=0;i