diff --git a/java/com/jcraft/jsch/Buffer.java b/java/com/jcraft/jsch/Buffer.java index ad1b2c08b..3ecffdf7f 100644 --- a/java/com/jcraft/jsch/Buffer.java +++ b/java/com/jcraft/jsch/Buffer.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -145,7 +145,7 @@ public void getByte(byte[] foo) { getByte(foo, 0, foo.length); } void getByte(byte[] foo, int start, int len) { - System.arraycopy(buffer, s, foo, start, len); + System.arraycopy(buffer, s, foo, start, len); s+=len; } public int getByte(int len) { @@ -271,15 +271,15 @@ static void dump_buffer(){ int foo; for(int i=0; i>>4)&0xf]); - System.err.print(chars[foo&0xf]); + System.err.print(chars[(foo>>>4)&0xf]); + System.err.print(chars[foo&0xf]); if(i%16==15){ System.err.println(""); - continue; - } + continue; + } if(i>0 && i%2==1){ System.err.print(" "); - } + } } System.err.println(""); } diff --git a/java/com/jcraft/jsch/ChangeLog b/java/com/jcraft/jsch/ChangeLog index 1d0baa8da..b326f1a50 100644 --- a/java/com/jcraft/jsch/ChangeLog +++ b/java/com/jcraft/jsch/ChangeLog @@ -91,12 +91,12 @@ Changes since version 0.1.50: - bugfix: resource leaks at the failure of making local port forwarding. FIXED. - bugfix: NPE in connecting to the non-standard TCP port. FIXED. This problem had appeared if a host-key does not exist in - "known_host" file. + "known_host" file. - bugfix: TCP connection may not be dropped if error messages from - the remote are too long. FIXED. + the remote are too long. FIXED. - bugfix: SftpATTRS#getAtimeString() returns the wrong string. FIXED. - bugfix: bytes to be added by SSH_MSG_CHANNEL_WINDOW_ADJUST must be in - unsigned integer. FIXED. + unsigned integer. FIXED. - bugfix: Util#checkTilde() should not convert a tilde in "C:\PROGRA~1\". FIXED. - bugfix: A long long command for ChannelExec will cause @@ -117,7 +117,7 @@ Changes since version 0.1.50: to close the given stream. FIXED - change: com.jcraft.jsch.jcraft.HMAC* will not be used. It seems Java6 on Mac OS X has fixed some memory leak bug in JCE, - so there is no reason to use c.j.j.j.HMAC* introduced at 0.1.30. + so there is no reason to use c.j.j.j.HMAC* introduced at 0.1.30. - change: updating copyright messages; 2013 -> 2014 - change: allowed to create the symbolic/hard link to the relative path by ChannelSftp#symlink(String oldpath, String newpath) @@ -137,28 +137,28 @@ Changes since version 0.1.49: http://stackoverflow.com/questions/12279836/ssh-using-jschexception-verify-false-sometimes-fails https://issues.apache.org/jira/browse/IVY-1374 - bugfix: Session#setPortForwardingL(String bind_address, - int lport, String host, int rport) - will not work for the long host name. FIXED. + int lport, String host, int rport) + will not work for the long host name. FIXED. - change: changed JSch#getIdentityRepository() to be public. - feature: added the following method to choose a canceled remote - port-forwarding with the specified bind address, + port-forwarding with the specified bind address, Session#delPortForwardingR(String bind_address, int rport) - feature: added support for following OpenSSH's sftp extensions, posix-rename@openssh.com, statvfs@openssh.com, hardlink@openssh.com, - and some methods and a class to use those functionalities, + and some methods and a class to use those functionalities, ChannelSftp#hardlink(String oldpath, String newpath), - ChannelSftp#statVFS(String path) + ChannelSftp#statVFS(String path) SftpStatVFS - feature: added support for OpenSSH's configuration file, - JSch#setConfigRepository(ConfigRepository configRepository) - JSch#getConfigRepository() + JSch#setConfigRepository(ConfigRepository configRepository) + JSch#getConfigRepository() OpenSSHConfig class Session#getSession(String host) - and added an example to demonstrate how to use it, - examples/OpenSSHConfig.java - OpenSSHConfig class will recognize the following keywords, + and added an example to demonstrate how to use it, + examples/OpenSSHConfig.java + OpenSSHConfig class will recognize the following keywords, Host User Hostname @@ -186,7 +186,7 @@ Changes since version 0.1.49: JSch#setIdentity(String prvkey, String pubkey) JSch#setKnownHosts(String prvkey, String pubkey) - feature: added support for known_hosts file, which may include - markers(@revoke) and comments. + markers(@revoke) and comments. HostKey(String host, int type, byte[] key, String comment) HostKey(String marker, String host, int type, byte[] key, String comment) @@ -196,14 +196,14 @@ Changes since version 0.1.49: writePrivateKey(java.io.OutputStream out, byte[] passphrase) writePrivateKey(String name, byte[] passphrase) - feature: allowed to set the connection timeout for the local port-forwarding, - and added following methods, + and added following methods, Session#setPortForwardingL(String bind_address, int lport, String host, int rport, ServerSocketFactory ssf, int connectTimeout) ChannelDirectTCPIP#connect(int connectTimeout) - feature: added the following method to Session class - getStreamForwarder(String host, int port) + getStreamForwarder(String host, int port) and updated example/StreamForwarding.java to use that method. - feature: added following methods to Session class, setPortForwardingL(String conf) @@ -212,39 +212,39 @@ Changes since version 0.1.49: Session#setHostKeyRepository(HostKeyRepository hostkeyRepository) Session#getHostKeyRepository() - feature: added support for OpenSSH's local extension, - "no-more-sessions@openssh.com" and the method, + "no-more-sessions@openssh.com" and the method, Session#noMoreSessionChannels() Changes since version 0.1.48: - bugfix: Some sftp servers will sometimes fail to handle bulk requests, - and whenever detecting such failures, we should re-send + and whenever detecting such failures, we should re-send requests again and again. FIXED - bugfix: KeyPair#getFingerPrint() should return a fingerprint instead - of keysize + " " + fingerprint. FIXED + of keysize + " " + fingerprint. FIXED - bugfix: KeyPair#getKeySize() should return its key size. FIXED - bugfix: SftpATTRS#isDir() should return false for unix domain - socket files. FIXED + socket files. FIXED - change: improved the heuristics for the password prompt in - the keyboard-interactive authentication. It may not be - started with "password:". + the keyboard-interactive authentication. It may not be + started with "password:". - change: ChannelSftp#put(InputStream src, String dst) will not check - if dst is directory or not, and if an exception is thrown, - the check will be done. + if dst is directory or not, and if an exception is thrown, + the check will be done. - change: if the compression is enabled without jzlib.jar, - an exception will be thrown. + an exception will be thrown. - feature: JSch#addIdentity() and KeyPair#load() methods will accept - Putty's private key files. - Note that Putty encrypts its private key with "aes256-cbc". - So, to handle such key files, "Java Cryptography - Extension (JCE) Unlimited Strength Jurisdiction Policy Files" - must be installed. + Putty's private key files. + Note that Putty encrypts its private key with "aes256-cbc". + So, to handle such key files, "Java Cryptography + Extension (JCE) Unlimited Strength Jurisdiction Policy Files" + must be installed. - feature: hmac-sha2-256 defined in RFC6668 is supported. - feature: added following methods to KeyPair class, - byte[] getSignature(byte[] data) - Signature getVerifier() - byte[] forSSHAgent() - void setPublicKeyComment(String comment) + byte[] getSignature(byte[] data) + Signature getVerifier() + byte[] forSSHAgent() + void setPublicKeyComment(String comment) - feature: added following methods to SftpATTR class, boolean isChr() boolean isBlk() @@ -263,7 +263,7 @@ Changes since version 0.1.47: Changes since version 0.1.46: - bugfix: failed to initialize channels for the stream forwarding. FIXED - change: Session#getHostKey() will return the given hostkey - even if session is not established. + even if session is not established. - change: Logger will record additional messages about algorithm negotiations. - feature: added ChannelSftp#ls(String path, LsEntrySelector selector) method. - feature: added IdentityRepository#{getName(),getStatus()} methods. @@ -281,33 +281,33 @@ Changes since version 0.1.45: - change: authentication trials will be failed at 6 failures by the default. - change: updating copyright messages; 2011 -> 2012 - feature: added JSch#setIdentityRepository(IdentityRepository irepo) to - integrate with jsch-agent-proxy. + integrate with jsch-agent-proxy. Changes since version 0.1.44: - bugfix: fields referred by multiple threads simultaneously should be - volatile. FIXED + volatile. FIXED - bugfix: use local window size offered by the remote in sftp put. FIXED - bugfix: SftpProgressMonitor#init was not invoked in sftp-put - for input-stream. FIXED + for input-stream. FIXED - bugfix: sftp protocol version 3, 4 and 5 should allow only - UTF-8 encoding. FIXED + UTF-8 encoding. FIXED - bugfix: Channel Subsystem had failed to set X forwarding flag. FIXED - bugfix: Channel X11 had leaked some resources. FIXED - bugfix: packet compression may break sessions - in some case(transferring deflated data). FIXED + in some case(transferring deflated data). FIXED - bugfix: failed to set dev-null for logger FIXED - bugfix: even in sftp protocol version 3 session, some sftpd sends data - packets defined in sftp protocol 6 ;-( working around it. FIXED + packets defined in sftp protocol 6 ;-( working around it. FIXED - bugfix: ChannelSftp file globbing logic had missed - the string "foo\\\*bar" as a pattern. FIXED + the string "foo\\\*bar" as a pattern. FIXED - bugfix: sequential accesses to ChannelSftp by multiple threads may - break its I/O channel. - https://bugs.eclipse.org/bugs/show_bug.cgi?id=359184 FIXED + break its I/O channel. + https://bugs.eclipse.org/bugs/show_bug.cgi?id=359184 FIXED - bugfix: KeyPair.load can not handle private keys cyphered with AES. FIXED - change: to improve sftp-put performance, send multiple packet at one time. - change: wait/notify will be used instead of sleep loop @@ -316,7 +316,7 @@ Changes since version 0.1.44: - change: updating copyright messages; 2010 -> 2011 - change: src/com -> src/main/java/com - feature: key-exchange method "diffie-hellman-group14-sha1" - (RFC4253#section-8.2) + (RFC4253#section-8.2) - feature: KeyPair#getPlulicKeyCommment() is added. @@ -325,7 +325,7 @@ Changes since version 0.1.43: - bugfix: working around OOME in parsing broken data from the remote. FIXED. - bugfix: failed to send very long command for exec channels. FIXED. - bugfix: in some case, failed to get the response - for remote port-forwarding request. FIXED. + for remote port-forwarding request. FIXED. - feature: support for private keys ciphered with aes192-cbc and aes128-cbc. @@ -347,26 +347,26 @@ Changes since version 0.1.42: Changes since version 0.1.41: - bugfix: making exec request during re-keying process will cause - the dead lock for the session. FIXED. + the dead lock for the session. FIXED. Many thanks for PanLi at Prominic dot NET and www.prominic.net, - US based hosting company. Without their testing JSch with - hundreds of hosts and their bug reports, this problem - was not fixed. + US based hosting company. Without their testing JSch with + hundreds of hosts and their bug reports, this problem + was not fixed. - change: updating copyright messages; 2008 -> 2009 Changes since version 0.1.40: - bugfix: canceling the remote port-forwarding with the incorrect - bind-address. FIXED. + bind-address. FIXED. - bugfix: sftp had missed to close the file in some case. FIXED. - bugfix: ls(sftp) will throw an exception for the empty directory - in connecting to some sftpd server. FIXED. + in connecting to some sftpd server. FIXED. - change: dropping the session gently in accepting incorrect packets. - change: by the default, aes128-ctr will be chosen if it is available - on the local and the remote. + on the local and the remote. - feature: adding the support for the private key ciphered in AES256. - feature: new ciphers: aes128-ctr,aes192-ctr,aes256-ctr, - 3des-ctr,arcfour,arcfour128 ,arcfour256 + 3des-ctr,arcfour,arcfour128 ,arcfour256 Changes since version 0.1.39: @@ -385,22 +385,22 @@ Changes since version 0.1.37: - bugfix: NPE should not be thrown at unexpected session drop. FIXED. - bugfix: AIOOBE at Session#connect(). FIXED. - bugfix: Even if 'true' is given for - Channel#setOutputStream(OutputStream out, boolean dontclose) - as the second paramter, 'out' will be closed. FIXED. + Channel#setOutputStream(OutputStream out, boolean dontclose) + as the second paramter, 'out' will be closed. FIXED. - change: 'examples/Sftp.java' has been modified to demonstrate ChannelSftp#reaplpath(String path) - change: setEnv(Hashtable env) for exec and shell channels have been - marked as @deprecated + marked as @deprecated - feature: setEnv(String name, String value) has been added to exec - and shell channels. + and shell channels. - feature: setEnv(byte[] name, byte[] value) has been added to exec - and shell channels. + and shell channels. - feature: ChannelSftp#realpath(String path) has been added. - feature: ChannelExec#setCommand(byte[] command) has been added. - feature: com.jcraft.jsch.ChannelSftp.LsEntry has implemented - java.lang.Comparable + java.lang.Comparable - feature: Session#getServerAliveInterval(), Session#getServerAliveCountMaX() - have been added. + have been added. Changes since version 0.1.36: @@ -409,7 +409,7 @@ Changes since version 0.1.36: - bugfix: the stream forwarding had been broken since 0.1.30. FIXED. - bugfix: failed to detect 'SSH_MSG_CHANNEL_OPEN_FAILURE'. FIXED. - bugfix: ChannelSftp will generate the unfavorable absolute pathname - in some case. FIXED. + in some case. FIXED. - bugfix: failed to ignore the invalid public-key file. FIXED. - change: ignoring empty data sent by 'SSH_MSG_CHANNEL_DATA' and 'SSH_MSG_CHANNEL_EXTENDED_DATA'. @@ -417,148 +417,148 @@ Changes since version 0.1.36: - change: build.xml will enable 'javac.debug' option by the default. - change: added logging messages to IndentityFile and Session class. - change: followings are deprecated methods, - InputStream ChannelSftp#get(String src, - int mode) - InputStream ChannelSftp#get(String src, - SftpProgressMonitor, - int mode) + InputStream ChannelSftp#get(String src, + int mode) + InputStream ChannelSftp#get(String src, + SftpProgressMonitor, + int mode) - feature: following method is added, - InputStream ChannelSftp#get(String src, - SftpProgressMonitor monitor, - long skip) + InputStream ChannelSftp#get(String src, + SftpProgressMonitor monitor, + long skip) Changes since version 0.1.35: - bugfix: ChannelSftp can not handle the local filenames correctly on Windows. FIXED. - bugfix: '/' must be handled as the file separator on JVM for Windows. FIXED. - change: the system property - "javax.security.auth.useSubjectCredsOnly" - will be set to "false" for "gssapi-with-mic" - if that property is not given explicitly. + "javax.security.auth.useSubjectCredsOnly" + will be set to "false" for "gssapi-with-mic" + if that property is not given explicitly. - change: added changes about ChannelSftp#{pwd(), home()} to - ChangeLog; 'Changes since version 0.1.34:' section. + ChangeLog; 'Changes since version 0.1.34:' section. Changes since version 0.1.34: - bugfix: the OutputStream from the channel may make the JVM - lockup in some case. FIXED. - There was a possibility that Channel#connect() may be failed - to initialize its internal without throwing the JSchException. - On such case, the write operation for OutputStream from - that channel will cause the system(JVM) to lock up. + lockup in some case. FIXED. + There was a possibility that Channel#connect() may be failed + to initialize its internal without throwing the JSchException. + On such case, the write operation for OutputStream from + that channel will cause the system(JVM) to lock up. - bugfix: ChannelSftp had problems filename globbing. FIXED. - bugfix: the message included in SSH_FXP_STATUS must be UTF-8. FIXED. - change: ChannelSftp supports the filename globbing for - the filename in multi-byte characters. + the filename in multi-byte characters. - change: ChannelSftp will internally handle filenames in UTF-8 encoding. - change: ChannelSftp#pwd() may throw an SftpException. - change: ChannelSftp#home() may throw an SftpException. - feature: following methods have been added in ChannelSftp - String getServerVersion() - String getClientVersion() - void setFilenameEncoding(String encoding) - String getExtension(String key) + String getServerVersion() + String getClientVersion() + void setFilenameEncoding(String encoding) + String getExtension(String key) Changes since version 0.1.33: - bugfix: there had a possibility that the session may be broken - if ciphers for upward/downward streams are different. FIXED. + if ciphers for upward/downward streams are different. FIXED. - bugfix: the authentication method "keyboard-interactive" had - not been tried without UserInfo. FIXED. + not been tried without UserInfo. FIXED. - bugfix: ChannelShell#setTerminalMode(byte[] terminal_mode) had - not been functional. FIXED. + not been functional. FIXED. - bugfix: the remote port-forwarding to the daemon had been broken - since 0.1.30. FIXED. + since 0.1.30. FIXED. - change: the cipher "aes128-cbc" will be used if AES is available. - change: the interface 'com.jcraft.jsch.ForwardedTCPIPDaemon' has been changed. - change: the data transfer rate will be improved on some environment. - feature: ChannelExec can control the size of pty; - ChannelExec#setPtySize(int col, int row, int wp, int hp) is + ChannelExec#setPtySize(int col, int row, int wp, int hp) is added. - feature: the property "CheckCiphers" has been added. - Refer to 'examples/AES.java'. + Refer to 'examples/AES.java'. - feature: Session#setConfig(String key, String value), - JSch#setConfig(String key, String value) have been added. + JSch#setConfig(String key, String value) have been added. Changes since version 0.1.32: - bugfix: freeze in 'diffie-hellman-group-exchange-sha1'. FIXED. By the default, 'diffie-hellman-group1-sha1' will be used - and if you have not chosen 'diffie-hellman-group-exchange-sha1' - explicitly, you don't have to worry about it. + and if you have not chosen 'diffie-hellman-group-exchange-sha1' + explicitly, you don't have to worry about it. - bugfix: there should be timeout mechanism in opening a socket - for remote port forwarding. FIXED. - At the failure or timeout, 'SSH_MSG_CHANNEL_OPEN_FAILURE' - will be sent to sshd. + for remote port forwarding. FIXED. + At the failure or timeout, 'SSH_MSG_CHANNEL_OPEN_FAILURE' + will be sent to sshd. - bugfix: there should be timeout mechanism in opening a socket - for X11 forwarding. FIXED. - At the failure or timeout, 'SSH_MSG_CHANNEL_OPEN_FAILURE' + for X11 forwarding. FIXED. + At the failure or timeout, 'SSH_MSG_CHANNEL_OPEN_FAILURE' will be sent to sshd. Changes since version 0.1.31: - bugfix: remote port forwarding will be hanged at its closing. FIXED. - bugfix: X forwarding channels will be hanged and some resources - will be leaked whenever they are closed. FIXED. + will be leaked whenever they are closed. FIXED. - bugfix: failed to detect "Connection refused". FIXED. - bugfix: at the failure for keyboard-interactive auth method, - a session will be terminated. FIXED. + a session will be terminated. FIXED. - bugfix: due to the cancel for keyboard-interactive auth method, - a session will be terminated. FIXED. + a session will be terminated. FIXED. - change: com.jcraft.jsch.jcraft.Compression#uncompress will respect - the argument "start". + the argument "start". - change: "gssapi-with-mic" will choose the default credential. - feature: Session#setPortForwardingL will return the assigned local - TCP port number; TCP port will be assigned dynamically if lport==0. + TCP port number; TCP port will be assigned dynamically if lport==0. - feature: support for SSH_MSG_UNIMPLEMENTED. - feature: support for PASSWD_CHANGEREQ. Changes since version 0.1.30: - bugfix: a problem in padding for ciphered private key. - PKCS#5 padding should be used. FIXED. + PKCS#5 padding should be used. FIXED. - bugfix: crash in parsing invalid public key file. FIXED. - bugfix: a public key may not have a comment. FIXED. - bugfix: output stream from ChannelSftp#put will hang if it is closed - twice. FIXED. + twice. FIXED. - feature: agent forwarding. To enable this functionality, - Channel{Exec,Shell,Sftp}#setAgentForwarding(boolean enable) are added. + Channel{Exec,Shell,Sftp}#setAgentForwarding(boolean enable) are added. - feature: ChannelShell#setTerminalMode(byte[] terminal_mode) is added. - feature: Session#setDaemonThread(boolean true) to run internal threads as - daemon threads. + daemon threads. - feature: an option "PreferredAuthentications" is added. - The default value is "gssapi-with-mic,publickey,keyboard-interactive,password". + The default value is "gssapi-with-mic,publickey,keyboard-interactive,password". - change: if alias-name is given, non-standard TCP port number will not be - saved in 'known_hosts' file. + saved in 'known_hosts' file. Changes since version 0.1.29: - bugfix: ChannelSftp#cd() will not throw an exception even if - a file is given. FIXED. + a file is given. FIXED. - bugfix: ChannelSftp#put() has a bug which will appear in using - on the slow network. FIXED. + on the slow network. FIXED. - bugfix: ChannelSftp#ls() has a bug which will appear in using - on the slow network. FIXED. + on the slow network. FIXED. - bugfix: a bug had sneaked in the remote port forwarding. FIXED. - bugfix: some APIs from JCE have the memory leak on Mac OS X, - so we have re-written the code(com.jcraft.jsch.jcraft.HMAC* - classes) without them. On Mac OS X, such new classes will - be used automatically. FIXED. + so we have re-written the code(com.jcraft.jsch.jcraft.HMAC* + classes) without them. On Mac OS X, such new classes will + be used automatically. FIXED. - bugfix: the session will be crashed by the long banner message. FIXED. - change: '/dev/random' will not be referred on Gnu/Linux. - change: if non-standard TCP port number is used, that number will - be saved in known_hosts file as recent OpenSSH's ssh client does. + be saved in known_hosts file as recent OpenSSH's ssh client does. - change: Channel#getOutputStream will not use Piped{Output,Input}Stream. - change: com.jcraft.jsch.HostKeyRepository interface has been - slightly modified. + slightly modified. - feature: Session#setPortForwardingR(String bind_address, ...) has been added. - feature: the packet compression method 'zlib@openssh.com' has been supported. - feature: the hashed known_hosts file has been supported. - Refer to 'examples/KnownHosts.java'. + Refer to 'examples/KnownHosts.java'. - feature: the authentication method 'gssapi-with-mic' has been - experimentally supported. + experimentally supported. - feature: com.jcraft.jsch.Logger interface and - JSch#setLogger(Logger logger) have been added. - Refer to 'examples/Logger.java' for the usage. + JSch#setLogger(Logger logger) have been added. + Refer to 'examples/Logger.java' for the usage. Changes since version 0.1.28: @@ -575,10 +575,10 @@ Changes since version 0.1.28: - bugfix: ProxySOCKS5 did not carefully read file input-streams. FIXED. - bugfix: ForwardedTCPIPDaemom may fail in some situation. FIXED. - bugfix: X forwarding failed to handle the magic-cookie - in some case FIXED. + in some case FIXED. Thanks to Walter Pfannenmller. - bugfix: setKnownHosts in KnownHosts.java doesn't read the last - line if linefeed is missing FIXED. + line if linefeed is missing FIXED. Thanks to Henrik Langos. - bugfix: With StrictHostKeyChecking set to yes connect() shouldn't ask. FIXED. @@ -595,7 +595,7 @@ Changes since version 0.1.28: explicitly Session.setServerAliveCountMax(0) - change: PortWatcher stops to use InetAddress.getByAddress(). - change: in the user authentication, username, password and passphrase - will be encoded in UTF-8. + will be encoded in UTF-8. - change: JSch#addIdentity will check duplicate keys. - change: SftpException#message has been deleted. - change: SftpException#getMessage() will return the detailed message. @@ -613,8 +613,8 @@ Changes since version 0.1.28: - feature: Session#setPassword(byte[] password) is added. - feature: Session#setHostKeyAlias(String alias) is added. - feature: KeepAlive is implemented and - Session#setServerAliveInterval(int interval) and - Session#setServerAliveCountMax(int count) are added. + Session#setServerAliveInterval(int interval) and + Session#setServerAliveCountMax(int count) are added. - feature: Session#sendKeepAliveMsg() is added. - feature: JSchException#getCause() may return a reason. - feature: SftpException#getCause() may return a reason. @@ -637,7 +637,7 @@ Changes since version 0.1.26: - bugfix: problems in handling cancel operations for sftp. FIXED. - bugfix: ChannelX11s were not terminated for a wrong cookie. FIXED. - bugfix: NoSuchAlgorithmException should be thrown if JCE is not - accessible. FIXED. + accessible. FIXED. - bugfix: ProxyHTTP should check the return code from proxy. FIXED. - bugfix: server's version string should be checked carefully. FIXED. - feature: some more improvements on sftp uploading. @@ -655,7 +655,7 @@ Changes since version 0.1.25: Changes since version 0.1.24: - bugfix: remote port forwarding is not established. FIXED. - bugfix: failed to parse known_hosts file if it has a long public key blob. - FIXED. + FIXED. - bugfix: sftp put/get operations keep failing. FIXED. - bugfix: ChannelShell.setXForwarding always set xforwarding to be true. FIXED. - change: ChannelShell.setPty is added. @@ -667,61 +667,61 @@ Changes since version 0.1.24: Changes since version 0.1.23: - bugfix: there was resource leak problems in closing local port forwardings. - FIXED. + FIXED. - bugfix: there was a session crash problems in using aes-cbc cipher. FIXED. - change: ChannelSession.setPtySize was redefined. - feature: added SocketFactory for remote port forwarding. - Session.setPortForwardingR(int rport, String host, int lport, - SocketFactory sf) + Session.setPortForwardingR(int rport, String host, int lport, + SocketFactory sf) - feature: added ServerSocketFactory for local port forwarding. - Session.setPortForwardingL(String boundaddress, - int lport, String host, int rport, - ServerSocketFactory ssf) + Session.setPortForwardingL(String boundaddress, + int lport, String host, int rport, + ServerSocketFactory ssf) Changes since version 0.1.22: - bugfix: there was a freeze problem at fails on key-exchanging. FIXED. - bugfix: race-condition forcefully disconnects session in closing channels. - FIXED. + FIXED. Changes since version 0.1.21: - bugfix: there is a bug in read() method implementation for the input-stream returned from ChannelSftp.get(). FIXED. - bugfix: at fail on requesting for the remote port forwarding, - an exception should be thrown. FIXED. + an exception should be thrown. FIXED. - bugfix: SSH_MSG_CHANNEL_OPEN request for the X11 forwarding should not - be accepted if clients don not expect it. FIXED. + be accepted if clients don not expect it. FIXED. - bugfix: there is a problem in transferring large data(mote than 1GB) - to sshd from recent OpenSSH(3.6.1 or later). FIXED. - For security concerns, those sshd will re-key periodically and - jsch had failed to handle it. + to sshd from recent OpenSSH(3.6.1 or later). FIXED. + For security concerns, those sshd will re-key periodically and + jsch had failed to handle it. - bugfix: 'exec', 'shell' and 'sftp' channels will fail if the acceptable - packet size by remote sshd is not so large. FIXED. + packet size by remote sshd is not so large. FIXED. - bugfix: there are problems in 'InputStream ChannelSftp.get(String)' - and 'OutputStream put(String)'. FIXED. + and 'OutputStream put(String)'. FIXED. - feature: added boolean flag 'dontclose' to - * setInputStream(), - * setOutputStream() and - * setExtOutputStream() + * setInputStream(), + * setOutputStream() and + * setExtOutputStream() methods of Channel class. - feature: added 'com.jcraft.jsch.ChannelSubsystem' - feature: allowed to control the compression level in the packet compression. - Refer to 'examples/Compression.java'. + Refer to 'examples/Compression.java'. - change: modified 'com/jcraft/jsch/jce/KeyPairGenRSA.java' to be complied - on JDK 1.2. + on JDK 1.2. - change: 'examples/ScpTo.java' and 'examples/ScpFrom.java' will use - 'long' type for the file size instead of 'int'. + 'long' type for the file size instead of 'int'. - change: 'Identity.getSignature' method will not expect 'session'. - change: while waiting for socket connection establishment, Thread.join - will be used instead of Thread.sleep. + will be used instead of Thread.sleep. Changes since version 0.1.20: - known issue: there are problems in 'InputStream ChannelSftp.get(String)' - and 'OutputStream put(String)'. They will be re-implemented - in the next release. + and 'OutputStream put(String)'. They will be re-implemented + in the next release. - bugfix: EOF packets should not be sent twice. This bug had crashed - the session on every channel close. FIXED. + the session on every channel close. FIXED. - bugfix: at the fail on opening connection to remote sshd, a misleading exception "invalid server's version string" had been thrown. FIXED. @@ -731,16 +731,16 @@ Changes since version 0.1.20: - change: to transfer packets efficiently, the size of internal buffer for each channel has been increased. - change: ChannelSftp.ls will return a vector of - com.jcraft.jsch.ChannelSftp.LsEntry. Sorry for inconveniences. + com.jcraft.jsch.ChannelSftp.LsEntry. Sorry for inconveniences. - feature: added ForwardedTCPIPDaemon. Refer to 'examples/Daemon.java', which demonstrates to provide network services like inetd. - feature: ChannelExec.setPty() method to request for assigning pseudo tty. - feature: added ciphers "aes128-cbc", "aes192-cbc" and "aes256-cbc". - Refer to 'examples/AES.java'. + Refer to 'examples/AES.java'. - feature: local port-forwarding settings can be dynamically deleted by the bound address. - feature: added 'Channel.isClosed()'. Channel.getExitStatus() should be - invoked after Channel.isClosed()==true. + invoked after Channel.isClosed()==true. Changes since version 0.1.19: @@ -862,7 +862,7 @@ Changes since version 0.1.8: Changes since version 0.1.7: - added APIs for sftp resume downloads and uploads. The author greatly appreciates - elpernotador(webmaster at unlix dot com dot ar), + elpernotador(webmaster at unlix dot com dot ar), who motivated him to hack this functionality. - 'examples/Sftp.java' demonstrates sftp resume functionality. Please refer to "put-resume", "put-append", "get-resume" and diff --git a/java/com/jcraft/jsch/Channel.java b/java/com/jcraft/jsch/Channel.java index 2d94e5cb4..642f13cbc 100644 --- a/java/com/jcraft/jsch/Channel.java +++ b/java/com/jcraft/jsch/Channel.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -47,7 +47,7 @@ public abstract class Channel implements Runnable{ static final int SSH_OPEN_UNKNOWN_CHANNEL_TYPE= 3; static final int SSH_OPEN_RESOURCE_SHORTAGE= 4; - static int index=0; + static int index=0; private static java.util.Vector pool=new java.util.Vector(); static Channel getChannel(String type){ if(type.equals("session")){ @@ -104,7 +104,7 @@ static void del(Channel c){ volatile long rwsize=0; // remote initial window size volatile int rmpsize=0; // remote maximum packet size - IO io=null; + IO io=null; Thread thread=null; volatile boolean eof_local=false; @@ -116,12 +116,12 @@ static void del(Channel c){ volatile int exitstatus=-1; - volatile int reply=0; + volatile int reply=0; volatile int connectTimeout=0; private Session session; - int notifyme=0; + int notifyme=0; Channel(){ synchronized(pool){ @@ -154,7 +154,7 @@ public void connect(int connectTimeout) throws JSchException{ catch(Exception e){ connected=false; disconnect(); - if(e instanceof JSchException) + if(e instanceof JSchException) throw (JSchException)e; throw new JSchException(e.toString(), e); } @@ -372,7 +372,7 @@ else if(in < out){ else size = out - in; } return size; - } + } synchronized void checkSpace(int len) throws IOException { int size = freeSpace(); if(size BUFFER_SIZE) { + else if(buffer.length == size && size > BUFFER_SIZE) { int i = size/2; if(i BUFFER_SIZE) { void setLocalWindowSize(int foo){ this.lwsize=foo; } void setLocalPacketSize(int foo){ this.lmpsize=foo; } synchronized void setRemoteWindowSize(long foo){ this.rwsize=foo; } - synchronized void addRemoteWindowSize(long foo){ - this.rwsize+=foo; + synchronized void addRemoteWindowSize(long foo){ + this.rwsize+=foo; if(notifyme>0) notifyAll(); } @@ -546,15 +546,15 @@ static void disconnect(Session session){ synchronized(pool){ channels=new Channel[pool.size()]; for(int i=0; iname and value are needed to be passed + * Set the environment variable. + * If name and value are needed to be passed * to the remote in your favorite encoding, * use {@link #setEnv(byte[], byte[])}. * Refer to RFC4254 6.4 Environment Variable Passing. @@ -124,13 +124,13 @@ private Hashtable getEnv(){ * * @param enable */ - public void setPty(boolean enable){ - pty=enable; + public void setPty(boolean enable){ + pty=enable; } /** * Set the terminal mode. - * + * * @param terminal_mode */ public void setTerminalMode(byte[] terminal_mode){ @@ -218,7 +218,7 @@ protected void sendRequests() throws Exception{ Object name=_env.nextElement(); Object value=env.get(name); request=new RequestEnv(); - ((RequestEnv)request).setEnv(toByteArray(name), + ((RequestEnv)request).setEnv(toByteArray(name), toByteArray(value)); request.request(_session, this); } @@ -240,34 +240,34 @@ public void run(){ int i=-1; try{ while(isConnected() && - thread!=null && - io!=null && + thread!=null && + io!=null && io.in!=null){ - i=io.in.read(buf.buffer, - 14, + i=io.in.read(buf.buffer, + 14, buf.buffer.length-14 -Session.buffer_margin - ); - if(i==0)continue; - if(i==-1){ - eof(); - break; - } - if(close)break; + ); + if(i==0)continue; + if(i==-1){ + eof(); + break; + } + if(close)break; //System.out.println("write: "+i); packet.reset(); buf.putByte((byte)Session.SSH_MSG_CHANNEL_DATA); buf.putInt(recipient); buf.putInt(i); buf.skip(i); - getSession().write(packet, this, i); + getSession().write(packet, this, i); } } catch(Exception e){ //System.err.println("# ChannelExec.run"); //e.printStackTrace(); } - Thread _thread=thread; + Thread _thread=thread; if(_thread!=null){ synchronized(_thread){ _thread.notifyAll(); } } diff --git a/java/com/jcraft/jsch/ChannelSftp.java b/java/com/jcraft/jsch/ChannelSftp.java index a0ea26de0..ff652fe93 100644 --- a/java/com/jcraft/jsch/ChannelSftp.java +++ b/java/com/jcraft/jsch/ChannelSftp.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -193,10 +193,10 @@ is not supported for the server (it may be generated locally by * @param bulk_requests how many requests may be outstanding at any one time. */ public void setBulkRequests(int bulk_requests) throws JSchException { - if(bulk_requests>0) + if(bulk_requests>0) rq = new RequestQueue(bulk_requests); - else - throw new JSchException("setBulkRequests: "+ + else + throw new JSchException("setBulkRequests: "+ bulk_requests+" must be greater than 0."); } @@ -263,7 +263,7 @@ public void start() throws JSchException{ header=header(buf, header); length=header.length; if(length > MAX_MSG_LENGTH){ - throw new SftpException(SSH_FX_FAILURE, + throw new SftpException(SSH_FX_FAILURE, "Received message is too long: " + length); } type=header.type; // 2 -> SSH_FXP_VERSION @@ -288,24 +288,24 @@ public void start() throws JSchException{ if(extensions.get("posix-rename@openssh.com")!=null && extensions.get("posix-rename@openssh.com").equals("1")){ extension_posix_rename = true; - } + } if(extensions.get("statvfs@openssh.com")!=null && extensions.get("statvfs@openssh.com").equals("2")){ extension_statvfs = true; - } + } /* if(extensions.get("fstatvfs@openssh.com")!=null && extensions.get("fstatvfs@openssh.com").equals("2")){ extension_fstatvfs = true; - } + } */ if(extensions.get("hardlink@openssh.com")!=null && extensions.get("hardlink@openssh.com").equals("1")){ extension_hardlink = true; - } + } lcwd=new File(".").getCanonicalPath(); } @@ -324,7 +324,7 @@ public void lcd(String path) throws SftpException{ path=localAbsolutePath(path); if((new File(path)).isDirectory()){ try{ - path=(new File(path)).getCanonicalPath(); + path=(new File(path)).getCanonicalPath(); } catch(Exception e){} lcwd=path; @@ -344,11 +344,11 @@ public void cd(String path) throws SftpException{ SftpATTRS attr=_stat(str); if((attr.getFlags()&SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS)==0){ - throw new SftpException(SSH_FX_FAILURE, + throw new SftpException(SSH_FX_FAILURE, "Can't change directory: "+path); } if(!attr.isDir()){ - throw new SftpException(SSH_FX_FAILURE, + throw new SftpException(SSH_FX_FAILURE, "Can't change directory: "+path); } @@ -368,8 +368,8 @@ public void put(String src, String dst) throws SftpException{ public void put(String src, String dst, int mode) throws SftpException{ put(src, dst, null, mode); } - public void put(String src, String dst, - SftpProgressMonitor monitor) throws SftpException{ + public void put(String src, String dst, + SftpProgressMonitor monitor) throws SftpException{ put(src, dst, monitor, OVERWRITE); } @@ -383,8 +383,8 @@ public void put(String src, String dst, * @param monitor progress monitor * @param mode how data should be added to dst */ - public void put(String src, String dst, - SftpProgressMonitor monitor, int mode) throws SftpException{ + public void put(String src, String dst, + SftpProgressMonitor monitor, int mode) throws SftpException{ try{ ((MyPipedInputStream)io_in).updateReadSide(); @@ -415,71 +415,71 @@ public void put(String src, String dst, StringBuffer dstsb=null; if(isRemoteDir){ if(!dst.endsWith("/")){ - dst+="/"; + dst+="/"; } dstsb=new StringBuffer(dst); } else if(vsize>1){ - throw new SftpException(SSH_FX_FAILURE, + throw new SftpException(SSH_FX_FAILURE, "Copying multiple files, but the destination is missing or a file."); } for(int j=0; ji) - i=ii; + i=ii; } - if(i==-1) dstsb.append(_src); - else dstsb.append(_src.substring(i + 1)); + if(i==-1) dstsb.append(_src); + else dstsb.append(_src.substring(i + 1)); _dst=dstsb.toString(); dstsb.delete(dst.length(), _dst.length()); - } + } else{ _dst=dst; } //System.err.println("_dst "+_dst); - long size_of_dst=0; - if(mode==RESUME){ - try{ - SftpATTRS attr=_stat(_dst); - size_of_dst=attr.getSize(); - } - catch(Exception eee){ - //System.err.println(eee); - } - long size_of_src=new File(_src).length(); - if(size_of_src0){ - long skipped=src.skip(skip); - if(skipped1){ - throw new SftpException(SSH_FX_FAILURE, + throw new SftpException(SSH_FX_FAILURE, "Copying multiple files, but destination is missing or a file."); } for(int j=0; j1){ } } dstsb.delete(dst.length(), _dst.length()); - } + } else{ _dst=dst; } File _dstFile=new File(_dst); - if(mode==RESUME){ - long size_of_src=attr.getSize(); - long size_of_dst=_dstFile.length(); - if(size_of_dst>size_of_src){ - throw new SftpException(SSH_FX_FAILURE, + if(mode==RESUME){ + long size_of_src=attr.getSize(); + long size_of_dst=_dstFile.length(); + if(size_of_dst>size_of_src){ + throw new SftpException(SSH_FX_FAILURE, "failed to resume for "+_dst); - } - if(size_of_dst==size_of_src){ - return; - } - } - - if(monitor!=null){ - monitor.init(SftpProgressMonitor.GET, _src, _dst, attr.getSize()); - if(mode==RESUME){ - monitor.count(_dstFile.length()); - } - } + } + if(size_of_dst==size_of_src){ + return; + } + } + + if(monitor!=null){ + monitor.init(SftpProgressMonitor.GET, _src, _dst, attr.getSize()); + if(mode==RESUME){ + monitor.count(_dstFile.length()); + } + } FileOutputStream fos=null; _dstExist = _dstFile.exists(); @@ -1009,11 +1009,11 @@ public void get(String src, OutputStream dst) throws SftpException{ get(src, dst, null, OVERWRITE, 0); } public void get(String src, OutputStream dst, - SftpProgressMonitor monitor) throws SftpException{ + SftpProgressMonitor monitor) throws SftpException{ get(src, dst, monitor, OVERWRITE, 0); } public void get(String src, OutputStream dst, - SftpProgressMonitor monitor, int mode, long skip) throws SftpException{ + SftpProgressMonitor monitor, int mode, long skip) throws SftpException{ //System.err.println("get: "+src+", "+dst); try{ ((MyPipedInputStream)io_in).updateReadSide(); @@ -1022,7 +1022,7 @@ public void get(String src, OutputStream dst, src=isUnique(src); if(monitor!=null){ - SftpATTRS attr=_stat(src); + SftpATTRS attr=_stat(src); monitor.init(SftpProgressMonitor.GET, src, "??", attr.getSize()); if(mode==RESUME){ monitor.count(skip); @@ -1054,7 +1054,7 @@ private void _get(String src, OutputStream dst, fill(buf, length); if(type!=SSH_FXP_STATUS && type!=SSH_FXP_HANDLE){ - throw new SftpException(SSH_FX_FAILURE, ""); + throw new SftpException(SSH_FX_FAILURE, ""); } if(type==SSH_FXP_STATUS){ @@ -1066,7 +1066,7 @@ private void _get(String src, OutputStream dst, long offset=0; if(mode==RESUME){ - offset+=skip; + offset+=skip; } int request_max=1; @@ -1101,20 +1101,20 @@ private void _get(String src, OutputStream dst, if(type==SSH_FXP_STATUS){ fill(buf, length); - int i=buf.getInt(); + int i=buf.getInt(); if(i==SSH_FX_EOF){ break loop; } throwStatusError(buf, i); } - if(type!=SSH_FXP_DATA){ - break loop; + if(type!=SSH_FXP_DATA){ + break loop; } buf.rewind(); fill(buf.buffer, 0, 4); length-=4; - int length_of_data = buf.getInt(); // length of data + int length_of_data = buf.getInt(); // length of data /** Since sftp protocol version 6, "end-of-file" has been defined, @@ -1137,8 +1137,8 @@ private void _get(String src, OutputStream dst, int data_len = io_in.read(buf.buffer, 0, bar); if(data_len<0){ break loop; - } - + } + dst.write(buf.buffer, 0, data_len); offset+=data_len; @@ -1146,7 +1146,7 @@ private void _get(String src, OutputStream dst, if(monitor!=null){ if(!monitor.count(data_len)){ - skip(foo); + skip(foo); if(optional_data>0){ skip(optional_data); } @@ -1155,7 +1155,7 @@ private void _get(String src, OutputStream dst, } } - //System.err.println("length: "+length); // length should be 0 + //System.err.println("length: "+length); // length should be 0 if(optional_data>0){ skip(optional_data); @@ -1228,7 +1228,7 @@ void add(int id, long offset, int length){ Request get(int id) throws OutOfOrderException, SftpException { count -= 1; int i = head; - head++; + head++; if(head==rrq.length) head=0; if(rrq[i].id != id){ long offset = getOffset(); @@ -1242,7 +1242,7 @@ Request get(int id) throws OutOfOrderException, SftpException { } if(find) throw new OutOfOrderException(offset); - throw new SftpException(SSH_FX_FAILURE, + throw new SftpException(SSH_FX_FAILURE, "RequestQueue: unknown request id "+id); } rrq[i].id = 0; @@ -1255,7 +1255,7 @@ int count() { int size() { return rrq.length; - } + } void cancel(Header header, Buffer buf) throws IOException { int _count = count; @@ -1268,7 +1268,7 @@ void cancel(Header header, Buffer buf) throws IOException { break; } } - skip(length); + skip(length); } init(); } @@ -1284,7 +1284,7 @@ long getOffset(){ } return result; - } + } } public InputStream get(String src) throws SftpException{ @@ -1333,7 +1333,7 @@ public InputStream get(String src, final SftpProgressMonitor monitor, final long fill(buf, length); if(type!=SSH_FXP_STATUS && type!=SSH_FXP_HANDLE){ - throw new SftpException(SSH_FX_FAILURE, ""); + throw new SftpException(SSH_FX_FAILURE, ""); } if(type==SSH_FXP_STATUS){ int i=buf.getInt(); @@ -1371,7 +1371,7 @@ public int read(byte[] d, int s, int len) throws java.io.IOException{ if(d==null){throw new NullPointerException();} if(s<0 || len <0 || s+len>d.length){ throw new IndexOutOfBoundsException(); - } + } if(len==0){ return 0; } if(rest_length>0){ @@ -1379,7 +1379,7 @@ public int read(byte[] d, int s, int len) throws java.io.IOException{ if(foo>len) foo=len; System.arraycopy(rest_byte, 0, d, s, foo); if(foo!=rest_length){ - System.arraycopy(rest_byte, foo, + System.arraycopy(rest_byte, foo, rest_byte, 0, rest_length-foo); } @@ -1398,7 +1398,7 @@ public int read(byte[] d, int s, int len) throws java.io.IOException{ len=buf.buffer.length-13; } if(server_version==0 && len>1024){ - len=1024; + len=1024; } if(rq.count()==0 @@ -1436,12 +1436,12 @@ public int read(byte[] d, int s, int len) throws java.io.IOException{ throw new IOException("error: "+e.toString()); } - if(type!=SSH_FXP_STATUS && type!=SSH_FXP_DATA){ + if(type!=SSH_FXP_STATUS && type!=SSH_FXP_DATA){ throw new IOException("error"); } if(type==SSH_FXP_STATUS){ fill(buf, rest_length); - int i=buf.getInt(); + int i=buf.getInt(); rest_length=0; if(i==SSH_FX_EOF){ close(); @@ -1457,12 +1457,12 @@ public int read(byte[] d, int s, int len) throws java.io.IOException{ /** Since sftp protocol version 6, "end-of-file" has been defined, - + byte SSH_FXP_DATA uint32 request-id string data bool end-of-file [optional] - + but some sftpd server will send such a field in the sftp protocol 3 ;-( */ int optional_data = rest_length - length_of_data; @@ -1649,7 +1649,7 @@ public void ls(String path, LsEntrySelector selector) throws SftpException{ if(type!=SSH_FXP_STATUS && type!=SSH_FXP_NAME){ throw new SftpException(SSH_FX_FAILURE, ""); } - if(type==SSH_FXP_STATUS){ + if(type==SSH_FXP_STATUS){ fill(buf, length); int i=buf.getInt(); if(i==SSH_FX_EOF) @@ -1668,8 +1668,8 @@ public void ls(String path, LsEntrySelector selector) throws SftpException{ while(count>0){ if(length>0){ buf.shift(); - int j=(buf.buffer.length>(buf.index+length)) ? - length : + int j=(buf.buffer.length>(buf.index+length)) ? + length : (buf.buffer.length-buf.index); int i=fill(buf.buffer, buf.index, j); buf.index+=i; @@ -1683,7 +1683,7 @@ public void ls(String path, LsEntrySelector selector) throws SftpException{ SftpATTRS attrs=SftpATTRS.getATTR(buf); if(cancel==LsEntrySelector.BREAK){ - count--; + count--; continue; } @@ -1721,7 +1721,7 @@ else if(!pattern_has_wildcard){ cancel = selector.select(new LsEntry(f, l, attrs)); } - count--; + count--; } } _sendCLOSE(handle, header); @@ -1755,7 +1755,7 @@ else if(!pattern_has_wildcard){ public String readlink(String path) throws SftpException{ try{ if(server_version<3){ - throw new SftpException(SSH_FX_OP_UNSUPPORTED, + throw new SftpException(SSH_FX_OP_UNSUPPORTED, "The remote sshd is too old to support symlink operation."); } @@ -1804,7 +1804,7 @@ public String readlink(String path) throws SftpException{ public void symlink(String oldpath, String newpath) throws SftpException{ if(server_version<3){ - throw new SftpException(SSH_FX_OP_UNSUPPORTED, + throw new SftpException(SSH_FX_OP_UNSUPPORTED, "The remote sshd is too old to support symlink operation."); } @@ -1856,7 +1856,7 @@ public void symlink(String oldpath, String newpath) throws SftpException{ public void hardlink(String oldpath, String newpath) throws SftpException{ if(!extension_hardlink){ - throw new SftpException(SSH_FX_OP_UNSUPPORTED, + throw new SftpException(SSH_FX_OP_UNSUPPORTED, "hardlink@openssh.com is not supported"); } @@ -1908,7 +1908,7 @@ public void hardlink(String oldpath, String newpath) throws SftpException{ public void rename(String oldpath, String newpath) throws SftpException{ if(server_version<2){ - throw new SftpException(SSH_FX_OP_UNSUPPORTED, + throw new SftpException(SSH_FX_OP_UNSUPPORTED, "The remote sshd is too old to support rename operation."); } @@ -1971,7 +1971,7 @@ public void rm(String path) throws SftpException{ Header header=new Header(); for(int j=0; j0){ - if(length>0){ - buf.shift(); + if(length>0){ + buf.shift(); int j=(buf.buffer.length>(buf.index+length)) ? length : (buf.buffer.length-buf.index); - i=io_in.read(buf.buffer, buf.index, j); - if(i<=0)break; - buf.index+=i; - length-=i; - } - - byte[] filename=buf.getString(); - //System.err.println("filename: "+new String(filename)); + i=io_in.read(buf.buffer, buf.index, j); + if(i<=0)break; + buf.index+=i; + length-=i; + } + + byte[] filename=buf.getString(); + //System.err.println("filename: "+new String(filename)); if(server_version<=3){ str=buf.getString(); // longname } - SftpATTRS attrs=SftpATTRS.getATTR(buf); + SftpATTRS attrs=SftpATTRS.getATTR(buf); byte[] _filename=filename; String f=null; @@ -2775,7 +2775,7 @@ private Vector glob_remote(String _path) throws Exception{ } found=Util.glob(pattern, _filename); - if(found){ + if(found){ if(f==null){ f=Util.byte2str(filename, fEncoding); } @@ -2785,12 +2785,12 @@ private Vector glob_remote(String _path) throws Exception{ pdir+="/"; } } - v.addElement(pdir+f); - } - count--; + v.addElement(pdir+f); + } + count--; } } - if(_sendCLOSE(handle, header)) + if(_sendCLOSE(handle, header)) return v; return null; } @@ -2844,7 +2844,7 @@ private Vector glob_local(String _path) throws Exception{ byte[] dir; if(i==0){dir=new byte[]{(byte)file_separatorc};} - else{ + else{ dir=new byte[i]; System.arraycopy(path, 0, dir, 0, i); } @@ -2858,9 +2858,9 @@ private Vector glob_local(String _path) throws Exception{ String pdir=Util.byte2str(dir)+file_separator; for(int j=0; j=3 && // WindRiver's sftp will send invalid + if(server_version>=3 && // WindRiver's sftp will send invalid buf.getLength()>=4){ // SSH_FXP_STATUS packet. byte[] str=buf.getString(); //byte[] tag=buf.getString(); @@ -2922,7 +2922,7 @@ private int fill(byte[] buf, int s, int len) throws IOException{ private void skip(long foo) throws IOException{ while(foo>0){ long bar=io_in.skip(foo); - if(bar<=0) + if(bar<=0) break; foo-=bar; } @@ -2938,7 +2938,7 @@ private Header header(Buffer buf, Header header) throws IOException{ int i=fill(buf.buffer, 0, 9); header.length=buf.getInt()-5; header.type=buf.getByte()&0xff; - header.rid=buf.getInt(); + header.rid=buf.getInt(); return header; } @@ -3049,7 +3049,7 @@ public interface LsEntrySelector { *

The select method will be invoked in ls * method for each file entry. If this method returns BREAK, * ls will be canceled. - * + * * @param entry one of entry from ls * @return if BREAK is returned, the 'ls' operation will be canceled. */ diff --git a/java/com/jcraft/jsch/ChannelShell.java b/java/com/jcraft/jsch/ChannelShell.java index 5113c5031..9a54272cb 100644 --- a/java/com/jcraft/jsch/ChannelShell.java +++ b/java/com/jcraft/jsch/ChannelShell.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/ChannelSubsystem.java b/java/com/jcraft/jsch/ChannelSubsystem.java index 568b4910e..8923e8ac5 100644 --- a/java/com/jcraft/jsch/ChannelSubsystem.java +++ b/java/com/jcraft/jsch/ChannelSubsystem.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -47,8 +47,8 @@ public void start() throws JSchException{ request.request(_session, this); } if(pty){ - request=new RequestPtyReq(); - request.request(_session, this); + request=new RequestPtyReq(); + request.request(_session, this); } request=new RequestSubsystem(); ((RequestSubsystem)request).request(_session, this, subsystem, want_reply); diff --git a/java/com/jcraft/jsch/ChannelX11.java b/java/com/jcraft/jsch/ChannelX11.java index 5be9049f5..05292f42b 100644 --- a/java/com/jcraft/jsch/ChannelX11.java +++ b/java/com/jcraft/jsch/ChannelX11.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -61,11 +61,11 @@ static int revtable(byte foo){ return 0; } static void setCookie(String foo){ - cookie_hex=Util.str2byte(foo); + cookie_hex=Util.str2byte(foo); cookie=new byte[16]; for(int i=0; i<16; i++){ - cookie[i]=(byte)(((revtable(cookie_hex[i*2])<<4)&0xf0) | - ((revtable(cookie_hex[i*2+1]))&0xf)); + cookie[i]=(byte)(((revtable(cookie_hex[i*2])<<4)&0xf0) | + ((revtable(cookie_hex[i*2+1]))&0xf)); } } static void setHost(String foo){ host=foo; } @@ -74,11 +74,11 @@ static byte[] getFakedCookie(Session session){ synchronized(faked_cookie_hex_pool){ byte[] foo=(byte[])faked_cookie_hex_pool.get(session); if(foo==null){ - Random random=Session.random; - foo=new byte[16]; - synchronized(random){ - random.fill(foo, 0, 16); - } + Random random=Session.random; + foo=new byte[16]; + synchronized(random){ + random.fill(foo, 0, 16); + } /* System.err.print("faked_cookie: "); for(int i=0; i>>4)&0xf]; - bar[2*i+1]=table[(foo[i])&0xf]; - } - faked_cookie_hex_pool.put(session, bar); - foo=bar; + faked_cookie_pool.put(session, foo); + byte[] bar=new byte[32]; + for(int i=0; i<16; i++){ + bar[2*i]=table[(foo[i]>>>4)&0xf]; + bar[2*i+1]=table[(foo[i])&0xf]; + } + faked_cookie_hex_pool.put(session, bar); + foo=bar; } return foo; } @@ -117,7 +117,7 @@ static void removeFakedCookie(Session session){ connected=true; /* - try{ + try{ socket=Util.createSocket(host, port, TIMEOUT); socket.setTcpNoDelay(true); io=new IO(); @@ -132,7 +132,7 @@ static void removeFakedCookie(Session session){ public void run(){ - try{ + try{ socket=Util.createSocket(host, port, TIMEOUT); socket.setTcpNoDelay(true); io=new IO(); @@ -155,20 +155,20 @@ public void run(){ while(thread!=null && io!=null && io.in!=null){ - i=io.in.read(buf.buffer, - 14, - buf.buffer.length-14-Session.buffer_margin); - if(i<=0){ - eof(); + i=io.in.read(buf.buffer, + 14, + buf.buffer.length-14-Session.buffer_margin); + if(i<=0){ + eof(); break; - } - if(close)break; + } + if(close)break; packet.reset(); buf.putByte((byte)Session.SSH_MSG_CHANNEL_DATA); buf.putInt(recipient); buf.putInt(i); buf.skip(i); - getSession().write(packet, this, i); + getSession().write(packet, this, i); } } catch(Exception e){ @@ -201,7 +201,7 @@ void write(byte[] foo, int s, int l) throws java.io.IOException { } foo=addCache(foo, s, l); - s=0; + s=0; l=foo.length; if(l<9) @@ -217,7 +217,7 @@ else if((foo[s]&0xff)==0x6c){ dlen=((dlen>>>8)&0xff)|((dlen<<8)&0xff00); } else{ - // ?? + // ?? } if(l<12+plen+((-plen)&3)+dlen) @@ -228,7 +228,7 @@ else if((foo[s]&0xff)==0x6c){ byte[] faked_cookie=null; synchronized(faked_cookie_pool){ - faked_cookie=(byte[])faked_cookie_pool.get(_session); + faked_cookie=(byte[])faked_cookie_pool.get(_session); } /* @@ -249,7 +249,7 @@ else if((foo[s]&0xff)==0x6c){ System.arraycopy(cookie, 0, foo, s+12+plen+((-plen)&3), dlen); } else{ - //System.err.println("wrong cookie"); + //System.err.println("wrong cookie"); thread=null; eof(); io.close(); diff --git a/java/com/jcraft/jsch/Cipher.java b/java/com/jcraft/jsch/Cipher.java index 966ceb5b6..bd5e8857a 100644 --- a/java/com/jcraft/jsch/Cipher.java +++ b/java/com/jcraft/jsch/Cipher.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -32,9 +32,9 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public interface Cipher{ static int ENCRYPT_MODE=0; static int DECRYPT_MODE=1; - int getIVSize(); - int getBlockSize(); - void init(int mode, byte[] key, byte[] iv) throws Exception; + int getIVSize(); + int getBlockSize(); + void init(int mode, byte[] key, byte[] iv) throws Exception; void update(byte[] foo, int s1, int len, byte[] bar, int s2) throws Exception; boolean isCBC(); } diff --git a/java/com/jcraft/jsch/CipherNone.java b/java/com/jcraft/jsch/CipherNone.java index 917dd9fdd..5fe947327 100644 --- a/java/com/jcraft/jsch/CipherNone.java +++ b/java/com/jcraft/jsch/CipherNone.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -32,7 +32,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class CipherNone implements Cipher{ private static final int ivsize=8; private static final int bsize=16; - public int getIVSize(){return ivsize;} + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ } diff --git a/java/com/jcraft/jsch/Compression.java b/java/com/jcraft/jsch/Compression.java index 3db3176ba..820ba922b 100644 --- a/java/com/jcraft/jsch/Compression.java +++ b/java/com/jcraft/jsch/Compression.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/ConfigRepository.java b/java/com/jcraft/jsch/ConfigRepository.java index 713388995..f1c9c31ec 100644 --- a/java/com/jcraft/jsch/ConfigRepository.java +++ b/java/com/jcraft/jsch/ConfigRepository.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/DH.java b/java/com/jcraft/jsch/DH.java index df4f9dbbf..1a536f5c2 100644 --- a/java/com/jcraft/jsch/DH.java +++ b/java/com/jcraft/jsch/DH.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/DHEC256.java b/java/com/jcraft/jsch/DHEC256.java index 50454bb1b..aa8e87a20 100644 --- a/java/com/jcraft/jsch/DHEC256.java +++ b/java/com/jcraft/jsch/DHEC256.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/DHEC384.java b/java/com/jcraft/jsch/DHEC384.java index 6438e71d0..9d2e5b1e6 100644 --- a/java/com/jcraft/jsch/DHEC384.java +++ b/java/com/jcraft/jsch/DHEC384.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/DHEC521.java b/java/com/jcraft/jsch/DHEC521.java index 7a9ac78a8..e24f59a60 100644 --- a/java/com/jcraft/jsch/DHEC521.java +++ b/java/com/jcraft/jsch/DHEC521.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/DHECN.java b/java/com/jcraft/jsch/DHECN.java index 8b71760dd..f99744285 100644 --- a/java/com/jcraft/jsch/DHECN.java +++ b/java/com/jcraft/jsch/DHECN.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -50,16 +50,16 @@ public abstract class DHECN extends KeyExchange{ private ECDH ecdh; - protected String sha_name; + protected String sha_name; protected int key_size; public void init(Session session, - byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ + byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ this.session=session; - this.V_S=V_S; - this.V_C=V_C; - this.I_S=I_S; - this.I_C=I_C; + this.V_S=V_S; + this.V_C=V_C; + this.I_S=I_S; + this.I_C=I_C; try{ Class c=Class.forName(session.getConfig(sha_name)); @@ -97,9 +97,9 @@ public void init(Session session, session.write(packet); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "SSH_MSG_KEX_ECDH_INIT sent"); - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "expecting SSH_MSG_KEX_ECDH_REPLY"); } @@ -119,8 +119,8 @@ public boolean next(Buffer _buf) throws Exception{ j=_buf.getByte(); j=_buf.getByte(); if(j!=31){ - System.err.println("type: must be 31 "+j); - return false; + System.err.println("type: must be 31 "+j); + return false; } K_S=_buf.getString(); @@ -136,7 +136,7 @@ public boolean next(Buffer _buf) throws Exception{ // Section 3.2.2 of [SEC1]. If a key fails validation, // the key exchange MUST fail. if(!ecdh.validate(r_s[0], r_s[1])){ - return false; + return false; } K = ecdh.getSecret(r_s[0], r_s[1]); @@ -172,7 +172,7 @@ public boolean next(Buffer _buf) throws Exception{ i=0; j=0; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| - ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); + ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); String alg=Util.byte2str(K_S, i, j); i+=j; diff --git a/java/com/jcraft/jsch/DHG1.java b/java/com/jcraft/jsch/DHG1.java index c88521cf2..25a4b4bd3 100644 --- a/java/com/jcraft/jsch/DHG1.java +++ b/java/com/jcraft/jsch/DHG1.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,7 +35,7 @@ public class DHG1 extends KeyExchange{ static final byte[] g={ 2 }; static final byte[] p={ (byte)0x00, -(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF, +(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF, (byte)0xC9,(byte)0x0F,(byte)0xDA,(byte)0xA2,(byte)0x21,(byte)0x68,(byte)0xC2,(byte)0x34, (byte)0xC4,(byte)0xC6,(byte)0x62,(byte)0x8B,(byte)0x80,(byte)0xDC,(byte)0x1C,(byte)0xD1, (byte)0x29,(byte)0x02,(byte)0x4E,(byte)0x08,(byte)0x8A,(byte)0x67,(byte)0xCC,(byte)0x74, @@ -71,12 +71,12 @@ public class DHG1 extends KeyExchange{ private Packet packet; public void init(Session session, - byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ + byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ this.session=session; - this.V_S=V_S; - this.V_C=V_C; - this.I_S=I_S; - this.I_C=I_C; + this.V_S=V_S; + this.V_C=V_C; + this.I_S=I_S; + this.I_C=I_C; try{ Class c=Class.forName(session.getConfig("sha-1")); @@ -116,9 +116,9 @@ public void init(Session session, session.write(packet); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "SSH_MSG_KEXDH_INIT sent"); - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "expecting SSH_MSG_KEXDH_REPLY"); } @@ -139,8 +139,8 @@ public boolean next(Buffer _buf) throws Exception{ j=_buf.getByte(); j=_buf.getByte(); if(j!=31){ - System.err.println("type: must be 31 "+j); - return false; + System.err.println("type: must be 31 "+j); + return false; } K_S=_buf.getString(); @@ -181,7 +181,7 @@ public boolean next(Buffer _buf) throws Exception{ i=0; j=0; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| - ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); + ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); String alg=Util.byte2str(K_S, i, j); i+=j; diff --git a/java/com/jcraft/jsch/DHG14.java b/java/com/jcraft/jsch/DHG14.java index 0e1edc555..163476c5a 100644 --- a/java/com/jcraft/jsch/DHG14.java +++ b/java/com/jcraft/jsch/DHG14.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -87,12 +87,12 @@ public class DHG14 extends KeyExchange{ private Packet packet; public void init(Session session, - byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ + byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ this.session=session; - this.V_S=V_S; - this.V_C=V_C; - this.I_S=I_S; - this.I_C=I_C; + this.V_S=V_S; + this.V_C=V_C; + this.I_S=I_S; + this.I_C=I_C; try{ Class c=Class.forName(session.getConfig("sha-1")); @@ -135,9 +135,9 @@ public void init(Session session, session.write(packet); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "SSH_MSG_KEXDH_INIT sent"); - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "expecting SSH_MSG_KEXDH_REPLY"); } @@ -158,8 +158,8 @@ public boolean next(Buffer _buf) throws Exception{ j=_buf.getByte(); j=_buf.getByte(); if(j!=31){ - System.err.println("type: must be 31 "+j); - return false; + System.err.println("type: must be 31 "+j); + return false; } K_S=_buf.getString(); @@ -200,7 +200,7 @@ public boolean next(Buffer _buf) throws Exception{ i=0; j=0; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| - ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); + ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); String alg=Util.byte2str(K_S, i, j); i+=j; diff --git a/java/com/jcraft/jsch/DHGEX.java b/java/com/jcraft/jsch/DHGEX.java index 310e22483..bc9abb43c 100644 --- a/java/com/jcraft/jsch/DHGEX.java +++ b/java/com/jcraft/jsch/DHGEX.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -60,12 +60,12 @@ public class DHGEX extends KeyExchange{ protected String hash="sha-1"; public void init(Session session, - byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ + byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{ this.session=session; - this.V_S=V_S; - this.V_C=V_C; - this.I_S=I_S; - this.I_C=I_C; + this.V_S=V_S; + this.V_C=V_C; + this.I_S=I_S; + this.I_C=I_C; try{ Class c=Class.forName(session.getConfig(hash)); @@ -83,7 +83,7 @@ public void init(Session session, Class c=Class.forName(session.getConfig("dh")); // Since JDK8, SunJCE has lifted the keysize restrictions // from 1024 to 2048 for DH. - preferred = max = check2048(c, max); + preferred = max = check2048(c, max); dh=(com.jcraft.jsch.DH)(c.getDeclaredConstructor().newInstance()); dh.init(); } @@ -96,12 +96,12 @@ public void init(Session session, buf.putInt(min); buf.putInt(preferred); buf.putInt(max); - session.write(packet); + session.write(packet); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "SSH_MSG_KEX_DH_GEX_REQUEST("+min+"<"+preferred+"<"+max+") sent"); - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "expecting SSH_MSG_KEX_DH_GEX_GROUP"); } @@ -119,8 +119,8 @@ public boolean next(Buffer _buf) throws Exception{ _buf.getByte(); j=_buf.getByte(); if(j!=SSH_MSG_KEX_DH_GEX_GROUP){ - System.err.println("type: must be SSH_MSG_KEX_DH_GEX_GROUP "+j); - return false; + System.err.println("type: must be SSH_MSG_KEX_DH_GEX_GROUP "+j); + return false; } p=_buf.getMPInt(); @@ -141,9 +141,9 @@ public boolean next(Buffer _buf) throws Exception{ session.write(packet); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "SSH_MSG_KEX_DH_GEX_INIT sent"); - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "expecting SSH_MSG_KEX_DH_GEX_REPLY"); } @@ -161,8 +161,8 @@ public boolean next(Buffer _buf) throws Exception{ j=_buf.getByte(); j=_buf.getByte(); if(j!=SSH_MSG_KEX_DH_GEX_REPLY){ - System.err.println("type: must be SSH_MSG_KEX_DH_GEX_REPLY "+j); - return false; + System.err.println("type: must be SSH_MSG_KEX_DH_GEX_REPLY "+j); + return false; } K_S=_buf.getString(); @@ -213,7 +213,7 @@ public boolean next(Buffer _buf) throws Exception{ i=0; j=0; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| - ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); + ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); String alg=Util.byte2str(K_S, i, j); i+=j; diff --git a/java/com/jcraft/jsch/DHGEX256.java b/java/com/jcraft/jsch/DHGEX256.java index 6627aaa17..a2e58f9c2 100644 --- a/java/com/jcraft/jsch/DHGEX256.java +++ b/java/com/jcraft/jsch/DHGEX256.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/ECDH.java b/java/com/jcraft/jsch/ECDH.java index b92c31e5b..d51c4608c 100644 --- a/java/com/jcraft/jsch/ECDH.java +++ b/java/com/jcraft/jsch/ECDH.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/ForwardedTCPIPDaemon.java b/java/com/jcraft/jsch/ForwardedTCPIPDaemon.java index 2318c6c83..c195a0d82 100644 --- a/java/com/jcraft/jsch/ForwardedTCPIPDaemon.java +++ b/java/com/jcraft/jsch/ForwardedTCPIPDaemon.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/GSSContext.java b/java/com/jcraft/jsch/GSSContext.java index 1c3864a58..9822d397c 100644 --- a/java/com/jcraft/jsch/GSSContext.java +++ b/java/com/jcraft/jsch/GSSContext.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/HASH.java b/java/com/jcraft/jsch/HASH.java index bea8aa48a..703871e9d 100644 --- a/java/com/jcraft/jsch/HASH.java +++ b/java/com/jcraft/jsch/HASH.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/HostKey.java b/java/com/jcraft/jsch/HostKey.java index e09a51c54..66e80294a 100644 --- a/java/com/jcraft/jsch/HostKey.java +++ b/java/com/jcraft/jsch/HostKey.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -69,7 +69,7 @@ public HostKey(String host, int type, byte[] key, String comment) throws JSchExc } public HostKey(String marker, String host, int type, byte[] key, String comment) throws JSchException { this.marker=marker; - this.host=host; + this.host=host; if(type==GUESS){ if(key[8]=='d'){ this.type=SSHDSS; } else if(key[8]=='r'){ this.type=SSHRSA; } @@ -80,7 +80,7 @@ public HostKey(String marker, String host, int type, byte[] key, String comment) else { throw new JSchException("invalid key type");} } else{ - this.type=type; + this.type=type; } this.key=key; this.comment=comment; @@ -127,7 +127,7 @@ boolean isMatched(String _host){ private boolean isIncluded(String _host){ int i=0; - String hosts=this.host; + String hosts=this.host; int hostslen=hosts.length(); int hostlen=_host.length(); int j; @@ -138,7 +138,7 @@ private boolean isIncluded(String _host){ return hosts.regionMatches(true, i, _host, 0, hostlen); } if(hostlen==(j-i)){ - if(hosts.regionMatches(true, i, _host, 0, hostlen)) return true; + if(hosts.regionMatches(true, i, _host, 0, hostlen)) return true; } i=j+1; } diff --git a/java/com/jcraft/jsch/HostKeyRepository.java b/java/com/jcraft/jsch/HostKeyRepository.java index 17f9f6950..53c387074 100644 --- a/java/com/jcraft/jsch/HostKeyRepository.java +++ b/java/com/jcraft/jsch/HostKeyRepository.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,8 +35,8 @@ public interface HostKeyRepository{ final int CHANGED=2; /** - * Checks if host is included with the key. - * + * Checks if host is included with the key. + * * @return #NOT_INCLUDED, #OK or #CHANGED * @see #NOT_INCLUDED * @see #OK diff --git a/java/com/jcraft/jsch/IO.java b/java/com/jcraft/jsch/IO.java index 0be3bf0fb..5288bc0d3 100644 --- a/java/com/jcraft/jsch/IO.java +++ b/java/com/jcraft/jsch/IO.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -81,7 +81,7 @@ void getByte(byte[] array, int begin, int length) throws IOException { do{ int completed = in.read(array, begin, length); if(completed<0){ - throw new IOException("End of IO Stream Read"); + throw new IOException("End of IO Stream Read"); } begin+=completed; length-=completed; diff --git a/java/com/jcraft/jsch/Identity.java b/java/com/jcraft/jsch/Identity.java index ca2c06004..86bbaceda 100644 --- a/java/com/jcraft/jsch/Identity.java +++ b/java/com/jcraft/jsch/Identity.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -81,7 +81,7 @@ public interface Identity{ public String getAlgName(); /** - * Returns the name of this identity. + * Returns the name of this identity. * It will be useful to identify this object in the {@link IdentityRepository}. */ public String getName(); diff --git a/java/com/jcraft/jsch/IdentityFile.java b/java/com/jcraft/jsch/IdentityFile.java index 63d6a82c3..98b8c9832 100644 --- a/java/com/jcraft/jsch/IdentityFile.java +++ b/java/com/jcraft/jsch/IdentityFile.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -124,7 +124,7 @@ public String getAlgName(){ } /** - * Returns the name of this identity. + * Returns the name of this identity. * It will be useful to identify this object in the {@link IdentityRepository}. */ public String getName(){ diff --git a/java/com/jcraft/jsch/IdentityRepository.java b/java/com/jcraft/jsch/IdentityRepository.java index d4f3f2281..19e23e967 100644 --- a/java/com/jcraft/jsch/IdentityRepository.java +++ b/java/com/jcraft/jsch/IdentityRepository.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -89,7 +89,7 @@ public Vector getIdentities() { return result; } void add(Identity identity) { - if(!keep_in_cache && + if(!keep_in_cache && !identity.isEncrypted() && (identity instanceof IdentityFile)) { try { ir.add(((IdentityFile)identity).getKeyPair().forSSHAgent()); diff --git a/java/com/jcraft/jsch/JSch.java b/java/com/jcraft/jsch/JSch.java index 9a01913d6..ed121bec3 100644 --- a/java/com/jcraft/jsch/JSch.java +++ b/java/com/jcraft/jsch/JSch.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -44,7 +44,7 @@ public final class JSch{ static{ config.put("kex", "ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1"); config.put("server_host_key", "ssh-ed25519,rsa-sha2-256,rsa-sha2-512,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521"); - config.put("cipher.s2c", + config.put("cipher.s2c", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"); config.put("cipher.c2s", "aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc"); @@ -59,13 +59,13 @@ public final class JSch{ config.put("compression_level", "6"); - config.put("diffie-hellman-group-exchange-sha1", + config.put("diffie-hellman-group-exchange-sha1", "com.jcraft.jsch.DHGEX"); - config.put("diffie-hellman-group1-sha1", - "com.jcraft.jsch.DHG1"); - config.put("diffie-hellman-group14-sha1", + config.put("diffie-hellman-group1-sha1", + "com.jcraft.jsch.DHG1"); + config.put("diffie-hellman-group14-sha1", "com.jcraft.jsch.DHG14"); // available since JDK8. - config.put("diffie-hellman-group-exchange-sha256", + config.put("diffie-hellman-group-exchange-sha256", "com.jcraft.jsch.DHGEX256"); // available since JDK1.4.2. // On JDK8, 2048bits will be used. config.put("ecdsa-sha2-nistp256", "com.jcraft.jsch.jce.SignatureECDSA256"); @@ -200,10 +200,10 @@ public JSch(){ try{ String osname=(String)(System.getProperties().get("os.name")); if(osname!=null && osname.equals("Mac OS X")){ - config.put("hmac-sha1", "com.jcraft.jsch.jcraft.HMACSHA1"); - config.put("hmac-md5", "com.jcraft.jsch.jcraft.HMACMD5"); - config.put("hmac-md5-96", "com.jcraft.jsch.jcraft.HMACMD596"); - config.put("hmac-sha1-96", "com.jcraft.jsch.jcraft.HMACSHA196"); + config.put("hmac-sha1", "com.jcraft.jsch.jcraft.HMACSHA1"); + config.put("hmac-md5", "com.jcraft.jsch.jcraft.HMACMD5"); + config.put("hmac-md5-96", "com.jcraft.jsch.jcraft.HMACMD596"); + config.put("hmac-sha1-96", "com.jcraft.jsch.jcraft.HMACSHA196"); } } catch(Exception e){ @@ -215,7 +215,7 @@ public JSch(){ * Instantiates the Session object with * host. The user name and port number will be retrieved from * ConfigRepository. If user name is not given, - * the system property "user.name" will be referred. + * the system property "user.name" will be referred. * * @param host hostname * @@ -278,7 +278,7 @@ public Session getSession(String username, String host, int port) throws JSchExc if(host==null){ throw new JSchException("host must not be null."); } - Session s = new Session(this, username, host, port); + Session s = new Session(this, username, host, port); return s; } @@ -321,7 +321,7 @@ public void setKnownHosts(String filename) throws JSchException{ if(known_hosts==null) known_hosts=new KnownHosts(this); if(known_hosts instanceof KnownHosts){ synchronized(known_hosts){ - ((KnownHosts)known_hosts).setKnownHosts(filename); + ((KnownHosts)known_hosts).setKnownHosts(filename); } } } @@ -337,11 +337,11 @@ public void setKnownHosts(String filename) throws JSchException{ * * @see com.jcraft.jsch.KnownHosts */ - public void setKnownHosts(InputStream stream) throws JSchException{ + public void setKnownHosts(InputStream stream) throws JSchException{ if(known_hosts==null) known_hosts=new KnownHosts(this); if(known_hosts instanceof KnownHosts){ synchronized(known_hosts){ - ((KnownHosts)known_hosts).setKnownHosts(stream); + ((KnownHosts)known_hosts).setKnownHosts(stream); } } } @@ -355,9 +355,9 @@ public void setKnownHosts(InputStream stream) throws JSchException{ * @see com.jcraft.jsch.HostKeyRepository * @see com.jcraft.jsch.KnownHosts */ - public HostKeyRepository getHostKeyRepository(){ + public HostKeyRepository getHostKeyRepository(){ if(known_hosts==null) known_hosts=new KnownHosts(this); - return known_hosts; + return known_hosts; } /** @@ -463,11 +463,11 @@ public void addIdentity(String name, byte[]prvkey, byte[]pubkey, byte[] passphra */ public void addIdentity(Identity identity, byte[] passphrase) throws JSchException{ if(passphrase!=null){ - try{ + try{ byte[] goo=new byte[passphrase.length]; System.arraycopy(passphrase, 0, goo, 0, passphrase.length); passphrase=goo; - identity.setPassphrase(passphrase); + identity.setPassphrase(passphrase); } finally{ Util.bzero(passphrase); @@ -562,13 +562,13 @@ public void removeAllIdentity() throws JSchException{ * @param key key for the configuration. * @return config value */ - public static String getConfig(String key){ + public static String getConfig(String key){ synchronized(config){ if(key.equalsIgnoreCase("PubkeyAcceptedKeyTypes")){ key="PubkeyAcceptedAlgorithms"; } return (String)(config.get(key)); - } + } } /** @@ -579,9 +579,9 @@ public static String getConfig(String key){ public static void setConfig(java.util.Hashtable newconf){ synchronized(config){ for(java.util.Enumeration e=newconf.keys() ; e.hasMoreElements() ;) { - String newkey=(String)(e.nextElement()); - String key=(newkey.equalsIgnoreCase("PubkeyAcceptedKeyTypes") ? "PubkeyAcceptedAlgorithms" : newkey); - config.put(key, (String)(newconf.get(newkey))); + String newkey=(String)(e.nextElement()); + String key=(newkey.equalsIgnoreCase("PubkeyAcceptedKeyTypes") ? "PubkeyAcceptedAlgorithms" : newkey); + config.put(key, (String)(newconf.get(newkey))); } } } diff --git a/java/com/jcraft/jsch/JSchAuthCancelException.java b/java/com/jcraft/jsch/JSchAuthCancelException.java index 394509915..34adcafe2 100644 --- a/java/com/jcraft/jsch/JSchAuthCancelException.java +++ b/java/com/jcraft/jsch/JSchAuthCancelException.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/JSchException.java b/java/com/jcraft/jsch/JSchException.java index a8942277c..ce8ecadc8 100644 --- a/java/com/jcraft/jsch/JSchException.java +++ b/java/com/jcraft/jsch/JSchException.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/JSchPartialAuthException.java b/java/com/jcraft/jsch/JSchPartialAuthException.java index e6fb2770e..5e051894a 100644 --- a/java/com/jcraft/jsch/JSchPartialAuthException.java +++ b/java/com/jcraft/jsch/JSchPartialAuthException.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/KeyExchange.java b/java/com/jcraft/jsch/KeyExchange.java index fee902c00..1ab157a86 100644 --- a/java/com/jcraft/jsch/KeyExchange.java +++ b/java/com/jcraft/jsch/KeyExchange.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -71,8 +71,8 @@ public abstract class KeyExchange{ protected byte[] H=null; protected byte[] K_S=null; - public abstract void init(Session session, - byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception; + public abstract void init(Session session, + byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception; public abstract boolean next(Buffer buf) throws Exception; public abstract int getState(); @@ -132,39 +132,39 @@ protected static String[] guess(Session session, byte[]I_S, byte[]I_C){ loop: while(jclient"+ " "+guess[PROPOSAL_ENC_ALGS_STOC]+ " "+guess[PROPOSAL_MAC_ALGS_STOC]+ " "+guess[PROPOSAL_COMP_ALGS_STOC]); - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "kex: client->server"+ " "+guess[PROPOSAL_ENC_ALGS_CTOS]+ " "+guess[PROPOSAL_MAC_ALGS_CTOS]+ @@ -219,7 +219,7 @@ protected boolean verify(String alg, byte[] K_S, int index, type=RSA; key_alg_name=alg; - + j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); tmp=new byte[j]; System.arraycopy(K_S, i, tmp, 0, j); i+=j; @@ -228,7 +228,7 @@ protected boolean verify(String alg, byte[] K_S, int index, ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); tmp=new byte[j]; System.arraycopy(K_S, i, tmp, 0, j); i+=j; n=tmp; - + SignatureRSA sig=null; Buffer buf=new Buffer(sig_of_H); String foo=Util.byte2str(buf.getString()); @@ -240,12 +240,12 @@ protected boolean verify(String alg, byte[] K_S, int index, catch(Exception e){ System.err.println(e); } - sig.setPubKey(ee, n); + sig.setPubKey(ee, n); sig.update(H); result=sig.verify(sig_of_H); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "ssh_rsa_verify: signature "+result); } } @@ -255,12 +255,12 @@ else if(alg.equals("ssh-dss")){ byte[] p; byte[] g; byte[] f; - + type=DSS; key_alg_name=alg; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| - ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); + ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); tmp=new byte[j]; System.arraycopy(K_S, i, tmp, 0, j); i+=j; p=tmp; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| @@ -268,7 +268,7 @@ else if(alg.equals("ssh-dss")){ tmp=new byte[j]; System.arraycopy(K_S, i, tmp, 0, j); i+=j; q=tmp; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| - ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); + ((K_S[i++]<<8)&0x0000ff00)|((K_S[i++])&0x000000ff); tmp=new byte[j]; System.arraycopy(K_S, i, tmp, 0, j); i+=j; g=tmp; j=((K_S[i++]<<24)&0xff000000)|((K_S[i++]<<16)&0x00ff0000)| @@ -285,12 +285,12 @@ else if(alg.equals("ssh-dss")){ catch(Exception e){ System.err.println(e); } - sig.setPubKey(f, p, q, g); + sig.setPubKey(f, p, q, g); sig.update(H); result=sig.verify(sig_of_H); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "ssh_dss_verify: signature "+result); } } @@ -301,7 +301,7 @@ else if(alg.equals("ecdsa-sha2-nistp256") || byte[] r; byte[] s; - // RFC 5656, + // RFC 5656, type=ECDSA; key_alg_name=alg; @@ -368,7 +368,7 @@ else if(alg.equals("ssh-ed25519")) { } else{ System.err.println("unknown alg"); - } + } return result; } diff --git a/java/com/jcraft/jsch/KeyPair.java b/java/com/jcraft/jsch/KeyPair.java index f3521d1f7..46414e78b 100644 --- a/java/com/jcraft/jsch/KeyPair.java +++ b/java/com/jcraft/jsch/KeyPair.java @@ -11,8 +11,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -117,7 +117,7 @@ public KeyPair(JSch jsch){ /** * Writes the plain private key to the given output stream. - * @param out output stream + * @param out output stream * @see #writePrivateKey(java.io.OutputStream out, byte[] passphrase) */ public void writePrivateKey(java.io.OutputStream out){ @@ -126,7 +126,7 @@ public void writePrivateKey(java.io.OutputStream out){ /** * Writes the cyphered private key to the given output stream. - * @param out output stream + * @param out output stream * @param passphrase a passphrase to encrypt the private key */ public void writePrivateKey(java.io.OutputStream out, byte[] passphrase){ @@ -144,26 +144,26 @@ public void writePrivateKey(java.io.OutputStream out, byte[] passphrase){ try{ out.write(getBegin()); out.write(cr); if(passphrase!=null){ - out.write(header[0]); out.write(cr); - out.write(header[1]); - for(int i=0; i>>4)&0x0f))); - out.write(b2a((byte)(iv[i]&0x0f))); - } + out.write(header[0]); out.write(cr); + out.write(header[1]); + for(int i=0; i>>4)&0x0f))); + out.write(b2a((byte)(iv[i]&0x0f))); + } + out.write(cr); out.write(cr); - out.write(cr); } int i=0; while(i 8 ? 8: iv.length); - tmp=hash.digest(); - System.arraycopy(tmp, 0, hn, index, tmp.length); - index+=tmp.length; - } - System.arraycopy(hn, 0, key, 0, key.length); + tmp=hash.digest(); + System.arraycopy(tmp, 0, hn, index, tmp.length); + index+=tmp.length; + } + System.arraycopy(hn, 0, key, 0, key.length); } else if(vendor==VENDOR_FSECURE){ - for(int index=0; index+hsize<=hn.length;){ - if(tmp!=null){ hash.update(tmp, 0, tmp.length); } - hash.update(passphrase, 0, passphrase.length); - tmp=hash.digest(); - System.arraycopy(tmp, 0, hn, index, tmp.length); - index+=tmp.length; - } - System.arraycopy(hn, 0, key, 0, key.length); + for(int index=0; index+hsize<=hn.length;){ + if(tmp!=null){ hash.update(tmp, 0, tmp.length); } + hash.update(passphrase, 0, passphrase.length); + tmp=hash.digest(); + System.arraycopy(tmp, 0, hn, index, tmp.length); + index+=tmp.length; + } + System.arraycopy(hn, 0, key, 0, key.length); } else if(vendor==VENDOR_PUTTY){ Class c=Class.forName(JSch.getConfig("sha-1")); @@ -484,7 +484,7 @@ else if(vendor==VENDOR_PUTTY){ System.err.println(e); } return key; - } + } /** * @deprecated use #writePrivateKey(java.io.OutputStream out, byte[] passphrase) @@ -504,7 +504,7 @@ public void setPassphrase(String passphrase){ */ @Deprecated public void setPassphrase(byte[] passphrase){ - if(passphrase!=null && passphrase.length==0) + if(passphrase!=null && passphrase.length==0) passphrase=null; this.passphrase=passphrase; } @@ -568,7 +568,7 @@ public static KeyPair load(JSch jsch, String prvfile, String pubfile) throws JSc pubkey = Util.fromFile(_pubfile); } catch(IOException e){ - if(pubfile!=null){ + if(pubfile!=null){ throw new JSchException(e.toString(), (Throwable)e); } } @@ -598,7 +598,7 @@ public static KeyPair load(JSch jsch, byte[] prvkey, byte[] pubkey) throws JSchE // prvkey from "ssh-add" command on the remote. if(pubkey==null && - prvkey!=null && + prvkey!=null && (prvkey.length>11 && prvkey[0]==0 && prvkey[1]==0 && prvkey[2]==0 && // length of key type string @@ -644,8 +644,8 @@ else if(_type.equals("ssh-ed25519")){ // skip garbage lines. while(i= len) - throw new JSchException("invalid privatekey: "+prvkey); + throw new JSchException("invalid privatekey: "+prvkey); if(buf[i]=='D'&& buf[i+1]=='S'&& buf[i+2]=='A'){ type=DSA; } - else if(buf[i]=='R'&& buf[i+1]=='S'&& buf[i+2]=='A'){ type=RSA; } - else if(buf[i]=='E'&& buf[i+1]=='C'){ type=ECDSA; } - else if(buf[i]=='S'&& buf[i+1]=='S'&& buf[i+2]=='H'){ // FSecure - type=UNKNOWN; - vendor=VENDOR_FSECURE; - } - else if(i+6 < len && + else if(buf[i]=='R'&& buf[i+1]=='S'&& buf[i+2]=='A'){ type=RSA; } + else if(buf[i]=='E'&& buf[i+1]=='C'){ type=ECDSA; } + else if(buf[i]=='S'&& buf[i+1]=='S'&& buf[i+2]=='H'){ // FSecure + type=UNKNOWN; + vendor=VENDOR_FSECURE; + } + else if(i+6 < len && buf[i]=='P' && buf[i+1]=='R' && buf[i+2]=='I' && buf[i+3]=='V' && buf[i+4]=='A' && buf[i+5]=='T' && buf[i+6]=='E'){ - type=UNKNOWN; - vendor=VENDOR_PKCS8; + type=UNKNOWN; + vendor=VENDOR_PKCS8; encrypted=false; i+=3; - } - else if(i+8 < len && + } + else if(i+8 < len && buf[i]=='E' && buf[i+1]=='N' && buf[i+2]=='C' && buf[i+3]=='R' && buf[i+4]=='Y' && buf[i+5]=='P' && buf[i+6]=='T' && buf[i+7]=='E' && buf[i+8]=='D'){ - type=UNKNOWN; - vendor=VENDOR_PKCS8; + type=UNKNOWN; + vendor=VENDOR_PKCS8; i+=5; - } else if (isOpenSSHPrivateKey(buf, i, len)) { - type = UNKNOWN; - vendor = VENDOR_OPENSSH_V1; - } else { - throw new JSchException("invalid privatekey: "+prvkey); - } + } else if (isOpenSSHPrivateKey(buf, i, len)) { + type = UNKNOWN; + vendor = VENDOR_OPENSSH_V1; + } else { + throw new JSchException("invalid privatekey: "+prvkey); + } i+=3; - continue; - } - if(buf[i]=='A'&& i+7 0) data=Util.fromBase64(_buf, start, i-start); @@ -812,36 +812,36 @@ else if(i+8 < len && if(data!=null && data.length>4 && // FSecure - data[0]==(byte)0x3f && - data[1]==(byte)0x6f && - data[2]==(byte)0xf9 && - data[3]==(byte)0xeb){ - - Buffer _buf=new Buffer(data); - _buf.getInt(); // 0x3f6ff9be - _buf.getInt(); - byte[]_type=_buf.getString(); - //System.err.println("type: "+new String(_type)); - String _cipher=Util.byte2str(_buf.getString()); - //System.err.println("cipher: "+_cipher); - if(_cipher.equals("3des-cbc")){ - _buf.getInt(); - byte[] foo=new byte[data.length-_buf.getOffSet()]; - _buf.getByte(foo); - data=foo; - encrypted=true; - throw new JSchException("unknown privatekey format: "+prvkey); - } - else if(_cipher.equals("none")){ - _buf.getInt(); - _buf.getInt(); + data[0]==(byte)0x3f && + data[1]==(byte)0x6f && + data[2]==(byte)0xf9 && + data[3]==(byte)0xeb){ + + Buffer _buf=new Buffer(data); + _buf.getInt(); // 0x3f6ff9be + _buf.getInt(); + byte[]_type=_buf.getString(); + //System.err.println("type: "+new String(_type)); + String _cipher=Util.byte2str(_buf.getString()); + //System.err.println("cipher: "+_cipher); + if(_cipher.equals("3des-cbc")){ + _buf.getInt(); + byte[] foo=new byte[data.length-_buf.getOffSet()]; + _buf.getByte(foo); + data=foo; + encrypted=true; + throw new JSchException("unknown privatekey format: "+prvkey); + } + else if(_cipher.equals("none")){ + _buf.getInt(); + _buf.getInt(); encrypted=false; - byte[] foo=new byte[data.length-_buf.getOffSet()]; - _buf.getByte(foo); - data=foo; - } + byte[] foo=new byte[data.length-_buf.getOffSet()]; + _buf.getByte(foo); + data=foo; + } } // OPENSSH V1 PRIVATE KEY else if (data != null && @@ -882,66 +882,66 @@ else if (data != null && } if(pubkey!=null){ - try{ - buf=pubkey; + try{ + buf=pubkey; len=buf.length; - if(buf.length>4 && // FSecure's public key - buf[0]=='-' && buf[1]=='-' && buf[2]=='-' && buf[3]=='-'){ - - boolean valid=true; - i=0; - do{i++;}while(buf.length>i && buf[i]!=0x0a); - if(buf.length<=i) {valid=false;} - - while(valid){ - if(buf[i]==0x0a){ - boolean inheader=false; - for(int j=i+1; j4 && // FSecure's public key + buf[0]=='-' && buf[1]=='-' && buf[2]=='-' && buf[3]=='-'){ + + boolean valid=true; + i=0; + do{i++;}while(buf.length>i && buf[i]!=0x0a); + if(buf.length<=i) {valid=false;} + + while(valid){ + if(buf[i]==0x0a){ + boolean inheader=false; + for(int j=i+1; j7){ - if(buf[4]=='d'){ type=DSA; } - else if(buf[4]=='r'){ type=RSA; } - else if(buf[4]=='e'){ type=ED25519; } + if(buf[4]=='d'){ type=DSA; } + else if(buf[4]=='r'){ type=RSA; } + else if(buf[4]=='e'){ type=ED25519; } + } + i=0; + while(i7){ type=ECDSA; @@ -969,12 +969,12 @@ else if(buf[0]=='e'&& buf[1]=='c'&& buf[2]=='d' && buf[3]=='s'){ if(start1024*10) break; // too long... byte[] newbuf=new byte[buf.length*2]; @@ -90,38 +90,38 @@ void setKnownHosts(InputStream input) throws JSchException{ buf=newbuf; } buf[bufl++]=(byte)j; - } + } - j=0; + j=0; while(j=bufl){ - addInvalidLine(Util.byte2str(buf, 0, bufl)); - continue loop; - } + if(i==' '||i=='\t'){ j++; continue; } + if(i=='#'){ + addInvalidLine(Util.byte2str(buf, 0, bufl)); + continue loop; + } + break; + } + if(j>=bufl){ + addInvalidLine(Util.byte2str(buf, 0, bufl)); + continue loop; + } sb.setLength(0); while(j=bufl || host.length()==0){ - addInvalidLine(Util.byte2str(buf, 0, bufl)); - continue loop; - } + } + host=sb.toString(); + if(j>=bufl || host.length()==0){ + addInvalidLine(Util.byte2str(buf, 0, bufl)); + continue loop; + } while(j=bufl || host.length()==0){ addInvalidLine(Util.byte2str(buf, 0, bufl)); - continue loop; + continue loop; } while(j=bufl){ - addInvalidLine(Util.byte2str(buf, 0, bufl)); - continue loop; - } + } + String tmp = sb.toString(); + if(HostKey.name2type(tmp)!=HostKey.UNKNOWN){ + type=HostKey.name2type(tmp); + } + else { j=bufl; } + if(j>=bufl){ + addInvalidLine(Util.byte2str(buf, 0, bufl)); + continue loop; + } while(jCompressionLevel *

  • ForwardAgent
  • *
  • RequestTTY
  • - *
  • ServerAliveInterval
  • + *
  • ServerAliveInterval
  • *
  • LocalForward
  • *
  • RemoteForward
  • *
  • ClearAllForwardings
  • @@ -287,7 +287,7 @@ private String[] multiFind(String key) { } } } - String[] result = new String[value.size()]; + String[] result = new String[value.size()]; value.toArray(result); return result; } diff --git a/java/com/jcraft/jsch/PBKDF.java b/java/com/jcraft/jsch/PBKDF.java index 44619a37e..daae6eb02 100644 --- a/java/com/jcraft/jsch/PBKDF.java +++ b/java/com/jcraft/jsch/PBKDF.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/Packet.java b/java/com/jcraft/jsch/Packet.java index 0a9a5c132..3ab8a3c4f 100644 --- a/java/com/jcraft/jsch/Packet.java +++ b/java/com/jcraft/jsch/Packet.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,7 +35,7 @@ public class Packet{ static void setRandom(Random foo){ random=foo;} Buffer buffer; - byte[] ba4=new byte[4]; + byte[] ba4=new byte[4]; public Packet(Buffer buffer){ this.buffer=buffer; } @@ -90,9 +90,9 @@ int shift(int len, int bsize, int mac){ //if(buffer.buffer.length=0){ foo=in.read(); if(foo!=13) continue; foo=in.read(); if(foo!=10) continue; - foo=in.read(); if(foo!=13) continue; + foo=in.read(); if(foo!=13) continue; foo=in.read(); if(foo!=10) continue; break; } diff --git a/java/com/jcraft/jsch/ProxySOCKS4.java b/java/com/jcraft/jsch/ProxySOCKS4.java index 76dcb04f6..05d25246e 100644 --- a/java/com/jcraft/jsch/ProxySOCKS4.java +++ b/java/com/jcraft/jsch/ProxySOCKS4.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -53,8 +53,8 @@ public ProxySOCKS4(String proxy_host){ String host=proxy_host; if(proxy_host.indexOf(':')!=-1){ try{ - host=proxy_host.substring(0, proxy_host.indexOf(':')); - port=Integer.parseInt(proxy_host.substring(proxy_host.indexOf(':')+1)); + host=proxy_host.substring(0, proxy_host.indexOf(':')); + port=Integer.parseInt(proxy_host.substring(proxy_host.indexOf(':')+1)); } catch(Exception e){ } @@ -74,7 +74,7 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim try{ if(socket_factory==null){ socket=Util.createSocket(proxy_host, proxy_port, timeout); - //socket=new Socket(proxy_host, proxy_port); + //socket=new Socket(proxy_host, proxy_port); in=socket.getInputStream(); out=socket.getOutputStream(); } @@ -93,22 +93,22 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim /* 1) CONNECT - + The client connects to the SOCKS server and sends a CONNECT request when it wants to establish a connection to an application server. The client includes in the request packet the IP address and the port number of the destination host, and userid, in the following format. - + +----+----+----+----+----+----+----+----+----+----+....+----+ | VN | CD | DSTPORT | DSTIP | USERID |NULL| +----+----+----+----+----+----+----+----+----+----+....+----+ # of bytes: 1 1 2 4 variable 1 - + VN is the SOCKS protocol version number and should be 4. CD is the SOCKS command code and should be 1 for CONNECT request. NULL is a byte of all zero bits. */ - + index=0; buf[index++]=4; buf[index++]=1; @@ -141,23 +141,23 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim consulting IDENT, cf. RFC 1413. If the request is granted, the SOCKS server makes a connection to the specified port of the destination host. A reply packet is sent to the client when this connection is established, - or when the request is rejected or the operation fails. - + or when the request is rejected or the operation fails. + +----+----+----+----+----+----+----+----+ | VN | CD | DSTPORT | DSTIP | +----+----+----+----+----+----+----+----+ # of bytes: 1 1 2 4 - + VN is the version of the reply code and should be 0. CD is the result code with one of the following values: - + 90: request granted 91: request rejected or failed 92: request rejected becasue SOCKS server cannot connect to identd on the client 93: request rejected because the client program and identd report different user-ids - + The remaining fields are ignored. */ @@ -175,8 +175,8 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim } if(buf[1]!=90){ try{ socket.close(); } - catch(Exception eee){ - } + catch(Exception eee){ + } String message="ProxySOCKS4: server returns CD "+buf[1]; throw new JSchException(message); } diff --git a/java/com/jcraft/jsch/ProxySOCKS5.java b/java/com/jcraft/jsch/ProxySOCKS5.java index 7c3f8e9a4..145f6a945 100644 --- a/java/com/jcraft/jsch/ProxySOCKS5.java +++ b/java/com/jcraft/jsch/ProxySOCKS5.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -29,8 +29,8 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING /* This file depends on following documents, - - RFC 1928 SOCKS Protocol Verseion 5 - - RFC 1929 Username/Password Authentication for SOCKS V5. + - RFC 1928 SOCKS Protocol Verseion 5 + - RFC 1929 Username/Password Authentication for SOCKS V5. */ package com.jcraft.jsch; @@ -53,8 +53,8 @@ public ProxySOCKS5(String proxy_host){ String host=proxy_host; if(proxy_host.indexOf(':')!=-1){ try{ - host=proxy_host.substring(0, proxy_host.indexOf(':')); - port=Integer.parseInt(proxy_host.substring(proxy_host.indexOf(':')+1)); + host=proxy_host.substring(0, proxy_host.indexOf(':')); + port=Integer.parseInt(proxy_host.substring(proxy_host.indexOf(':')+1)); } catch(Exception e){ } @@ -74,7 +74,7 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim try{ if(socket_factory==null){ socket=Util.createSocket(proxy_host, proxy_port, timeout); - //socket=new Socket(proxy_host, proxy_port); + //socket=new Socket(proxy_host, proxy_port); in=socket.getInputStream(); out=socket.getOutputStream(); } @@ -132,7 +132,7 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim */ //in.read(buf, 0, 2); fill(in, buf, 2); - + boolean check=false; switch((buf[1])&0xff){ case 0: // NO AUTHENTICATION REQUIRED @@ -163,11 +163,11 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim index=0; buf[index++]=1; buf[index++]=(byte)(user.length()); - System.arraycopy(Util.str2byte(user), 0, buf, index, user.length()); - index+=user.length(); + System.arraycopy(Util.str2byte(user), 0, buf, index, user.length()); + index+=user.length(); buf[index++]=(byte)(passwd.length()); - System.arraycopy(Util.str2byte(passwd), 0, buf, index, passwd.length()); - index+=passwd.length(); + System.arraycopy(Util.str2byte(passwd), 0, buf, index, passwd.length()); + index+=passwd.length(); out.write(buf, 0, index); @@ -195,8 +195,8 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim if(!check){ try{ socket.close(); } - catch(Exception eee){ - } + catch(Exception eee){ + } throw new JSchException("fail in SOCKS5 proxy"); } @@ -225,7 +225,7 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim o DST.PORT desired destination port in network octet order */ - + index=0; buf[index++]=5; buf[index++]=1; // CONNECT @@ -282,8 +282,8 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim if(buf[1]!=0){ try{ socket.close(); } - catch(Exception eee){ - } + catch(Exception eee){ + } throw new JSchException("ProxySOCKS5: server returns "+buf[1]); } @@ -291,13 +291,13 @@ public void connect(SocketFactory socket_factory, String host, int port, int tim case 1: //in.read(buf, 0, 6); fill(in, buf, 6); - break; + break; case 3: //in.read(buf, 0, 1); fill(in, buf, 1); //in.read(buf, 0, buf[0]+2); fill(in, buf, (buf[0]&0xff)+2); - break; + break; case 4: //in.read(buf, 0, 18); fill(in, buf, 18); diff --git a/java/com/jcraft/jsch/README b/java/com/jcraft/jsch/README index d00a21924..e19d52b9d 100644 --- a/java/com/jcraft/jsch/README +++ b/java/com/jcraft/jsch/README @@ -11,8 +11,8 @@ Last modified: Thu Mar 18 13:58:16 UTC 2015 Description =========== -JSch is a pure Java implementation of SSH2. JSch allows you to -connect to an sshd server and use port forwarding, X11 forwarding, +JSch is a pure Java implementation of SSH2. JSch allows you to +connect to an sshd server and use port forwarding, X11 forwarding, file transfer, etc., and you can integrate its functionality into your own Java programs. JSch is licensed under BSD style license. @@ -20,7 +20,7 @@ into your own Java programs. JSch is licensed under BSD style license. Documentation ============= * README files all over the source tree have info related to the stuff - in the directories. + in the directories. * ChangeLog: what changed from the previous version? @@ -36,7 +36,7 @@ Why JSch? Our intension in developing this stuff is to enable users of our pure java X servers, WiredX(http://wiredx.net/) and WeirdX, to enjoy secure X sessions. Our efforts have mostly targeted the SSH2 protocol in relation -to X Window System and X11 forwarding. Of course, we are also interested in +to X Window System and X11 forwarding. Of course, we are also interested in adding other functionality - port forward, file transfer, terminal emulation, etc. @@ -96,16 +96,16 @@ This archive does not include java byte code, so please compile the source code by your self. $ cd jsch-?.?.?/src $ javac com/jcraft/jsch/*java com/jcraft/jsch/jce/*java com/jcraft/jzlib/*.java -'/examples/' directory has included some samples to demonstrate what +'/examples/' directory has included some samples to demonstrate what JSch can do. Please refer to '/examples/README' file. AES cipher ========== JSch supports aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr, -aes256-ctr but you require AES support in your J2SE to choose some of them. -If you are using Sun's J2SE, J2SE 1.4.2 or later is required. -And then, J2SE 1.4.2(or later) does not support aes256 by the default, +aes256-ctr but you require AES support in your J2SE to choose some of them. +If you are using Sun's J2SE, J2SE 1.4.2 or later is required. +And then, J2SE 1.4.2(or later) does not support aes256 by the default, because of 'import control restrictions of some countries'. We have confirmed that by applying "Java Cryptography Extension (JCE) @@ -174,11 +174,11 @@ Current release has supported following properties, If this property is set to ``yes'', jsch will never automatically add host keys to the $HOME/.ssh/known_hosts file, and refuses to connect to hosts whose host key has changed. This property forces the user - to manually add all new hosts. If this property is set to ``no'', + to manually add all new hosts. If this property is set to ``no'', jsch will automatically add new host keys to the user known hosts files. If this property is set to ``ask'', new host keys will be - added to the user known host files only after the user has confirmed - that is what they really want to do, and jsch will refuse to connect + added to the user known host files only after the user has confirmed + that is what they really want to do, and jsch will refuse to connect to hosts whose host key has changed. @@ -207,7 +207,7 @@ without several help. Thanks to newly added functionalities to J2SE 1.4.0, we could start this project. * We appreciate the OpenSSH project. - The options '-ddd' of sshd, '---vvv' of ssh and the compile options + The options '-ddd' of sshd, '---vvv' of ssh and the compile options '-DPACKET_DEBUG', '-DDEBUG_KEXDH' and '-DDEBUG_KEX' were very useful in debugging JSch. * We appreciate IETF sesch working group and SSH Communications Security Corp. @@ -217,11 +217,11 @@ without several help. who are interpreting drafts of SSH2 protocol in Japanese. His works were very useful for us to understand the technical terms in our native language. -* We also appreciate SourceForge.net's awesome service to the +* We also appreciate SourceForge.net's awesome service to the Open Source Community. -If you have any comments, suggestions and questions, write us +If you have any comments, suggestions and questions, write us at jsch@jcraft.com diff --git a/java/com/jcraft/jsch/Random.java b/java/com/jcraft/jsch/Random.java index 29e5fe5ad..854688c77 100644 --- a/java/com/jcraft/jsch/Random.java +++ b/java/com/jcraft/jsch/Random.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/Request.java b/java/com/jcraft/jsch/Request.java index a3bca8f82..a664793df 100644 --- a/java/com/jcraft/jsch/Request.java +++ b/java/com/jcraft/jsch/Request.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -51,9 +51,9 @@ void write(Packet packet) throws Exception{ long start=System.currentTimeMillis(); long timeout=channel.connectTimeout; while(channel.isConnected() && channel.reply==-1){ - try{Thread.sleep(10);} - catch(Exception ee){ - } + try{Thread.sleep(10);} + catch(Exception ee){ + } if(timeout>0L && (System.currentTimeMillis()-start)>timeout){ channel.reply=0; @@ -62,7 +62,7 @@ void write(Packet packet) throws Exception{ } if(channel.reply==0){ - throw new JSchException("failed to send channel request"); + throw new JSchException("failed to send channel request"); } } } diff --git a/java/com/jcraft/jsch/RequestAgentForwarding.java b/java/com/jcraft/jsch/RequestAgentForwarding.java index 9528c19cc..485d2b3aa 100644 --- a/java/com/jcraft/jsch/RequestAgentForwarding.java +++ b/java/com/jcraft/jsch/RequestAgentForwarding.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/RequestEnv.java b/java/com/jcraft/jsch/RequestEnv.java index afc4d7020..35cd4feff 100644 --- a/java/com/jcraft/jsch/RequestEnv.java +++ b/java/com/jcraft/jsch/RequestEnv.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/RequestExec.java b/java/com/jcraft/jsch/RequestExec.java index 44e41a7d5..6d54db599 100644 --- a/java/com/jcraft/jsch/RequestExec.java +++ b/java/com/jcraft/jsch/RequestExec.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/RequestPtyReq.java b/java/com/jcraft/jsch/RequestPtyReq.java index 63b3125b8..c5b1e1395 100644 --- a/java/com/jcraft/jsch/RequestPtyReq.java +++ b/java/com/jcraft/jsch/RequestPtyReq.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -44,7 +44,7 @@ void setCode(String cookie){ void setTType(String ttype){ this.ttype=ttype; } - + void setTerminalMode(byte[] terminal_mode){ this.terminal_mode=terminal_mode; } diff --git a/java/com/jcraft/jsch/RequestSftp.java b/java/com/jcraft/jsch/RequestSftp.java index 3ad5166bd..c45a3800f 100644 --- a/java/com/jcraft/jsch/RequestSftp.java +++ b/java/com/jcraft/jsch/RequestSftp.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/RequestShell.java b/java/com/jcraft/jsch/RequestShell.java index 12ef31bf5..623fe6a42 100644 --- a/java/com/jcraft/jsch/RequestShell.java +++ b/java/com/jcraft/jsch/RequestShell.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/RequestSignal.java b/java/com/jcraft/jsch/RequestSignal.java index a5146712c..2018f0361 100644 --- a/java/com/jcraft/jsch/RequestSignal.java +++ b/java/com/jcraft/jsch/RequestSignal.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/RequestSubsystem.java b/java/com/jcraft/jsch/RequestSubsystem.java index a3edeae45..716bade3b 100644 --- a/java/com/jcraft/jsch/RequestSubsystem.java +++ b/java/com/jcraft/jsch/RequestSubsystem.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/RequestWindowChange.java b/java/com/jcraft/jsch/RequestWindowChange.java index d465f40cf..46431da0f 100644 --- a/java/com/jcraft/jsch/RequestWindowChange.java +++ b/java/com/jcraft/jsch/RequestWindowChange.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,8 +35,8 @@ class RequestWindowChange extends Request{ int width_pixels=640; int height_pixels=480; void setSize(int col, int row, int wp, int hp){ - this.width_columns=col; - this.height_rows=row; + this.width_columns=col; + this.height_rows=row; this.width_pixels=wp; this.height_pixels=hp; } diff --git a/java/com/jcraft/jsch/RequestX11.java b/java/com/jcraft/jsch/RequestX11.java index 3c87179aa..86177d902 100644 --- a/java/com/jcraft/jsch/RequestX11.java +++ b/java/com/jcraft/jsch/RequestX11.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/ServerSocketFactory.java b/java/com/jcraft/jsch/ServerSocketFactory.java index 7c0467add..813abe376 100644 --- a/java/com/jcraft/jsch/ServerSocketFactory.java +++ b/java/com/jcraft/jsch/ServerSocketFactory.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/Session.java b/java/com/jcraft/jsch/Session.java index d735321be..5c64b135b 100644 --- a/java/com/jcraft/jsch/Session.java +++ b/java/com/jcraft/jsch/Session.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -201,10 +201,10 @@ public void connect(int connectTimeout) throws JSchException{ io=new IO(); if(random==null){ try{ - Class c=Class.forName(getConfig("random")); + Class c=Class.forName(getConfig("random")); random=(Random)(c.getDeclaredConstructor().newInstance()); } - catch(Exception e){ + catch(Exception e){ throw new JSchException(e.toString(), e); } } @@ -215,34 +215,34 @@ public void connect(int connectTimeout) throws JSchException{ "Connecting to "+host+" port "+port+" with username "+username); } - try { + try { int i, j; if(proxy==null){ InputStream in; OutputStream out; - if(socket_factory==null){ + if(socket_factory==null){ socket=Util.createSocket(host, port, connectTimeout); - in=socket.getInputStream(); - out=socket.getOutputStream(); - } - else{ + in=socket.getInputStream(); + out=socket.getOutputStream(); + } + else{ socket=socket_factory.createSocket(host, port); - in=socket_factory.getInputStream(socket); - out=socket_factory.getOutputStream(socket); - } - //if(timeout>0){ socket.setSoTimeout(timeout); } + in=socket_factory.getInputStream(socket); + out=socket_factory.getOutputStream(socket); + } + //if(timeout>0){ socket.setSoTimeout(timeout); } socket.setTcpNoDelay(true); io.setInputStream(in); io.setOutputStream(out); } else{ - synchronized(proxy){ + synchronized(proxy){ proxy.connect(socket_factory, host, port, connectTimeout); - io.setInputStream(proxy.getInputStream()); - io.setOutputStream(proxy.getOutputStream()); + io.setInputStream(proxy.getInputStream()); + io.setOutputStream(proxy.getOutputStream()); socket=proxy.getSocket(); - } + } } if(connectTimeout>0 && socket!=null){ @@ -252,18 +252,18 @@ public void connect(int connectTimeout) throws JSchException{ isConnected=true; if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "Connection established"); } jsch.addSession(this); { - // Some Cisco devices will miss to read '\n' if it is sent separately. - byte[] foo=new byte[V_C.length+1]; - System.arraycopy(V_C, 0, foo, 0, V_C.length); - foo[foo.length-1]=(byte)'\n'; - io.put(foo, 0, foo.length); + // Some Cisco devices will miss to read '\n' if it is sent separately. + byte[] foo=new byte[V_C.length+1]; + System.arraycopy(V_C, 0, foo, 0, V_C.length); + foo[foo.length-1]=(byte)'\n'; + io.put(foo, 0, foo.length); } while(true){ @@ -272,7 +272,7 @@ public void connect(int connectTimeout) throws JSchException{ while(i= max_auth_tries){ if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "Login trials exceeds "+max_auth_tries); } } @@ -611,7 +611,7 @@ private KeyExchange receive_kexinit(Buffer buf) throws Exception { Class c=Class.forName(getConfig(guess[KeyExchange.PROPOSAL_KEX_ALGS])); kex=(KeyExchange)(c.getDeclaredConstructor().newInstance()); } - catch(Exception e){ + catch(Exception e){ throw new JSchException(e.toString(), e); } @@ -707,7 +707,7 @@ private void send_kexinit() throws Exception { write(packet); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "SSH_MSG_KEXINIT sent"); } } @@ -719,7 +719,7 @@ private void send_newkeys() throws Exception { write(packet); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "SSH_MSG_NEWKEYS sent"); } } @@ -761,7 +761,7 @@ private void checkHost(String chost, int port, KeyExchange kex) throws JSchExcep i==HostKeyRepository.CHANGED){ String file=null; synchronized(hkr){ - file=hkr.getKnownHostsRepositoryID(); + file=hkr.getKnownHostsRepositoryID(); } if(file==null){file="known_hosts";} @@ -792,7 +792,7 @@ private void checkHost(String chost, int port, KeyExchange kex) throws JSchExcep } synchronized(hkr){ - hkr.remove(chost, + hkr.remove(chost, kex.getKeyAlgorithName(), null); insert=true; @@ -802,29 +802,29 @@ private void checkHost(String chost, int port, KeyExchange kex) throws JSchExcep if((shkc.equalsIgnoreCase("ask") || shkc.equalsIgnoreCase("yes")) && (i!=HostKeyRepository.OK) && !insert){ if(shkc.equalsIgnoreCase("yes")){ - throw new JSchException("reject HostKey: "+host); + throw new JSchException("reject HostKey: "+host); } //System.err.println("finger-print: "+key_fprint); if(userinfo!=null){ - boolean foo=userinfo.promptYesNo( + boolean foo=userinfo.promptYesNo( "The authenticity of host '"+host+"' can't be established.\n"+ key_type+" key fingerprint is "+key_fprint+".\n"+ "Are you sure you want to continue connecting?" - ); - if(!foo){ - throw new JSchException("reject HostKey: "+host); - } - insert=true; + ); + if(!foo){ + throw new JSchException("reject HostKey: "+host); + } + insert=true; } else{ - if(i==HostKeyRepository.NOT_INCLUDED) - throw new JSchException("UnknownHostKey: "+host+". "+key_type+" key fingerprint is "+key_fprint); - else + if(i==HostKeyRepository.NOT_INCLUDED) + throw new JSchException("UnknownHostKey: "+host+". "+key_type+" key fingerprint is "+key_fprint); + else throw new JSchException("HostKey has been changed: "+host); } } - if(shkc.equalsIgnoreCase("no") && + if(shkc.equalsIgnoreCase("no") && HostKeyRepository.NOT_INCLUDED==i){ insert=true; } @@ -843,7 +843,7 @@ private void checkHost(String chost, int port, KeyExchange kex) throws JSchExcep "impersonate this host."); } if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "Host '"+host+"' has provided revoked key."); } throw new JSchException("revoked HostKey: "+host); @@ -853,19 +853,19 @@ private void checkHost(String chost, int port, KeyExchange kex) throws JSchExcep if(i==HostKeyRepository.OK && JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "Host '"+host+"' is known and matches the "+key_type+" host key"); } if(insert && JSch.getLogger().isEnabled(Logger.WARN)){ - JSch.getLogger().log(Logger.WARN, + JSch.getLogger().log(Logger.WARN, "Permanently added '"+host+"' ("+key_type+") to the list of known hosts."); } if(insert){ synchronized(hkr){ - hkr.add(hostkey, userinfo); + hkr.add(hostkey, userinfo); } } } @@ -900,7 +900,7 @@ public void encode(Packet packet) throws Exception{ //} if(deflater!=null){ compress_len[0]=packet.buffer.index; - packet.buffer.buffer=deflater.compress(packet.buffer.buffer, + packet.buffer.buffer=deflater.compress(packet.buffer.buffer, 5, compress_len); packet.buffer.index=compress_len[0]; } @@ -909,7 +909,7 @@ public void encode(Packet packet) throws Exception{ packet.padding(c2scipher_size); int pad=packet.buffer.buffer[4]; synchronized(random){ - random.fill(packet.buffer.buffer, packet.buffer.index-pad, pad); + random.fill(packet.buffer.buffer, packet.buffer.index-pad, pad); } } else{ @@ -939,7 +939,7 @@ public Buffer read(Buffer buf) throws Exception{ int j=0; while(true){ buf.reset(); - io.getByte(buf.buffer, buf.index, s2ccipher_size); + io.getByte(buf.buffer, buf.index, s2ccipher_size); buf.index+=s2ccipher_size; if(s2ccipher!=null){ s2ccipher.update(buf.buffer, 0, s2ccipher_size, buf.buffer, 0); @@ -965,48 +965,48 @@ public Buffer read(Buffer buf) throws Exception{ if((need%s2ccipher_size)!=0){ String message="Bad packet length "+need; if(JSch.getLogger().isEnabled(Logger.FATAL)){ - JSch.getLogger().log(Logger.FATAL, message); + JSch.getLogger().log(Logger.FATAL, message); } start_discard(buf, s2ccipher, s2cmac, j, PACKET_MAX_SIZE-s2ccipher_size); } if(need>0){ - io.getByte(buf.buffer, buf.index, need); buf.index+=(need); - if(s2ccipher!=null){ - s2ccipher.update(buf.buffer, s2ccipher_size, need, buf.buffer, s2ccipher_size); - } + io.getByte(buf.buffer, buf.index, need); buf.index+=(need); + if(s2ccipher!=null){ + s2ccipher.update(buf.buffer, s2ccipher_size, need, buf.buffer, s2ccipher_size); + } } if(s2cmac!=null){ - s2cmac.update(seqi); - s2cmac.update(buf.buffer, 0, buf.index); + s2cmac.update(seqi); + s2cmac.update(buf.buffer, 0, buf.index); s2cmac.doFinal(s2cmac_result1, 0); - io.getByte(s2cmac_result2, 0, s2cmac_result2.length); + io.getByte(s2cmac_result2, 0, s2cmac_result2.length); if(!java.util.Arrays.equals(s2cmac_result1, s2cmac_result2)){ if(need > PACKET_MAX_SIZE){ throw new IOException("MAC Error"); } start_discard(buf, s2ccipher, s2cmac, j, PACKET_MAX_SIZE-need); continue; - } + } } seqi++; if(inflater!=null){ //inflater.uncompress(buf); - int pad=buf.buffer[4]; - uncompress_len[0]=buf.index-5-pad; - byte[] foo=inflater.uncompress(buf.buffer, 5, uncompress_len); - if(foo!=null){ - buf.buffer=foo; - buf.index=5+uncompress_len[0]; - } - else{ - System.err.println("fail in inflater"); - break; - } + int pad=buf.buffer[4]; + uncompress_len[0]=buf.index-5-pad; + byte[] foo=inflater.uncompress(buf.buffer, 5, uncompress_len); + if(foo!=null){ + buf.buffer=foo; + buf.index=5+uncompress_len[0]; + } + else{ + System.err.println("fail in inflater"); + break; + } } int type=buf.getCommand()&0xff; @@ -1014,23 +1014,23 @@ public Buffer read(Buffer buf) throws Exception{ if(type==SSH_MSG_DISCONNECT){ buf.rewind(); buf.getInt();buf.getShort(); - int reason_code=buf.getInt(); - byte[] description=buf.getString(); - byte[] language_tag=buf.getString(); - throw new JSchException("SSH_MSG_DISCONNECT: "+ - reason_code+ - " "+Util.byte2str(description)+ - " "+Util.byte2str(language_tag)); - //break; + int reason_code=buf.getInt(); + byte[] description=buf.getString(); + byte[] language_tag=buf.getString(); + throw new JSchException("SSH_MSG_DISCONNECT: "+ + reason_code+ + " "+Util.byte2str(description)+ + " "+Util.byte2str(language_tag)); + //break; } else if(type==SSH_MSG_IGNORE){ } else if(type==SSH_MSG_UNIMPLEMENTED){ buf.rewind(); buf.getInt();buf.getShort(); - int reason_id=buf.getInt(); + int reason_id=buf.getInt(); if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "Received SSH_MSG_UNIMPLEMENTED for "+reason_id); } } @@ -1038,23 +1038,23 @@ else if(type==SSH_MSG_DEBUG){ buf.rewind(); buf.getInt();buf.getShort(); /* - byte always_display=(byte)buf.getByte(); - byte[] message=buf.getString(); - byte[] language_tag=buf.getString(); - System.err.println("SSH_MSG_DEBUG:"+ - " "+Util.byte2str(message)+ - " "+Util.byte2str(language_tag)); + byte always_display=(byte)buf.getByte(); + byte[] message=buf.getString(); + byte[] language_tag=buf.getString(); + System.err.println("SSH_MSG_DEBUG:"+ + " "+Util.byte2str(message)+ + " "+Util.byte2str(language_tag)); */ } else if(type==SSH_MSG_CHANNEL_WINDOW_ADJUST){ buf.rewind(); buf.getInt();buf.getShort(); - Channel c=Channel.getChannel(buf.getInt(), this); - if(c==null){ - } - else{ - c.addRemoteWindowSize(buf.getUInt()); - } + Channel c=Channel.getChannel(buf.getInt(), this); + if(c==null){ + } + else{ + c.addRemoteWindowSize(buf.getUInt()); + } } else if(type==UserAuth.SSH_MSG_USERAUTH_SUCCESS){ isAuthed=true; @@ -1075,7 +1075,7 @@ else if(type==UserAuth.SSH_MSG_USERAUTH_SUCCESS){ return buf; } - private void start_discard(Buffer buf, Cipher cipher, MAC mac, + private void start_discard(Buffer buf, Cipher cipher, MAC mac, int packet_length, int discard) throws JSchException, IOException{ MAC discard_mac = null; @@ -1166,7 +1166,7 @@ private void updateKeys(KeyExchange kex) throws Exception{ try{ Class c; String method; - + method=guess[KeyExchange.PROPOSAL_ENC_ALGS_STOC]; c=Class.forName(getConfig(method)); s2ccipher=(Cipher)(c.getDeclaredConstructor().newInstance()); @@ -1178,9 +1178,9 @@ private void updateKeys(KeyExchange kex) throws Exception{ hash.update(buf.buffer, 0, buf.index); byte[] foo=hash.digest(); byte[] bar=new byte[Es2c.length+foo.length]; - System.arraycopy(Es2c, 0, bar, 0, Es2c.length); - System.arraycopy(foo, 0, bar, Es2c.length, foo.length); - Es2c=bar; + System.arraycopy(Es2c, 0, bar, 0, Es2c.length); + System.arraycopy(foo, 0, bar, Es2c.length, foo.length); + Es2c=bar; } s2ccipher.init(Cipher.DECRYPT_MODE, Es2c, IVs2c); s2ccipher_size=s2ccipher.getIVSize(); @@ -1205,9 +1205,9 @@ private void updateKeys(KeyExchange kex) throws Exception{ hash.update(buf.buffer, 0, buf.index); byte[] foo=hash.digest(); byte[] bar=new byte[Ec2s.length+foo.length]; - System.arraycopy(Ec2s, 0, bar, 0, Ec2s.length); - System.arraycopy(foo, 0, bar, Ec2s.length, foo.length); - Ec2s=bar; + System.arraycopy(Ec2s, 0, bar, 0, Ec2s.length); + System.arraycopy(foo, 0, bar, Ec2s.length, foo.length); + Ec2s=bar; } c2scipher.init(Cipher.ENCRYPT_MODE, Ec2s, IVc2s); c2scipher_size=c2scipher.getIVSize(); @@ -1224,11 +1224,11 @@ private void updateKeys(KeyExchange kex) throws Exception{ method=guess[KeyExchange.PROPOSAL_COMP_ALGS_STOC]; initInflater(method); } - catch(Exception e){ + catch(Exception e){ if(e instanceof JSchException) throw e; throw new JSchException(e.toString(), e); - //System.err.println("updatekeys: "+e); + //System.err.println("updatekeys: "+e); } } @@ -1280,9 +1280,9 @@ private byte[] expandKey(Buffer buf, byte[] K, byte[] H, byte[] key, synchronized(c){ if(c.rwsize0){ - long len=c.rwsize; + if(c.rwsize>0){ + long len=c.rwsize; if(len>length){ len=length; } if(len!=length){ - s=packet.shift((int)len, + s=packet.shift((int)len, (c2scipher!=null ? c2scipher_size : 8), (c2smac!=null ? c2smac.getBlockSize() : 0)); } - command=packet.buffer.getCommand(); - recipient=c.getRecipient(); - length-=(int)len; - c.rwsize-=len; - sendit=true; - } + command=packet.buffer.getCommand(); + recipient=c.getRecipient(); + length-=(int)len; + c.rwsize-=len; + sendit=true; + } } if(sendit){ - _write(packet); + _write(packet); if(length==0){ return; } - packet.unshift(command, recipient, s, length); + packet.unshift(command, recipient, s, length); } synchronized(c){ @@ -1344,10 +1344,10 @@ private byte[] expandKey(Buffer buf, byte[] K, byte[] H, byte[] key, break; } - //try{ + //try{ //System.out.println("1wait: "+c.rwsize); // c.notifyme++; - // c.wait(100); + // c.wait(100); //} //catch(java.lang.InterruptedException e){ //} @@ -1414,7 +1414,7 @@ public void run(){ int stimeout=0; try{ while(isConnected && - thread!=null){ + thread!=null){ try{ buf=read(buf); stimeout=0; @@ -1432,149 +1432,149 @@ else if(in_kex && stimeoutlport is 0, the tcp port will be allocated. - * @param lport local port for local port forwarding + * @param lport local port for local port forwarding * @param host host address for local port forwarding * @param rport remote port number for local port forwarding * @return an allocated local TCP port number @@ -1815,7 +1815,7 @@ public int setPortForwardingL(int lport, String host, int rport) throws JSchExce * null, the listening port will be bound for local use only. * If lport is 0, the tcp port will be allocated. * @param bind_address bind address for local port forwarding - * @param lport local port for local port forwarding + * @param lport local port for local port forwarding * @param host host address for local port forwarding * @param rport remote port number for local port forwarding * @return an allocated local TCP port number @@ -1833,7 +1833,7 @@ public int setPortForwardingL(String bind_address, int lport, String host, int r * null, the listening port will be bound for local use only. * If lport is 0, the tcp port will be allocated. * @param bind_address bind address for local port forwarding - * @param lport local port for local port forwarding + * @param lport local port for local port forwarding * @param host host address for local port forwarding * @param rport remote port number for local port forwarding * @param ssf socket factory @@ -1852,12 +1852,12 @@ public int setPortForwardingL(String bind_address, int lport, String host, int r * null, the listening port will be bound for local use only. * If lport is 0, the tcp port will be allocated. * @param bind_address bind address for local port forwarding - * @param lport local port for local port forwarding + * @param lport local port for local port forwarding * @param host host address for local port forwarding * @param rport remote port number for local port forwarding * @param ssf socket factory * @param connectTimeout timeout for establishing port connection - * @return an allocated local TCP port number + * @return an allocated local TCP port number */ public int setPortForwardingL(String bind_address, int lport, String host, int rport, ServerSocketFactory ssf, int connectTimeout) throws JSchException{ PortWatcher pw=PortWatcher.addPort(this, bind_address, lport, host, rport, ssf); @@ -2013,7 +2013,7 @@ public void setPortForwardingR(int rport, String daemon, Object[] arg) throws JS * remote, "localhost" is always used as a bind_address. * The TCP connection to rport on the remote will be * forwarded to an instance of the class daemon with the - * argument arg. + * argument arg. * The class specified by daemon must implement ForwardedTCPIPDaemon. * * @param bind_address bind address @@ -2063,7 +2063,7 @@ private Forwarding parseForwarding(String conf) throws JSchException { if(i+1"*" or an empty string, * then the forwarding is requested to listen on all interfaces. @@ -2149,7 +2149,7 @@ public Channel getStreamForwarder(String host, int port) throws JSchException { channel.setHost(host); channel.setPort(port); return channel; - } + } private class GlobalRequestReply{ private Thread thread=null; @@ -2203,7 +2203,7 @@ private int _setPortForwardingR(String bind_address, int rport) throws JSchExcep try{ Thread.sleep(1000); } catch(Exception e){ } - count++; + count++; reply = grr.getReply(); } grr.setThread(null); @@ -2279,7 +2279,7 @@ private void initInflater(String method) throws JSchException{ } catch(Exception ee){ throw new JSchException(ee.toString(), ee); - //System.err.println(foo+" isn't accessible."); + //System.err.println(foo+" isn't accessible."); } } } @@ -2304,7 +2304,7 @@ public void setPassword(String password){ if(password!=null) this.password=Util.str2byte(password); } - public void setPassword(byte[] password){ + public void setPassword(byte[] password){ if(password!=null){ this.password=new byte[password.length]; System.arraycopy(password, 0, this.password, 0, password.length); @@ -2314,10 +2314,10 @@ public void setPassword(byte[] password){ public void setConfig(java.util.Properties newconf){ setConfig((java.util.Hashtable)newconf); } - + public void setConfig(java.util.Hashtable newconf){ synchronized(lock){ - if(config==null) + if(config==null) config=new java.util.Hashtable(); for(java.util.Enumeration e=newconf.keys() ; e.hasMoreElements() ;) { String newkey=(String)(e.nextElement()); @@ -2328,7 +2328,7 @@ public void setConfig(java.util.Hashtable newconf){ } public void setConfig(String key, String value){ - synchronized(lock){ + synchronized(lock){ if(config==null){ config=new java.util.Hashtable(); } @@ -2355,7 +2355,7 @@ public String getConfig(String key){ return null; } - public void setSocketFactory(SocketFactory sfactory){ + public void setSocketFactory(SocketFactory sfactory){ socket_factory=sfactory; } public boolean isConnected(){ return isConnected; } @@ -2417,7 +2417,7 @@ public void noMoreSessionChannels() throws Exception{ buf.putByte((byte)0); write(packet); } - + private HostKey hostkey=null; public HostKey getHostKey(){ return hostkey; } public String getHost(){return host;} @@ -2483,7 +2483,7 @@ private String[] checkCiphers(String ciphers){ return null; if(JSch.getLogger().isEnabled(Logger.INFO)){ - JSch.getLogger().log(Logger.INFO, + JSch.getLogger().log(Logger.INFO, "CheckCiphers: "+ciphers); } @@ -2507,7 +2507,7 @@ private String[] checkCiphers(String ciphers){ if(JSch.getLogger().isEnabled(Logger.INFO)){ for(int i=0; inull. * - * @param identityRepository + * @param identityRepository * @see #getIdentityRepository() */ public void setIdentityRepository(IdentityRepository identityRepository){ @@ -2630,9 +2630,9 @@ public IdentityRepository getIdentityRepository(){ } /** - * Sets the hostkeyRepository, which will be referred in checking host keys. + * Sets the hostkeyRepository, which will be referred in checking host keys. * - * @param hostkeyRepository + * @param hostkeyRepository * @see #getHostKeyRepository() */ public void setHostKeyRepository(HostKeyRepository hostkeyRepository){ @@ -2653,7 +2653,7 @@ public HostKeyRepository getHostKeyRepository(){ } /* - // setProxyCommand("ssh -l user2 host2 -o 'ProxyCommand ssh user1@host1 nc host2 22' nc %h %p") + // setProxyCommand("ssh -l user2 host2 -o 'ProxyCommand ssh user1@host1 nc host2 22' nc %h %p") public void setProxyCommand(String command){ setProxy(new ProxyCommand(command)); } diff --git a/java/com/jcraft/jsch/SftpATTRS.java b/java/com/jcraft/jsch/SftpATTRS.java index a871427e5..cc9f670f7 100644 --- a/java/com/jcraft/jsch/SftpATTRS.java +++ b/java/com/jcraft/jsch/SftpATTRS.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -145,33 +145,33 @@ private SftpATTRS(){ } static SftpATTRS getATTR(Buffer buf){ - SftpATTRS attr=new SftpATTRS(); + SftpATTRS attr=new SftpATTRS(); attr.flags=buf.getInt(); if((attr.flags&SSH_FILEXFER_ATTR_SIZE)!=0){ attr.size=buf.getLong(); } if((attr.flags&SSH_FILEXFER_ATTR_UIDGID)!=0){ attr.uid=buf.getInt(); attr.gid=buf.getInt(); } - if((attr.flags&SSH_FILEXFER_ATTR_PERMISSIONS)!=0){ + if((attr.flags&SSH_FILEXFER_ATTR_PERMISSIONS)!=0){ attr.permissions=buf.getInt(); } - if((attr.flags&SSH_FILEXFER_ATTR_ACMODTIME)!=0){ + if((attr.flags&SSH_FILEXFER_ATTR_ACMODTIME)!=0){ attr.atime=buf.getInt(); } - if((attr.flags&SSH_FILEXFER_ATTR_ACMODTIME)!=0){ - attr.mtime=buf.getInt(); + if((attr.flags&SSH_FILEXFER_ATTR_ACMODTIME)!=0){ + attr.mtime=buf.getInt(); } if((attr.flags&SSH_FILEXFER_ATTR_EXTENDED)!=0){ int count=buf.getInt(); if(count>0){ - attr.extended=new String[count*2]; - for(int i=0; i0){ - for(int i=0; i0){ - for(int i=0; i= session.max_auth_tries){ - return false; + return false; } // send @@ -77,55 +77,55 @@ public boolean start(Session session) throws Exception{ buf=session.read(buf); int command=buf.getCommand()&0xff; - if(command==SSH_MSG_USERAUTH_SUCCESS){ - return true; - } - if(command==SSH_MSG_USERAUTH_BANNER){ - buf.getInt(); buf.getByte(); buf.getByte(); - byte[] _message=buf.getString(); - byte[] lang=buf.getString(); - String message=Util.byte2str(_message); - if(userinfo!=null){ - userinfo.showMessage(message); - } - continue loop; - } - if(command==SSH_MSG_USERAUTH_FAILURE){ - buf.getInt(); buf.getByte(); buf.getByte(); - byte[] foo=buf.getString(); - int partial_success=buf.getByte(); -// System.err.println(new String(foo)+ -// " partial_success:"+(partial_success!=0)); - - if(partial_success!=0){ - throw new JSchPartialAuthException(Util.byte2str(foo)); - } - - if(firsttime){ - return false; - //throw new JSchException("USERAUTH KI is not supported"); - //cancel=true; // ?? - } + if(command==SSH_MSG_USERAUTH_SUCCESS){ + return true; + } + if(command==SSH_MSG_USERAUTH_BANNER){ + buf.getInt(); buf.getByte(); buf.getByte(); + byte[] _message=buf.getString(); + byte[] lang=buf.getString(); + String message=Util.byte2str(_message); + if(userinfo!=null){ + userinfo.showMessage(message); + } + continue loop; + } + if(command==SSH_MSG_USERAUTH_FAILURE){ + buf.getInt(); buf.getByte(); buf.getByte(); + byte[] foo=buf.getString(); + int partial_success=buf.getByte(); +// System.err.println(new String(foo)+ +// " partial_success:"+(partial_success!=0)); + + if(partial_success!=0){ + throw new JSchPartialAuthException(Util.byte2str(foo)); + } + + if(firsttime){ + return false; + //throw new JSchException("USERAUTH KI is not supported"); + //cancel=true; // ?? + } session.auth_failures++; - break; - } - if(command==SSH_MSG_USERAUTH_INFO_REQUEST){ - firsttime=false; - buf.getInt(); buf.getByte(); buf.getByte(); - String name=Util.byte2str(buf.getString()); - String instruction=Util.byte2str(buf.getString()); - String languate_tag=Util.byte2str(buf.getString()); - int num=buf.getInt(); - String[] prompt=new String[num]; - boolean[] echo=new boolean[num]; - for(int i=0; i= 0){ @@ -134,9 +134,9 @@ public boolean start(Session session) throws Exception{ password=null; } else if(num>0 - ||(name.length()>0 || instruction.length()>0) - ){ - if(userinfo!=null){ + ||(name.length()>0 || instruction.length()>0) + ){ + if(userinfo!=null){ UIKeyboardInteractive kbi=(UIKeyboardInteractive)userinfo; String[] _response=kbi.promptKeyboardInteractive(dest, name, @@ -149,21 +149,21 @@ else if(num>0 response[i]=Util.str2byte(_response[i]); } } - } - } - - // byte SSH_MSG_USERAUTH_INFO_RESPONSE(61) - // int num-responses - // string response[1] (ISO-10646 UTF-8) - // ... - // string response[num-responses] (ISO-10646 UTF-8) - packet.reset(); - buf.putByte((byte)SSH_MSG_USERAUTH_INFO_RESPONSE); - if(num>0 && - (response==null || // cancel - num!=response.length)){ - - if(response==null){ + } + } + + // byte SSH_MSG_USERAUTH_INFO_RESPONSE(61) + // int num-responses + // string response[1] (ISO-10646 UTF-8) + // ... + // string response[num-responses] (ISO-10646 UTF-8) + packet.reset(); + buf.putByte((byte)SSH_MSG_USERAUTH_INFO_RESPONSE); + if(num>0 && + (response==null || // cancel + num!=response.length)){ + + if(response==null){ // working around the bug in OpenSSH ;-< buf.putInt(num); for(int i=0; i0 buf.putInt(0); } - if(response==null) - cancel=true; - } - else{ - buf.putInt(num); - for(int i=0; i=0){ - bar.addElement(Util.byte2str(buf, start, index-start)); - start=index+1; - continue; + bar.addElement(Util.byte2str(buf, start, index-start)); + start=index+1; + continue; } bar.addElement(Util.byte2str(buf, start, buf.length-start)); break; @@ -134,7 +134,7 @@ static boolean glob(byte[] pattern, byte[] name){ return glob0(pattern, 0, name, 0); } static private boolean glob0(byte[] pattern, int pattern_index, - byte[] name, int name_index){ + byte[] name, int name_index){ if(name.length>0 && name[0]=='.'){ if(pattern.length>0 && pattern[0]=='.'){ if(pattern.length==2 && pattern[1]=='*') return true; @@ -145,7 +145,7 @@ static private boolean glob0(byte[] pattern, int pattern_index, return glob(pattern, pattern_index, name, name_index); } static private boolean glob(byte[] pattern, int pattern_index, - byte[] name, int name_index){ + byte[] name, int name_index){ //System.err.println("glob: "+new String(pattern)+", "+pattern_index+" "+new String(name)+", "+name_index); int patternlen=pattern.length; @@ -158,14 +158,14 @@ static private boolean glob(byte[] pattern, int pattern_index, while(i>>4)&0xf]); - System.err.print(chars[foo&0xf]); + System.err.print(chars[(foo>>>4)&0xf]); + System.err.print(chars[foo&0xf]); if(i%16==15){ System.err.println(""); - continue; - } + continue; + } if(i>0 && i%2==1){ System.err.print(" "); - } + } } System.err.println(""); } diff --git a/java/com/jcraft/jsch/agentproxy/Connector.java b/java/com/jcraft/jsch/agentproxy/Connector.java index 813a6322c..6b248d60d 100644 --- a/java/com/jcraft/jsch/agentproxy/Connector.java +++ b/java/com/jcraft/jsch/agentproxy/Connector.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/agentproxy/Identity.java b/java/com/jcraft/jsch/agentproxy/Identity.java index 645e75f6d..3e036b15d 100644 --- a/java/com/jcraft/jsch/agentproxy/Identity.java +++ b/java/com/jcraft/jsch/agentproxy/Identity.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/agentproxy/LICENSE.txt b/java/com/jcraft/jsch/agentproxy/LICENSE.txt index cf3ab47f7..6c5df5176 100644 --- a/java/com/jcraft/jsch/agentproxy/LICENSE.txt +++ b/java/com/jcraft/jsch/agentproxy/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2012 Atsuhiko Yamanaka, JCraft,Inc. +Copyright (c) 2012 Atsuhiko Yamanaka, JCraft,Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -7,8 +7,8 @@ modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/agentproxy/RemoteIdentityRepository.java b/java/com/jcraft/jsch/agentproxy/RemoteIdentityRepository.java index 9b690056c..ef4120226 100644 --- a/java/com/jcraft/jsch/agentproxy/RemoteIdentityRepository.java +++ b/java/com/jcraft/jsch/agentproxy/RemoteIdentityRepository.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -47,8 +47,8 @@ public RemoteIdentityRepository(Connector connector) { } public Vector getIdentities() { - Vector result = - new Vector(); + Vector result = + new Vector(); Identity[] identities = agent.getIdentities(); diff --git a/java/com/jcraft/jsch/agentproxy/USocketFactory.java b/java/com/jcraft/jsch/agentproxy/USocketFactory.java index 68ca76d89..ba96f16f4 100644 --- a/java/com/jcraft/jsch/agentproxy/USocketFactory.java +++ b/java/com/jcraft/jsch/agentproxy/USocketFactory.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/agentproxy/connector/PageantConnector.java b/java/com/jcraft/jsch/agentproxy/connector/PageantConnector.java index f170b0eed..c30bff75b 100644 --- a/java/com/jcraft/jsch/agentproxy/connector/PageantConnector.java +++ b/java/com/jcraft/jsch/agentproxy/connector/PageantConnector.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/agentproxy/connector/SSHAgentConnector.java b/java/com/jcraft/jsch/agentproxy/connector/SSHAgentConnector.java index 967dbb9cf..3c953bba1 100644 --- a/java/com/jcraft/jsch/agentproxy/connector/SSHAgentConnector.java +++ b/java/com/jcraft/jsch/agentproxy/connector/SSHAgentConnector.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -76,7 +76,7 @@ private USocketFactory.Socket open() throws IOException { String ssh_auth_sock = System.getenv("SSH_AUTH_SOCK"); if(ssh_auth_sock ==null) { throw new IOException("SSH_AUTH_SOCK is not defined."); - } + } return factory.open(ssh_auth_sock); } diff --git a/java/com/jcraft/jsch/jce/AES128CBC.java b/java/com/jcraft/jsch/jce/AES128CBC.java index 0fb4dfc07..b1f4b0a41 100644 --- a/java/com/jcraft/jsch/jce/AES128CBC.java +++ b/java/com/jcraft/jsch/jce/AES128CBC.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,11 +35,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class AES128CBC implements Cipher{ private static final int ivsize=16; private static final int bsize=16; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; diff --git a/java/com/jcraft/jsch/jce/AES128CTR.java b/java/com/jcraft/jsch/jce/AES128CTR.java index a88b2d5c9..026af8f69 100644 --- a/java/com/jcraft/jsch/jce/AES128CTR.java +++ b/java/com/jcraft/jsch/jce/AES128CTR.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,11 +35,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class AES128CTR implements Cipher{ private static final int ivsize=16; private static final int bsize=16; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; diff --git a/java/com/jcraft/jsch/jce/AES192CBC.java b/java/com/jcraft/jsch/jce/AES192CBC.java index e67535bf7..82c4ed592 100644 --- a/java/com/jcraft/jsch/jce/AES192CBC.java +++ b/java/com/jcraft/jsch/jce/AES192CBC.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,11 +35,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class AES192CBC implements Cipher{ private static final int ivsize=16; private static final int bsize=24; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; diff --git a/java/com/jcraft/jsch/jce/AES192CTR.java b/java/com/jcraft/jsch/jce/AES192CTR.java index e99735e31..1d6ab52f1 100644 --- a/java/com/jcraft/jsch/jce/AES192CTR.java +++ b/java/com/jcraft/jsch/jce/AES192CTR.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,11 +35,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class AES192CTR implements Cipher{ private static final int ivsize=16; private static final int bsize=24; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; diff --git a/java/com/jcraft/jsch/jce/AES256CBC.java b/java/com/jcraft/jsch/jce/AES256CBC.java index cb6ac972b..9209c4eb8 100644 --- a/java/com/jcraft/jsch/jce/AES256CBC.java +++ b/java/com/jcraft/jsch/jce/AES256CBC.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,11 +35,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class AES256CBC implements Cipher{ private static final int ivsize=16; private static final int bsize=32; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; diff --git a/java/com/jcraft/jsch/jce/AES256CTR.java b/java/com/jcraft/jsch/jce/AES256CTR.java index 2437703f0..7ccb80fa3 100644 --- a/java/com/jcraft/jsch/jce/AES256CTR.java +++ b/java/com/jcraft/jsch/jce/AES256CTR.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,11 +35,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class AES256CTR implements Cipher{ private static final int ivsize=16; private static final int bsize=32; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; diff --git a/java/com/jcraft/jsch/jce/ARCFOUR.java b/java/com/jcraft/jsch/jce/ARCFOUR.java index dbe6bf9ad..7db1bf8a9 100644 --- a/java/com/jcraft/jsch/jce/ARCFOUR.java +++ b/java/com/jcraft/jsch/jce/ARCFOUR.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -36,11 +36,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class ARCFOUR implements Cipher{ private static final int ivsize=8; private static final int bsize=16; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; byte[] tmp; if(key.length>bsize){ tmp=new byte[bsize]; @@ -55,7 +55,7 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception{ cipher.init((mode==ENCRYPT_MODE? javax.crypto.Cipher.ENCRYPT_MODE: javax.crypto.Cipher.DECRYPT_MODE), - _key); + _key); } } catch(Exception e){ diff --git a/java/com/jcraft/jsch/jce/ARCFOUR128.java b/java/com/jcraft/jsch/jce/ARCFOUR128.java index b77b0c1f4..e8b01983f 100644 --- a/java/com/jcraft/jsch/jce/ARCFOUR128.java +++ b/java/com/jcraft/jsch/jce/ARCFOUR128.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -36,9 +36,9 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class ARCFOUR128 implements Cipher{ private static final int ivsize=8; private static final int bsize=16; - private static final int skip=1536; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private static final int skip=1536; + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ byte[] tmp; diff --git a/java/com/jcraft/jsch/jce/ARCFOUR256.java b/java/com/jcraft/jsch/jce/ARCFOUR256.java index f4af6223f..7f08367ff 100644 --- a/java/com/jcraft/jsch/jce/ARCFOUR256.java +++ b/java/com/jcraft/jsch/jce/ARCFOUR256.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -36,9 +36,9 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class ARCFOUR256 implements Cipher{ private static final int ivsize=8; private static final int bsize=32; - private static final int skip=1536; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private static final int skip=1536; + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ byte[] tmp; diff --git a/java/com/jcraft/jsch/jce/BlowfishCBC.java b/java/com/jcraft/jsch/jce/BlowfishCBC.java index 2ad9448cf..08aa2f669 100644 --- a/java/com/jcraft/jsch/jce/BlowfishCBC.java +++ b/java/com/jcraft/jsch/jce/BlowfishCBC.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -35,11 +35,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class BlowfishCBC implements Cipher{ private static final int ivsize=8; private static final int bsize=16; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; // if(padding) pad="PKCS5Padding"; byte[] tmp; if(iv.length>ivsize){ diff --git a/java/com/jcraft/jsch/jce/DH.java b/java/com/jcraft/jsch/jce/DH.java index b8a4506f2..2bdb05f9c 100644 --- a/java/com/jcraft/jsch/jce/DH.java +++ b/java/com/jcraft/jsch/jce/DH.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/ECDH256.java b/java/com/jcraft/jsch/jce/ECDH256.java index 29c37db63..fa45eaf50 100644 --- a/java/com/jcraft/jsch/jce/ECDH256.java +++ b/java/com/jcraft/jsch/jce/ECDH256.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -28,7 +28,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ package com.jcraft.jsch.jce; - + public class ECDH256 extends ECDHN implements com.jcraft.jsch.ECDH { public void init() throws Exception { super.init(256); diff --git a/java/com/jcraft/jsch/jce/ECDH384.java b/java/com/jcraft/jsch/jce/ECDH384.java index 2ced69b22..1f34c914d 100644 --- a/java/com/jcraft/jsch/jce/ECDH384.java +++ b/java/com/jcraft/jsch/jce/ECDH384.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -28,7 +28,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ package com.jcraft.jsch.jce; - + public class ECDH384 extends ECDHN implements com.jcraft.jsch.ECDH { public void init() throws Exception { super.init(384); diff --git a/java/com/jcraft/jsch/jce/ECDH521.java b/java/com/jcraft/jsch/jce/ECDH521.java index cd1c9fd0d..850fd8269 100644 --- a/java/com/jcraft/jsch/jce/ECDH521.java +++ b/java/com/jcraft/jsch/jce/ECDH521.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -28,7 +28,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ package com.jcraft.jsch.jce; - + public class ECDH521 extends ECDHN implements com.jcraft.jsch.ECDH { public void init() throws Exception { super.init(521); diff --git a/java/com/jcraft/jsch/jce/ECDHN.java b/java/com/jcraft/jsch/jce/ECDHN.java index 07abe3093..a6810e624 100644 --- a/java/com/jcraft/jsch/jce/ECDHN.java +++ b/java/com/jcraft/jsch/jce/ECDHN.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -34,7 +34,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING import javax.crypto.*; import java.security.spec.*; import java.security.interfaces.*; - + public class ECDHN implements com.jcraft.jsch.ECDH { byte[] Q_array; ECPublicKey publicKey; @@ -90,7 +90,7 @@ public boolean validate(byte[] r, byte[] s) throws Exception{ ECParameterSpec params = publicKey.getParams(); EllipticCurve curve = params.getCurve(); - BigInteger p=((ECFieldFp)curve.getField()).getP(); //nistp should be Fp. + BigInteger p=((ECFieldFp)curve.getField()).getP(); //nistp should be Fp. // xQ and yQ should be integers in the interval [0, p-1] BigInteger p_sub1=p.subtract(BigInteger.ONE); @@ -104,7 +104,7 @@ public boolean validate(byte[] r, byte[] s) throws Exception{ add(x.modPow(three, p)). mod(p); BigInteger y_2=y.modPow(two, p); - if(!(y_2.equals(tmp))){ + if(!(y_2.equals(tmp))){ return false; } diff --git a/java/com/jcraft/jsch/jce/HMAC.java b/java/com/jcraft/jsch/jce/HMAC.java index e13d825b9..315dfdc5b 100644 --- a/java/com/jcraft/jsch/jce/HMAC.java +++ b/java/com/jcraft/jsch/jce/HMAC.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -46,13 +46,13 @@ public int getBlockSize() { public void init(byte[] key) throws Exception { if(key.length>bsize){ byte[] tmp = new byte[bsize]; - System.arraycopy(key, 0, tmp, 0, bsize); + System.arraycopy(key, 0, tmp, 0, bsize); key = tmp; } SecretKeySpec skey = new SecretKeySpec(key, algorithm); mac = Mac.getInstance(algorithm); mac.init(skey); - } + } private final byte[] tmp = new byte[4]; public void update(int i){ @@ -64,7 +64,7 @@ public void update(int i){ } public void update(byte foo[], int s, int l){ - mac.update(foo, s, l); + mac.update(foo, s, l); } public void doFinal(byte[] buf, int offset){ diff --git a/java/com/jcraft/jsch/jce/HMACMD5.java b/java/com/jcraft/jsch/jce/HMACMD5.java index ca02c1cb8..51b6f6c5f 100644 --- a/java/com/jcraft/jsch/jce/HMACMD5.java +++ b/java/com/jcraft/jsch/jce/HMACMD5.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/HMACMD596.java b/java/com/jcraft/jsch/jce/HMACMD596.java index 039c37129..25e4d2419 100644 --- a/java/com/jcraft/jsch/jce/HMACMD596.java +++ b/java/com/jcraft/jsch/jce/HMACMD596.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/HMACSHA1.java b/java/com/jcraft/jsch/jce/HMACSHA1.java index eda37275f..268b36e2b 100644 --- a/java/com/jcraft/jsch/jce/HMACSHA1.java +++ b/java/com/jcraft/jsch/jce/HMACSHA1.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/HMACSHA196.java b/java/com/jcraft/jsch/jce/HMACSHA196.java index 247ecb2de..e65879111 100644 --- a/java/com/jcraft/jsch/jce/HMACSHA196.java +++ b/java/com/jcraft/jsch/jce/HMACSHA196.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/HMACSHA256.java b/java/com/jcraft/jsch/jce/HMACSHA256.java index 0517438f5..1d2a30834 100644 --- a/java/com/jcraft/jsch/jce/HMACSHA256.java +++ b/java/com/jcraft/jsch/jce/HMACSHA256.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/HMACSHA512.java b/java/com/jcraft/jsch/jce/HMACSHA512.java index be0bc90e7..23855b8ae 100644 --- a/java/com/jcraft/jsch/jce/HMACSHA512.java +++ b/java/com/jcraft/jsch/jce/HMACSHA512.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/KeyPairGenDSA.java b/java/com/jcraft/jsch/jce/KeyPairGenDSA.java index d36848d7a..4df9a240e 100644 --- a/java/com/jcraft/jsch/jce/KeyPairGenDSA.java +++ b/java/com/jcraft/jsch/jce/KeyPairGenDSA.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/KeyPairGenECDSA.java b/java/com/jcraft/jsch/jce/KeyPairGenECDSA.java index c57fe8036..961eacc30 100644 --- a/java/com/jcraft/jsch/jce/KeyPairGenECDSA.java +++ b/java/com/jcraft/jsch/jce/KeyPairGenECDSA.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/KeyPairGenEdDSA.java b/java/com/jcraft/jsch/jce/KeyPairGenEdDSA.java index ab4b653b7..cd93b0860 100644 --- a/java/com/jcraft/jsch/jce/KeyPairGenEdDSA.java +++ b/java/com/jcraft/jsch/jce/KeyPairGenEdDSA.java @@ -10,8 +10,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/KeyPairGenRSA.java b/java/com/jcraft/jsch/jce/KeyPairGenRSA.java index a15d1678d..0c253ebc9 100644 --- a/java/com/jcraft/jsch/jce/KeyPairGenRSA.java +++ b/java/com/jcraft/jsch/jce/KeyPairGenRSA.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/MD5.java b/java/com/jcraft/jsch/jce/MD5.java index 78e025f6f..eac773f7b 100644 --- a/java/com/jcraft/jsch/jce/MD5.java +++ b/java/com/jcraft/jsch/jce/MD5.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/PBKDF.java b/java/com/jcraft/jsch/jce/PBKDF.java index 57433afbd..baebe75d9 100644 --- a/java/com/jcraft/jsch/jce/PBKDF.java +++ b/java/com/jcraft/jsch/jce/PBKDF.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/Random.java b/java/com/jcraft/jsch/jce/Random.java index b77f22b36..27785d0cb 100644 --- a/java/com/jcraft/jsch/jce/Random.java +++ b/java/com/jcraft/jsch/jce/Random.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -48,21 +48,21 @@ public Random(){ random=new SecureRandom(); /* - try{ - random=SecureRandom.getInstance("SHA1PRNG"); + try{ + random=SecureRandom.getInstance("SHA1PRNG"); return; } - catch(java.security.NoSuchAlgorithmException e){ - // System.err.println(e); + catch(java.security.NoSuchAlgorithmException e){ + // System.err.println(e); } // The following code is for IBM's JCE - try{ - random=SecureRandom.getInstance("IBMSecureRandom"); + try{ + random=SecureRandom.getInstance("IBMSecureRandom"); return; } - catch(java.security.NoSuchAlgorithmException ee){ - //System.err.println(ee); + catch(java.security.NoSuchAlgorithmException ee){ + //System.err.println(ee); } */ } diff --git a/java/com/jcraft/jsch/jce/SHA1.java b/java/com/jcraft/jsch/jce/SHA1.java index 0d3997c21..6b1745747 100644 --- a/java/com/jcraft/jsch/jce/SHA1.java +++ b/java/com/jcraft/jsch/jce/SHA1.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/SHA256.java b/java/com/jcraft/jsch/jce/SHA256.java index f2f90948c..4c766f3f9 100644 --- a/java/com/jcraft/jsch/jce/SHA256.java +++ b/java/com/jcraft/jsch/jce/SHA256.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/SHA384.java b/java/com/jcraft/jsch/jce/SHA384.java index 976f9cc3a..9a9bab077 100644 --- a/java/com/jcraft/jsch/jce/SHA384.java +++ b/java/com/jcraft/jsch/jce/SHA384.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/SHA512.java b/java/com/jcraft/jsch/jce/SHA512.java index 4c6b19496..bd1c38052 100644 --- a/java/com/jcraft/jsch/jce/SHA512.java +++ b/java/com/jcraft/jsch/jce/SHA512.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jce/SignatureDSA.java b/java/com/jcraft/jsch/jce/SignatureDSA.java index f53bd22dc..d9c79a092 100644 --- a/java/com/jcraft/jsch/jce/SignatureDSA.java +++ b/java/com/jcraft/jsch/jce/SignatureDSA.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -43,27 +43,27 @@ public class SignatureDSA implements com.jcraft.jsch.SignatureDSA{ public void init() throws Exception{ signature=java.security.Signature.getInstance("SHA1withDSA"); keyFactory=KeyFactory.getInstance("DSA"); - } + } public void setPubKey(byte[] y, byte[] p, byte[] q, byte[] g) throws Exception{ - DSAPublicKeySpec dsaPubKeySpec = - new DSAPublicKeySpec(new BigInteger(y), - new BigInteger(p), - new BigInteger(q), - new BigInteger(g)); + DSAPublicKeySpec dsaPubKeySpec = + new DSAPublicKeySpec(new BigInteger(y), + new BigInteger(p), + new BigInteger(q), + new BigInteger(g)); PublicKey pubKey=keyFactory.generatePublic(dsaPubKeySpec); signature.initVerify(pubKey); } public void setPrvKey(byte[] x, byte[] p, byte[] q, byte[] g) throws Exception{ - DSAPrivateKeySpec dsaPrivKeySpec = - new DSAPrivateKeySpec(new BigInteger(x), - new BigInteger(p), - new BigInteger(q), - new BigInteger(g)); + DSAPrivateKeySpec dsaPrivKeySpec = + new DSAPrivateKeySpec(new BigInteger(x), + new BigInteger(p), + new BigInteger(q), + new BigInteger(g)); PrivateKey prvKey = keyFactory.generatePrivate(dsaPrivKeySpec); signature.initSign(prvKey); } public byte[] sign() throws Exception{ - byte[] sig=signature.sign(); + byte[] sig=signature.sign(); /* System.err.print("sign["+sig.length+"] "); for(int i=0; iivsize){ @@ -60,9 +60,9 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception{ // The following code does not work on IBM's JDK 1.4.1 SecretKeySpec skeySpec = new SecretKeySpec(key, "DESede"); cipher.init((mode==ENCRYPT_MODE? - javax.crypto.Cipher.ENCRYPT_MODE: - javax.crypto.Cipher.DECRYPT_MODE), - skeySpec, new IvParameterSpec(iv)); + javax.crypto.Cipher.ENCRYPT_MODE: + javax.crypto.Cipher.DECRYPT_MODE), + skeySpec, new IvParameterSpec(iv)); */ DESedeKeySpec keyspec=new DESedeKeySpec(key); SecretKeyFactory keyfactory=SecretKeyFactory.getInstance("DESede"); diff --git a/java/com/jcraft/jsch/jce/TripleDESCTR.java b/java/com/jcraft/jsch/jce/TripleDESCTR.java index f8a98071c..13600a3e3 100644 --- a/java/com/jcraft/jsch/jce/TripleDESCTR.java +++ b/java/com/jcraft/jsch/jce/TripleDESCTR.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -36,11 +36,11 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class TripleDESCTR implements Cipher{ private static final int ivsize=8; private static final int bsize=24; - private javax.crypto.Cipher cipher; - public int getIVSize(){return ivsize;} + private javax.crypto.Cipher cipher; + public int getIVSize(){return ivsize;} public int getBlockSize(){return bsize;} public void init(int mode, byte[] key, byte[] iv) throws Exception{ - String pad="NoPadding"; + String pad="NoPadding"; //if(padding) pad="PKCS5Padding"; byte[] tmp; if(iv.length>ivsize){ @@ -60,9 +60,9 @@ public void init(int mode, byte[] key, byte[] iv) throws Exception{ // The following code does not work on IBM's JDK 1.4.1 SecretKeySpec skeySpec = new SecretKeySpec(key, "DESede"); cipher.init((mode==ENCRYPT_MODE? - javax.crypto.Cipher.ENCRYPT_MODE: - javax.crypto.Cipher.DECRYPT_MODE), - skeySpec, new IvParameterSpec(iv)); + javax.crypto.Cipher.ENCRYPT_MODE: + javax.crypto.Cipher.DECRYPT_MODE), + skeySpec, new IvParameterSpec(iv)); */ DESedeKeySpec keyspec=new DESedeKeySpec(key); SecretKeyFactory keyfactory=SecretKeyFactory.getInstance("DESede"); diff --git a/java/com/jcraft/jsch/jcraft/Compression.java b/java/com/jcraft/jsch/jcraft/Compression.java index a973fb9ae..5a0514581 100644 --- a/java/com/jcraft/jsch/jcraft/Compression.java +++ b/java/com/jcraft/jsch/jcraft/Compression.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -82,7 +82,7 @@ public byte[] compress(byte[] buf, int start, int[] len){ outputlen+=tmp; break; default: - System.err.println("compress: deflate returnd "+status); + System.err.println("compress: deflate returnd "+status); } } while(stream.avail_out==0); @@ -105,34 +105,34 @@ public byte[] uncompress(byte[] buffer, int start, int[] length){ int status=stream.inflate(JZlib.Z_PARTIAL_FLUSH); switch(status){ case JZlib.Z_OK: - if(inflated_buf.lengthbuffer.length-start){ byte[] foo=new byte[inflated_end+start]; System.arraycopy(buffer, 0, foo, 0, start); System.arraycopy(inflated_buf, 0, foo, start, inflated_end); - buffer=foo; - } - else{ + buffer=foo; + } + else{ System.arraycopy(inflated_buf, 0, buffer, start, inflated_end); - } + } length[0]=inflated_end; - return buffer; - default: - System.err.println("uncompress: inflate returnd "+status); + return buffer; + default: + System.err.println("uncompress: inflate returnd "+status); return null; } } diff --git a/java/com/jcraft/jsch/jcraft/HMAC.java b/java/com/jcraft/jsch/jcraft/HMAC.java index f5c5e14cc..2252d10b1 100644 --- a/java/com/jcraft/jsch/jcraft/HMAC.java +++ b/java/com/jcraft/jsch/jcraft/HMAC.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -61,7 +61,7 @@ public void init(byte[] key) throws Exception{ md.reset(); if(key.length>bsize){ byte[] tmp=new byte[bsize]; - System.arraycopy(key, 0, tmp, 0, bsize); + System.arraycopy(key, 0, tmp, 0, bsize); key=tmp; } diff --git a/java/com/jcraft/jsch/jcraft/HMACMD5.java b/java/com/jcraft/jsch/jcraft/HMACMD5.java index fb3a91ccb..a6f2a23f0 100644 --- a/java/com/jcraft/jsch/jcraft/HMACMD5.java +++ b/java/com/jcraft/jsch/jcraft/HMACMD5.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jcraft/HMACMD596.java b/java/com/jcraft/jsch/jcraft/HMACMD596.java index 5fcc225e5..ffa644b6c 100644 --- a/java/com/jcraft/jsch/jcraft/HMACMD596.java +++ b/java/com/jcraft/jsch/jcraft/HMACMD596.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jcraft/HMACSHA1.java b/java/com/jcraft/jsch/jcraft/HMACSHA1.java index 4cc2f44a5..4bd27db73 100644 --- a/java/com/jcraft/jsch/jcraft/HMACSHA1.java +++ b/java/com/jcraft/jsch/jcraft/HMACSHA1.java @@ -9,8 +9,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jcraft/HMACSHA196.java b/java/com/jcraft/jsch/jcraft/HMACSHA196.java index 20d961b17..8d3db470f 100644 --- a/java/com/jcraft/jsch/jcraft/HMACSHA196.java +++ b/java/com/jcraft/jsch/jcraft/HMACSHA196.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products diff --git a/java/com/jcraft/jsch/jgss/GSSContextKrb5.java b/java/com/jcraft/jsch/jgss/GSSContextKrb5.java index 3b39b8472..13c759eaa 100644 --- a/java/com/jcraft/jsch/jgss/GSSContextKrb5.java +++ b/java/com/jcraft/jsch/jgss/GSSContextKrb5.java @@ -8,8 +8,8 @@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the authors may not be used to endorse or promote products @@ -43,9 +43,9 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING public class GSSContextKrb5 implements com.jcraft.jsch.GSSContext{ - private static final String pUseSubjectCredsOnly = + private static final String pUseSubjectCredsOnly = "javax.security.auth.useSubjectCredsOnly"; - private static String useSubjectCredsOnly = + private static String useSubjectCredsOnly = getSystemProperty(pUseSubjectCredsOnly); private GSSContext context=null; @@ -162,15 +162,15 @@ public void dispose(){ private static String getSystemProperty(String key){ try{ return System.getProperty(key); } - catch(Exception e){ + catch(Exception e){ // We are not allowed to get the System properties. - return null; - } + return null; + } } private static void setSystemProperty(String key, String value){ try{ System.setProperty(key, value); } - catch(Exception e){ + catch(Exception e){ // We are not allowed to set the System properties. } } diff --git a/java/com/jcraft/jsch/opensshFormat.md b/java/com/jcraft/jsch/opensshFormat.md index 279b04a2d..05288ba49 100644 --- a/java/com/jcraft/jsch/opensshFormat.md +++ b/java/com/jcraft/jsch/opensshFormat.md @@ -1,4 +1,4 @@ -# Links regarding OPENSSH key format +# Links regarding OPENSSH key format * nice read: