com.jcraft.jsch_0.1.44.v201101211721

16:34:29.752 INFO  jd.cli.Main - Decompiling com.jcraft.jsch_0.1.44.v201101211721.jar
package com.jcraft.jsch;

public class Buffer
{
  final byte[] tmp = new byte[4];
  byte[] buffer;
  int index;
  int s;
  
  public Buffer(int paramInt)
  {
    buffer = new byte[paramInt];
    index = 0;
    s = 0;
  }
  
  public Buffer(byte[] paramArrayOfByte)
  {
    buffer = paramArrayOfByte;
    index = 0;
    s = 0;
  }
  
  public Buffer()
  {
    this(20480);
  }
  
  public void putByte(byte paramByte)
  {
    buffer[(index++)] = paramByte;
  }
  
  public void putByte(byte[] paramArrayOfByte)
  {
    putByte(paramArrayOfByte, 0, paramArrayOfByte.length);
  }
  
  public void putByte(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    System.arraycopy(paramArrayOfByte, paramInt1, buffer, index, paramInt2);
    index += paramInt2;
  }
  
  public void putString(byte[] paramArrayOfByte)
  {
    putString(paramArrayOfByte, 0, paramArrayOfByte.length);
  }
  
  public void putString(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    putInt(paramInt2);
    putByte(paramArrayOfByte, paramInt1, paramInt2);
  }
  
  public void putInt(int paramInt)
  {
    tmp[0] = ((byte)(paramInt >>> 24));
    tmp[1] = ((byte)(paramInt >>> 16));
    tmp[2] = ((byte)(paramInt >>> 8));
    tmp[3] = ((byte)paramInt);
    System.arraycopy(tmp, 0, buffer, index, 4);
    index += 4;
  }
  
  public void putLong(long paramLong)
  {
    tmp[0] = ((byte)(int)(paramLong >>> 56));
    tmp[1] = ((byte)(int)(paramLong >>> 48));
    tmp[2] = ((byte)(int)(paramLong >>> 40));
    tmp[3] = ((byte)(int)(paramLong >>> 32));
    System.arraycopy(tmp, 0, buffer, index, 4);
    tmp[0] = ((byte)(int)(paramLong >>> 24));
    tmp[1] = ((byte)(int)(paramLong >>> 16));
    tmp[2] = ((byte)(int)(paramLong >>> 8));
    tmp[3] = ((byte)(int)paramLong);
    System.arraycopy(tmp, 0, buffer, index + 4, 4);
    index += 8;
  }
  
  void skip(int paramInt)
  {
    index += paramInt;
  }
  
  void putPad(int paramInt)
  {
    while (paramInt > 0)
    {
      buffer[(index++)] = 0;
      paramInt--;
    }
  }
  
  public void putMPInt(byte[] paramArrayOfByte)
  {
    int i = paramArrayOfByte.length;
    if ((paramArrayOfByte[0] & 0x80) != 0)
    {
      i++;
      putInt(i);
      putByte((byte)0);
    }
    else
    {
      putInt(i);
    }
    putByte(paramArrayOfByte);
  }
  
  public int getLength()
  {
    return index - s;
  }
  
  public int getOffSet()
  {
    return s;
  }
  
  public void setOffSet(int paramInt)
  {
    s = paramInt;
  }
  
  public long getLong()
  {
    long l = getInt() & 0xFFFFFFFF;
    l = l << 32 | getInt() & 0xFFFFFFFF;
    return l;
  }
  
  public int getInt()
  {
    int i = getShort();
    i = i << 16 & 0xFFFF0000 | getShort() & 0xFFFF;
    return i;
  }
  
  public long getUInt()
  {
    long l1 = 0L;
    long l2 = 0L;
    l1 = getByte();
    l1 = l1 << 8 & 0xFF00 | getByte() & 0xFF;
    l2 = getByte();
    l2 = l2 << 8 & 0xFF00 | getByte() & 0xFF;
    l1 = l1 << 16 & 0xFFFFFFFFFFFF0000 | l2 & 0xFFFF;
    return l1;
  }
  
  int getShort()
  {
    int i = getByte();
    i = i << 8 & 0xFF00 | getByte() & 0xFF;
    return i;
  }
  
  public int getByte()
  {
    return buffer[(s++)] & 0xFF;
  }
  
  public void getByte(byte[] paramArrayOfByte)
  {
    getByte(paramArrayOfByte, 0, paramArrayOfByte.length);
  }
  
  void getByte(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    System.arraycopy(buffer, s, paramArrayOfByte, paramInt1, paramInt2);
    s += paramInt2;
  }
  
  public int getByte(int paramInt)
  {
    int i = s;
    s += paramInt;
    return i;
  }
  
  public byte[] getMPInt()
  {
    int i = getInt();
    if ((i < 0) || (i > 8192)) {
      i = 8192;
    }
    byte[] arrayOfByte = new byte[i];
    getByte(arrayOfByte, 0, i);
    return arrayOfByte;
  }
  
  public byte[] getMPIntBits()
  {
    int i = getInt();
    int j = (i + 7) / 8;
    Object localObject = new byte[j];
    getByte((byte[])localObject, 0, j);
    if ((localObject[0] & 0x80) != 0)
    {
      byte[] arrayOfByte = new byte[localObject.length + 1];
      arrayOfByte[0] = 0;
      System.arraycopy(localObject, 0, arrayOfByte, 1, localObject.length);
      localObject = arrayOfByte;
    }
    return (byte[])localObject;
  }
  
  public byte[] getString()
  {
    int i = getInt();
    if ((i < 0) || (i > 262144)) {
      i = 262144;
    }
    byte[] arrayOfByte = new byte[i];
    getByte(arrayOfByte, 0, i);
    return arrayOfByte;
  }
  
  byte[] getString(int[] paramArrayOfInt1, int[] paramArrayOfInt2)
  {
    int i = getInt();
    paramArrayOfInt1[0] = getByte(i);
    paramArrayOfInt2[0] = i;
    return buffer;
  }
  
  public void reset()
  {
    index = 0;
    s = 0;
  }
  
  public void shift()
  {
    if (s == 0) {
      return;
    }
    System.arraycopy(buffer, s, buffer, 0, index - s);
    index -= s;
    s = 0;
  }
  
  void rewind()
  {
    s = 0;
  }
  
  byte getCommand()
  {
    return buffer[5];
  }
  
  void checkFreeSize(int paramInt)
  {
    if (buffer.length < index + paramInt)
    {
      byte[] arrayOfByte = new byte[buffer.length * 2];
      System.arraycopy(buffer, 0, arrayOfByte, 0, index);
      buffer = arrayOfByte;
    }
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.Buffer
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.IOException;
import java.io.OutputStream;

class Channel$1
  extends OutputStream
{
  private int dataLen;
  private Buffer buffer;
  private Packet packet;
  private boolean closed;
  byte[] b;
  private final Channel val$channel;
  private final Channel this$0;
  
  private synchronized void init()
    throws IOException
  {
    buffer = new Buffer(this$0.rmpsize);
    packet = new Packet(buffer);
    
    byte[] arrayOfByte = buffer.buffer;
    if (arrayOfByte.length - 14 - 32 - 20 <= 0)
    {
      buffer = null;
      packet = null;
      throw new IOException("failed to initialize the channel.");
    }
  }
  
  public void write(int paramInt)
    throws IOException
  {
    b[0] = ((byte)paramInt);
    write(b, 0, 1);
  }
  
  public void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    if (packet == null) {
      init();
    }
    if (closed) {
      throw new IOException("Already closed");
    }
    byte[] arrayOfByte = buffer.buffer;
    int i = arrayOfByte.length;
    while (paramInt2 > 0)
    {
      int j = paramInt2;
      if (paramInt2 > i - (14 + dataLen) - 32 - 20) {
        j = i - (14 + dataLen) - 32 - 20;
      }
      if (j <= 0)
      {
        flush();
      }
      else
      {
        System.arraycopy(paramArrayOfByte, paramInt1, arrayOfByte, 14 + dataLen, j);
        dataLen += j;
        paramInt1 += j;
        paramInt2 -= j;
      }
    }
  }
  
  public void flush()
    throws IOException
  {
    if (closed) {
      throw new IOException("Already closed");
    }
    if (dataLen == 0) {
      return;
    }
    packet.reset();
    buffer.putByte((byte)94);
    buffer.putInt(this$0.recipient);
    buffer.putInt(dataLen);
    buffer.skip(dataLen);
    try
    {
      int i = dataLen;
      dataLen = 0;
      this$0.getSession().write(packet, val$channel, i);
    }
    catch (Exception localException)
    {
      close();
      throw new IOException(localException.toString());
    }
  }
  
  Channel$1(Channel paramChannel1, Channel paramChannel2)
    throws IOException
  {
    this$0 = paramChannel1;val$channel = paramChannel2;dataLen = 0;buffer = null;packet = null;closed = false;b = new byte[1];
  }
  
  public void close()
    throws IOException
  {
    if (packet == null) {
      try
      {
        init();
      }
      catch (IOException localIOException)
      {
        return;
      }
    }
    if (closed) {
      return;
    }
    if (dataLen > 0) {
      flush();
    }
    val$channel.eof();
    closed = true;
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.Channel.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;

class Channel$MyPipedInputStream
  extends PipedInputStream
{
  private final Channel this$0;
  
  Channel$MyPipedInputStream(Channel paramChannel)
    throws IOException
  {
    this$0 = paramChannel;
  }
  
  Channel$MyPipedInputStream(Channel paramChannel, int paramInt)
    throws IOException
  {
    this$0 = paramChannel;
    
    buffer = new byte[paramInt];
  }
  
  Channel$MyPipedInputStream(Channel paramChannel, PipedOutputStream paramPipedOutputStream)
    throws IOException
  {
    super(paramPipedOutputStream);this$0 = paramChannel;
  }
  
  Channel$MyPipedInputStream(Channel paramChannel, PipedOutputStream paramPipedOutputStream, int paramInt)
    throws IOException
  {
    super(paramPipedOutputStream);this$0 = paramChannel;
    buffer = new byte[paramInt];
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.Channel.MyPipedInputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.IOException;
import java.io.PipedOutputStream;

class Channel$PassiveInputStream
  extends Channel.MyPipedInputStream
{
  PipedOutputStream out;
  private final Channel this$0;
  
  Channel$PassiveInputStream(Channel paramChannel, PipedOutputStream paramPipedOutputStream, int paramInt)
    throws IOException
  {
    super(paramChannel, paramPipedOutputStream, paramInt);this$0 = paramChannel;
    out = paramPipedOutputStream;
  }
  
  Channel$PassiveInputStream(Channel paramChannel, PipedOutputStream paramPipedOutputStream)
    throws IOException
  {
    super(paramChannel, paramPipedOutputStream);this$0 = paramChannel;
    out = paramPipedOutputStream;
  }
  
  public void close()
    throws IOException
  {
    if (out != null) {
      out.close();
    }
    out = null;
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.Channel.PassiveInputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;

class Channel$PassiveOutputStream
  extends PipedOutputStream
{
  private final Channel this$0;
  
  Channel$PassiveOutputStream(Channel paramChannel, PipedInputStream paramPipedInputStream)
    throws IOException
  {
    super(paramPipedInputStream);this$0 = paramChannel;
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.Channel.PassiveOutputStream
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.Vector;

public abstract class Channel
  implements Runnable
{
  static final int SSH_MSG_CHANNEL_OPEN_CONFIRMATION = 91;
  static final int SSH_MSG_CHANNEL_OPEN_FAILURE = 92;
  static final int SSH_MSG_CHANNEL_WINDOW_ADJUST = 93;
  static final int SSH_OPEN_ADMINISTRATIVELY_PROHIBITED = 1;
  static final int SSH_OPEN_CONNECT_FAILED = 2;
  static final int SSH_OPEN_UNKNOWN_CHANNEL_TYPE = 3;
  static final int SSH_OPEN_RESOURCE_SHORTAGE = 4;
  static int index = 0;
  private static Vector pool = new Vector();
  int id;
  
  static Channel getChannel(String paramString)
  {
    if (paramString.equals("session")) {
      return new ChannelSession();
    }
    if (paramString.equals("shell")) {
      return new ChannelShell();
    }
    if (paramString.equals("exec")) {
      return new ChannelExec();
    }
    if (paramString.equals("x11")) {
      return new ChannelX11();
    }
    if (paramString.equals("auth-agent@openssh.com")) {
      return new ChannelAgentForwarding();
    }
    if (paramString.equals("direct-tcpip")) {
      return new ChannelDirectTCPIP();
    }
    if (paramString.equals("forwarded-tcpip")) {
      return new ChannelForwardedTCPIP();
    }
    if (paramString.equals("sftp")) {
      return new ChannelSftp();
    }
    if (paramString.equals("subsystem")) {
      return new ChannelSubsystem();
    }
    return null;
  }
  
  static Channel getChannel(int paramInt, Session paramSession)
  {
    synchronized (pool)
    {
      for (int i = 0; i < pool.size(); i++)
      {
        Channel localChannel1 = (Channel)pool.elementAt(i);
        if ((id == paramInt) && (session == paramSession))
        {
          Channel localChannel2 = localChannel1;return localChannel2;
        }
      }
    }
    return null;
  }
  
  static void del(Channel paramChannel)
  {
    synchronized (pool)
    {
      pool.removeElement(paramChannel);
    }
  }
  
  int recipient = -1;
  byte[] type = Util.str2byte("foo");
  int lwsize_max = 1048576;
  int lwsize = lwsize_max;
  int lmpsize = 16384;
  long rwsize = 0L;
  int rmpsize = 0;
  IO io = null;
  Thread thread = null;
  boolean eof_local = false;
  boolean eof_remote = false;
  boolean close = false;
  boolean connected = false;
  int exitstatus = -1;
  int reply = 0;
  int connectTimeout = 0;
  private Session session;
  int notifyme = 0;
  
  Channel()
  {
    synchronized (pool)
    {
      id = (index++);
      pool.addElement(this);
    }
  }
  
  void setRecipient(int paramInt)
  {
    recipient = paramInt;
  }
  
  int getRecipient()
  {
    return recipient;
  }
  
  void init()
    throws JSchException
  {}
  
  public void connect()
    throws JSchException
  {
    connect(0);
  }
  
  public void connect(int paramInt)
    throws JSchException
  {
    Session localSession = getSession();
    if (!localSession.isConnected()) {
      throw new JSchException("session is down");
    }
    connectTimeout = paramInt;
    try
    {
      Buffer localBuffer = new Buffer(100);
      Packet localPacket = new Packet(localBuffer);
      
      localPacket.reset();
      localBuffer.putByte((byte)90);
      localBuffer.putString(type);
      localBuffer.putInt(id);
      localBuffer.putInt(lwsize);
      localBuffer.putInt(lmpsize);
      localSession.write(localPacket);
      int i = 1000;
      long l1 = System.currentTimeMillis();
      long l2 = paramInt;
      while ((getRecipient() == -1) && (localSession.isConnected()) && (i > 0)) {
        if ((l2 > 0L) && 
          (System.currentTimeMillis() - l1 > l2))
        {
          i = 0;
        }
        else
        {
          try
          {
            Thread.sleep(50L);
          }
          catch (Exception localException2) {}
          i--;
        }
      }
      if (!localSession.isConnected()) {
        throw new JSchException("session is down");
      }
      if (i == 0) {
        throw new JSchException("channel is not opened.");
      }
      if (isClosed()) {
        throw new JSchException("channel is not opened.");
      }
      connected = true;
      start();
    }
    catch (Exception localException1)
    {
      connected = false;
      disconnect();
      if ((localException1 instanceof JSchException)) {
        throw ((JSchException)localException1);
      }
      throw new JSchException(localException1.toString(), localException1);
    }
  }
  
  public void setXForwarding(boolean paramBoolean) {}
  
  public void start()
    throws JSchException
  {}
  
  public boolean isEOF()
  {
    return eof_remote;
  }
  
  void getData(Buffer paramBuffer)
  {
    setRecipient(paramBuffer.getInt());
    setRemoteWindowSize(paramBuffer.getUInt());
    setRemotePacketSize(paramBuffer.getInt());
  }
  
  public void setInputStream(InputStream paramInputStream)
  {
    io.setInputStream(paramInputStream, false);
  }
  
  public void setInputStream(InputStream paramInputStream, boolean paramBoolean)
  {
    io.setInputStream(paramInputStream, paramBoolean);
  }
  
  public void setOutputStream(OutputStream paramOutputStream)
  {
    io.setOutputStream(paramOutputStream, false);
  }
  
  public void setOutputStream(OutputStream paramOutputStream, boolean paramBoolean)
  {
    io.setOutputStream(paramOutputStream, paramBoolean);
  }
  
  public void setExtOutputStream(OutputStream paramOutputStream)
  {
    io.setExtOutputStream(paramOutputStream, false);
  }
  
  public void setExtOutputStream(OutputStream paramOutputStream, boolean paramBoolean)
  {
    io.setExtOutputStream(paramOutputStream, paramBoolean);
  }
  
  public InputStream getInputStream()
    throws IOException
  {
    MyPipedInputStream localMyPipedInputStream = new MyPipedInputStream(32768);
    
    io.setOutputStream(new PassiveOutputStream(localMyPipedInputStream), false);
    return localMyPipedInputStream;
  }
  
  public InputStream getExtInputStream()
    throws IOException
  {
    MyPipedInputStream localMyPipedInputStream = new MyPipedInputStream(32768);
    
    io.setExtOutputStream(new PassiveOutputStream(localMyPipedInputStream), false);
    return localMyPipedInputStream;
  }
  
  public OutputStream getOutputStream()
    throws IOException
  {
    Channel localChannel = this;
    OutputStream local1 = new OutputStream()
    {
      private int dataLen;
      private Buffer buffer;
      private Packet packet;
      private boolean closed;
      byte[] b;
      private final Channel val$channel;
      
      private synchronized void init()
        throws IOException
      {
        buffer = new Buffer(rmpsize);
        packet = new Packet(buffer);
        
        byte[] arrayOfByte = buffer.buffer;
        if (arrayOfByte.length - 14 - 32 - 20 <= 0)
        {
          buffer = null;
          packet = null;
          throw new IOException("failed to initialize the channel.");
        }
      }
      
      public void write(int paramAnonymousInt)
        throws IOException
      {
        b[0] = ((byte)paramAnonymousInt);
        write(b, 0, 1);
      }
      
      public void write(byte[] paramAnonymousArrayOfByte, int paramAnonymousInt1, int paramAnonymousInt2)
        throws IOException
      {
        if (packet == null) {
          init();
        }
        if (closed) {
          throw new IOException("Already closed");
        }
        byte[] arrayOfByte = buffer.buffer;
        int i = arrayOfByte.length;
        while (paramAnonymousInt2 > 0)
        {
          int j = paramAnonymousInt2;
          if (paramAnonymousInt2 > i - (14 + dataLen) - 32 - 20) {
            j = i - (14 + dataLen) - 32 - 20;
          }
          if (j <= 0)
          {
            flush();
          }
          else
          {
            System.arraycopy(paramAnonymousArrayOfByte, paramAnonymousInt1, arrayOfByte, 14 + dataLen, j);
            dataLen += j;
            paramAnonymousInt1 += j;
            paramAnonymousInt2 -= j;
          }
        }
      }
      
      public void flush()
        throws IOException
      {
        if (closed) {
          throw new IOException("Already closed");
        }
        if (dataLen == 0) {
          return;
        }
        packet.reset();
        buffer.putByte((byte)94);
        buffer.putInt(recipient);
        buffer.putInt(dataLen);
        buffer.skip(dataLen);
        try
        {
          int i = dataLen;
          dataLen = 0;
          getSession().write(packet, val$channel, i);
        }
        catch (Exception localException)
        {
          close();
          throw new IOException(localException.toString());
        }
      }
      
      public void close()
        throws IOException
      {
        if (packet == null) {
          try
          {
            init();
          }
          catch (IOException localIOException)
          {
            return;
          }
        }
        if (closed) {
          return;
        }
        if (dataLen > 0) {
          flush();
        }
        val$channel.eof();
        closed = true;
      }
    };
    return local1;
  }
  
  class MyPipedInputStream
    extends PipedInputStream
  {
    MyPipedInputStream()
      throws IOException
    {}
    
    MyPipedInputStream(int paramInt)
      throws IOException
    {
      buffer = new byte[paramInt];
    }
    
    MyPipedInputStream(PipedOutputStream paramPipedOutputStream)
      throws IOException
    {
      super();
    }
    
    MyPipedInputStream(PipedOutputStream paramPipedOutputStream, int paramInt)
      throws IOException
    {
      super();
      buffer = new byte[paramInt];
    }
  }
  
  void setLocalWindowSizeMax(int paramInt)
  {
    lwsize_max = paramInt;
  }
  
  void setLocalWindowSize(int paramInt)
  {
    lwsize = paramInt;
  }
  
  void setLocalPacketSize(int paramInt)
  {
    lmpsize = paramInt;
  }
  
  synchronized void setRemoteWindowSize(long paramLong)
  {
    rwsize = paramLong;
  }
  
  synchronized void addRemoteWindowSize(int paramInt)
  {
    rwsize += paramInt;
    if (notifyme > 0) {
      notifyAll();
    }
  }
  
  void setRemotePacketSize(int paramInt)
  {
    rmpsize = paramInt;
  }
  
  public void run() {}
  
  void write(byte[] paramArrayOfByte)
    throws IOException
  {
    write(paramArrayOfByte, 0, paramArrayOfByte.length);
  }
  
  void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    try
    {
      io.put(paramArrayOfByte, paramInt1, paramInt2);
    }
    catch (NullPointerException localNullPointerException) {}
  }
  
  void write_ext(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    try
    {
      io.put_ext(paramArrayOfByte, paramInt1, paramInt2);
    }
    catch (NullPointerException localNullPointerException) {}
  }
  
  void eof_remote()
  {
    eof_remote = true;
    try
    {
      io.out_close();
    }
    catch (NullPointerException localNullPointerException) {}
  }
  
  void eof()
  {
    if (eof_local) {
      return;
    }
    eof_local = true;
    try
    {
      Buffer localBuffer = new Buffer(100);
      Packet localPacket = new Packet(localBuffer);
      localPacket.reset();
      localBuffer.putByte((byte)96);
      localBuffer.putInt(getRecipient());
      synchronized (this)
      {
        if (!close) {
          getSession().write(localPacket);
        }
      }
    }
    catch (Exception localException) {}
  }
  
  void close()
  {
    if (close) {
      return;
    }
    close = true;
    eof_local = (eof_remote = 1);
    try
    {
      Buffer localBuffer = new Buffer(100);
      Packet localPacket = new Packet(localBuffer);
      localPacket.reset();
      localBuffer.putByte((byte)97);
      localBuffer.putInt(getRecipient());
      synchronized (this)
      {
        getSession().write(localPacket);
      }
    }
    catch (Exception localException) {}
  }
  
  public boolean isClosed()
  {
    return close;
  }
  
  static void disconnect(Session paramSession)
  {
    Channel[] arrayOfChannel = null;
    int i = 0;
    synchronized (pool)
    {
      arrayOfChannel = new Channel[pool.size()];
      for (j = 0; j < pool.size(); j++) {
        try
        {
          Channel localChannel = (Channel)pool.elementAt(j);
          if (session == paramSession) {
            arrayOfChannel[(i++)] = localChannel;
          }
        }
        catch (Exception localException) {}
      }
    }
    for (int j = 0; j < i; j++) {
      arrayOfChannel[j].disconnect();
    }
  }
  
  /* Error */
  public void disconnect()
  {
    // Byte code:
    //   0: aload_0
    //   1: astore_1
    //   2: aload_1
    //   3: monitorenter
    //   4: aload_0
    //   5: getfield 311	com/jcraft/jsch/Channel:connected	Z
    //   8: ifne +9 -> 17
    //   11: aload_1
    //   12: monitorexit
    //   13: jsr +68 -> 81
    //   16: return
    //   17: aload_0
    //   18: iconst_0
    //   19: putfield 311	com/jcraft/jsch/Channel:connected	Z
    //   22: aload_1
    //   23: monitorexit
    //   24: goto +8 -> 32
    //   27: astore_2
    //   28: aload_1
    //   29: monitorexit
    //   30: aload_2
    //   31: athrow
    //   32: aload_0
    //   33: invokevirtual 327	com/jcraft/jsch/Channel:close	()V
    //   36: aload_0
    //   37: aload_0
    //   38: iconst_1
    //   39: dup_x1
    //   40: putfield 312	com/jcraft/jsch/Channel:eof_local	Z
    //   43: putfield 313	com/jcraft/jsch/Channel:eof_remote	Z
    //   46: aload_0
    //   47: aconst_null
    //   48: putfield 317	com/jcraft/jsch/Channel:thread	Ljava/lang/Thread;
    //   51: aload_0
    //   52: getfield 315	com/jcraft/jsch/Channel:io	Lcom/jcraft/jsch/IO;
    //   55: ifnull +10 -> 65
    //   58: aload_0
    //   59: getfield 315	com/jcraft/jsch/Channel:io	Lcom/jcraft/jsch/IO;
    //   62: invokevirtual 350	com/jcraft/jsch/IO:close	()V
    //   65: goto +4 -> 69
    //   68: astore_2
    //   69: jsr +12 -> 81
    //   72: goto +17 -> 89
    //   75: astore_3
    //   76: jsr +5 -> 81
    //   79: aload_3
    //   80: athrow
    //   81: astore 4
    //   83: aload_0
    //   84: invokestatic 336	com/jcraft/jsch/Channel:del	(Lcom/jcraft/jsch/Channel;)V
    //   87: ret 4
    //   89: return
    // Line number table:
    //   Java source line #521	-> byte code offset #0
    //   Java source line #522	-> byte code offset #4
    //   Java source line #523	-> byte code offset #11
    //   Java source line #525	-> byte code offset #17
    //   Java source line #526	-> byte code offset #22
    //   Java source line #528	-> byte code offset #32
    //   Java source line #530	-> byte code offset #36
    //   Java source line #532	-> byte code offset #46
    //   Java source line #535	-> byte code offset #51
    //   Java source line #536	-> byte code offset #58
    //   Java source line #538	-> byte code offset #65
    //   Java source line #539	-> byte code offset #68
    //   Java source line #543	-> byte code offset #69
    //   Java source line #545	-> byte code offset #75
    //   Java source line #547	-> byte code offset #89
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	90	0	this	Channel
    //   27	4	2	localObject1	Object
    //   68	1	2	localException	Exception
    //   75	5	3	localObject2	Object
    //   81	1	4	localObject3	Object
    // Exception table:
    //   from	to	target	type
    //   4	13	27	finally
    //   17	24	27	finally
    //   27	30	27	finally
    //   51	65	68	java/lang/Exception
    //   0	16	75	finally
    //   17	72	75	finally
    //   75	79	75	finally
  }
  
  public boolean isConnected()
  {
    Session localSession = session;
    if (localSession != null) {
      return (localSession.isConnected()) && (connected);
    }
    return false;
  }
  
  public void sendSignal(String paramString)
    throws Exception
  {
    RequestSignal localRequestSignal = new RequestSignal();
    localRequestSignal.setSignal(paramString);
    localRequestSignal.request(getSession(), this);
  }
  
  class PassiveInputStream
    extends Channel.MyPipedInputStream
  {
    PipedOutputStream out;
    
    PassiveInputStream(PipedOutputStream paramPipedOutputStream, int paramInt)
      throws IOException
    {
      super(paramPipedOutputStream, paramInt);
      out = paramPipedOutputStream;
    }
    
    PassiveInputStream(PipedOutputStream paramPipedOutputStream)
      throws IOException
    {
      super(paramPipedOutputStream);
      out = paramPipedOutputStream;
    }
    
    public void close()
      throws IOException
    {
      if (out != null) {
        out.close();
      }
      out = null;
    }
  }
  
  class PassiveOutputStream
    extends PipedOutputStream
  {
    PassiveOutputStream(PipedInputStream paramPipedInputStream)
      throws IOException
    {
      super();
    }
  }
  
  void setExitStatus(int paramInt)
  {
    exitstatus = paramInt;
  }
  
  public int getExitStatus()
  {
    return exitstatus;
  }
  
  void setSession(Session paramSession)
  {
    session = paramSession;
  }
  
  public Session getSession()
    throws JSchException
  {
    Session localSession = session;
    if (localSession == null) {
      throw new JSchException("session is not available");
    }
    return localSession;
  }
  
  public int getId()
  {
    return id;
  }
  
  protected void sendOpenConfirmation()
    throws Exception
  {
    Buffer localBuffer = new Buffer(100);
    Packet localPacket = new Packet(localBuffer);
    localPacket.reset();
    localBuffer.putByte((byte)91);
    localBuffer.putInt(getRecipient());
    localBuffer.putInt(id);
    localBuffer.putInt(lwsize);
    localBuffer.putInt(lmpsize);
    getSession().write(localPacket);
  }
  
  protected void sendOpenFailure(int paramInt)
  {
    try
    {
      Buffer localBuffer = new Buffer(100);
      Packet localPacket = new Packet(localBuffer);
      localPacket.reset();
      localBuffer.putByte((byte)92);
      localBuffer.putInt(getRecipient());
      localBuffer.putInt(paramInt);
      localBuffer.putString(Util.str2byte("open failed"));
      localBuffer.putString(Util.empty);
      getSession().write(localPacket);
    }
    catch (Exception localException) {}
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.Channel
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.IOException;
import java.util.Vector;

class ChannelAgentForwarding
  extends Channel
{
  private static final int LOCAL_WINDOW_SIZE_MAX = 131072;
  private static final int LOCAL_MAXIMUM_PACKET_SIZE = 16384;
  private final int SSH2_AGENTC_REQUEST_IDENTITIES = 11;
  private final int SSH2_AGENT_IDENTITIES_ANSWER = 12;
  private final int SSH2_AGENTC_SIGN_REQUEST = 13;
  private final int SSH2_AGENT_SIGN_RESPONSE = 14;
  private final int SSH2_AGENTC_ADD_IDENTITY = 17;
  private final int SSH2_AGENTC_REMOVE_IDENTITY = 18;
  private final int SSH2_AGENTC_REMOVE_ALL_IDENTITIES = 19;
  private final int SSH2_AGENT_FAILURE = 30;
  boolean init = true;
  private Buffer rbuf = null;
  private Buffer wbuf = null;
  private Packet packet = null;
  private Buffer mbuf = null;
  
  ChannelAgentForwarding()
  {
    setLocalWindowSizeMax(131072);
    setLocalWindowSize(131072);
    setLocalPacketSize(16384);
    
    type = Util.str2byte("auth-agent@openssh.com");
    rbuf = new Buffer();
    rbuf.reset();
    
    mbuf = new Buffer();
    connected = true;
  }
  
  public void run()
  {
    try
    {
      sendOpenConfirmation();
    }
    catch (Exception localException)
    {
      close = true;
      disconnect();
    }
  }
  
  void write(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    if (packet == null)
    {
      wbuf = new Buffer(rmpsize);
      packet = new Packet(wbuf);
    }
    rbuf.shift();
    if (rbuf.buffer.length < rbuf.index + paramInt2)
    {
      byte[] arrayOfByte1 = new byte[rbuf.s + paramInt2];
      System.arraycopy(rbuf.buffer, 0, arrayOfByte1, 0, rbuf.buffer.length);
      rbuf.buffer = arrayOfByte1;
    }
    rbuf.putByte(paramArrayOfByte, paramInt1, paramInt2);
    
    int i = rbuf.getInt();
    if (i > rbuf.getLength())
    {
      rbuf.s -= 4;
      return;
    }
    int j = rbuf.getByte();
    
    Session localSession = null;
    try
    {
      localSession = getSession();
    }
    catch (JSchException localJSchException1)
    {
      throw new IOException(localJSchException1.toString());
    }
    Vector localVector = jsch.identities;
    UserInfo localUserInfo = localSession.getUserInfo();
    int m;
    byte[] arrayOfByte2;
    if (j == 11)
    {
      mbuf.reset();
      mbuf.putByte((byte)12);
      synchronized (localVector)
      {
        int k = 0;
        for (m = 0; m < localVector.size(); m++)
        {
          Identity localIdentity = (Identity)localVector.elementAt(m);
          if (localIdentity.getPublicKeyBlob() != null) {
            k++;
          }
        }
        mbuf.putInt(k);
        for (int n = 0; n < localVector.size(); n++)
        {
          ??? = (Identity)localVector.elementAt(n);
          byte[] arrayOfByte3 = ((Identity)???).getPublicKeyBlob();
          if (arrayOfByte3 != null)
          {
            mbuf.putString(arrayOfByte3);
            mbuf.putString(Util.empty);
          }
        }
      }
      arrayOfByte2 = new byte[mbuf.getLength()];
      mbuf.getByte(arrayOfByte2);
      
      send(arrayOfByte2);
    }
    else if (j == 13)
    {
      ??? = rbuf.getString();
      arrayOfByte2 = rbuf.getString();
      m = rbuf.getInt();
      
      Object localObject2 = null;
      synchronized (localVector)
      {
        for (int i1 = 0; i1 < localVector.size(); i1++)
        {
          localObject5 = (Identity)localVector.elementAt(i1);
          if (((Identity)localObject5).getPublicKeyBlob() != null) {
            if (Util.array_equals((byte[])???, ((Identity)localObject5).getPublicKeyBlob())) {
              if (((Identity)localObject5).isEncrypted())
              {
                if (localUserInfo == null) {}
                while (((Identity)localObject5).isEncrypted())
                {
                  if (!localUserInfo.promptPassphrase("Passphrase for " + ((Identity)localObject5).getName())) {
                    break;
                  }
                  String str = localUserInfo.getPassphrase();
                  if (str == null) {
                    break;
                  }
                  byte[] arrayOfByte5 = Util.str2byte(str);
                  try
                  {
                    if (((Identity)localObject5).setPassphrase(arrayOfByte5)) {
                      break;
                    }
                  }
                  catch (JSchException localJSchException2)
                  {
                    break;
                  }
                }
              }
              else if (!((Identity)localObject5).isEncrypted())
              {
                localObject2 = localObject5;
                break;
              }
            }
          }
        }
      }
      byte[] arrayOfByte4 = null;
      if (localObject2 != null) {
        arrayOfByte4 = ((Identity)localObject2).getSignature(arrayOfByte2);
      }
      mbuf.reset();
      if (arrayOfByte4 == null)
      {
        mbuf.putByte((byte)30);
      }
      else
      {
        mbuf.putByte((byte)14);
        mbuf.putString(arrayOfByte4);
      }
      Object localObject5 = new byte[mbuf.getLength()];
      mbuf.getByte((byte[])localObject5);
      
      send((byte[])localObject5);
    }
  }
  
  private void send(byte[] paramArrayOfByte)
  {
    packet.reset();
    wbuf.putByte((byte)94);
    wbuf.putInt(recipient);
    wbuf.putInt(4 + paramArrayOfByte.length);
    wbuf.putString(paramArrayOfByte);
    try
    {
      getSession().write(packet, this, 4 + paramArrayOfByte.length);
    }
    catch (Exception localException) {}
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.ChannelAgentForwarding
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;

public class ChannelDirectTCPIP
  extends Channel
{
  private static final int LOCAL_WINDOW_SIZE_MAX = 131072;
  private static final int LOCAL_MAXIMUM_PACKET_SIZE = 16384;
  String host;
  int port;
  String originator_IP_address = "127.0.0.1";
  int originator_port = 0;
  
  ChannelDirectTCPIP()
  {
    setLocalWindowSizeMax(131072);
    setLocalWindowSize(131072);
    setLocalPacketSize(16384);
  }
  
  void init()
  {
    try
    {
      io = new IO();
    }
    catch (Exception localException)
    {
      System.err.println(localException);
    }
  }
  
  public void connect()
    throws JSchException
  {
    try
    {
      Session localSession = getSession();
      if (!localSession.isConnected()) {
        throw new JSchException("session is down");
      }
      Buffer localBuffer = new Buffer(150);
      Packet localPacket = new Packet(localBuffer);
      
      localPacket.reset();
      localBuffer.putByte((byte)90);
      localBuffer.putString(Util.str2byte("direct-tcpip"));
      localBuffer.putInt(id);
      localBuffer.putInt(lwsize);
      localBuffer.putInt(lmpsize);
      localBuffer.putString(Util.str2byte(host));
      localBuffer.putInt(port);
      localBuffer.putString(Util.str2byte(originator_IP_address));
      localBuffer.putInt(originator_port);
      localSession.write(localPacket);
      
      int i = 1000;
      try
      {
        do
        {
          Thread.sleep(50L);
          i--;
          if ((getRecipient() != -1) || (!localSession.isConnected()) || (i <= 0)) {
            break;
          }
        } while (!eof_remote);
      }
      catch (Exception localException2) {}
      if (!localSession.isConnected()) {
        throw new JSchException("session is down");
      }
      if ((i == 0) || (eof_remote)) {
        throw new JSchException("channel is not opened.");
      }
      connected = true;
      if (io.in != null)
      {
        thread = new Thread(this);
        thread.setName("DirectTCPIP thread " + localSession.getHost());
        if (daemon_thread) {
          thread.setDaemon(daemon_thread);
        }
        thread.start();
      }
    }
    catch (Exception localException1)
    {
      io.close();
      io = null;
      Channel.del(this);
      if ((localException1 instanceof JSchException)) {
        throw ((JSchException)localException1);
      }
    }
  }
  
  public void run()
  {
    Buffer localBuffer = new Buffer(rmpsize);
    Packet localPacket = new Packet(localBuffer);
    int i = 0;
    try
    {
      Session localSession = getSession();
      do
      {
        i = io.in.read(buffer, 14, buffer.length - 14 - 32 - 20);
        if (i <= 0)
        {
          eof();
          break;
        }
        if (close) {
          break;
        }
        localPacket.reset();
        localBuffer.putByte((byte)94);
        localBuffer.putInt(recipient);
        localBuffer.putInt(i);
        localBuffer.skip(i);
        localSession.write(localPacket, this, i);
        if ((!isConnected()) || (thread == null) || (io == null)) {
          break;
        }
      } while (io.in != null);
    }
    catch (Exception localException) {}
    disconnect();
  }
  
  public void setInputStream(InputStream paramInputStream)
  {
    io.setInputStream(paramInputStream);
  }
  
  public void setOutputStream(OutputStream paramOutputStream)
  {
    io.setOutputStream(paramOutputStream);
  }
  
  public void setHost(String paramString)
  {
    host = paramString;
  }
  
  public void setPort(int paramInt)
  {
    port = paramInt;
  }
  
  public void setOrgIPAddress(String paramString)
  {
    originator_IP_address = paramString;
  }
  
  public void setOrgPort(int paramInt)
  {
    originator_port = paramInt;
  }
}

/* Location:
 * Qualified Name:     com.jcraft.jsch.ChannelDirectTCPIP
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package com.jcraft.jsch;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class ChannelExec
  extends ChannelSession
{
  byte[] command = new byte[0];
  
  public void start()
    throws JSchException
  {
    Session localSession = getSession();
    try
    {
      sendRequests();
      RequestExec localRequestExec = new RequestExec(command);
      localRequestExec.request(localSession, this);
    }
    catch (Exception localException)
    {
      if ((localException instanceof JSchException)) {
        throw ((JSchException)localException);
      }
      if ((localException instanceof Throwable)) {
        throw new JSchException("ChannelExec", localException);
      }
      throw new JSchException("ChannelExec");
    }
    if (io.in != null)
    {
      thread = new Thread(this);
      thread.setName("Exec thread " + localSession.getHost());
      if (daemon_thread) {
        thread.setDaemon(daemon_thread);
      }
      thread.start();
    }
  }
  
  public void setCommand(String paramString)
  {
    command = Util.str2byte(paramString);
  }
  
  public void setCommand(byte[] paramArrayOfByte)
  {
    command = paramArrayOfByte;
  }
  
  void init()
    throws JSchException
  {
    
1 2 3 4 5 6 7 8 9 10 11 12 13

Further reading...

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

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd