00001 using System; 00002 00003 namespace Tamir.SharpSsh.jsch 00004 { 00005 /* -*-mode:java; c-basic-offset:2; -*- */ 00006 /* 00007 Copyright (c) 2002,2003,2004 ymnk, JCraft,Inc. All rights reserved. 00008 00009 Redistribution and use in source and binary forms, with or without 00010 modification, are permitted provided that the following conditions are met: 00011 00012 1. Redistributions of source code must retain the above copyright notice, 00013 this list of conditions and the following disclaimer. 00014 00015 2. Redistributions in binary form must reproduce the above copyright 00016 notice, this list of conditions and the following disclaimer in 00017 the documentation and/or other materials provided with the distribution. 00018 00019 3. The names of the authors may not be used to endorse or promote products 00020 derived from this software without specific prior written permission. 00021 00022 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 00023 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00024 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 00025 INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00027 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00028 OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00029 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00030 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00031 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 */ 00033 00034 class RequestX11 : Request 00035 { 00036 public void setCookie(String cookie) 00037 { 00038 ChannelX11.cookie=Util.getBytes(cookie); 00039 } 00040 public void request(Session session, Channel channel) 00041 { 00042 Buffer buf=new Buffer(); 00043 Packet packet=new Packet(buf); 00044 00045 // byte SSH_MSG_CHANNEL_REQUEST(98) 00046 // uint32 recipient channel 00047 // string request type // "x11-req" 00048 // boolean want reply // 0 00049 // boolean single connection 00050 // string x11 authentication protocol // "MIT-MAGIC-COOKIE-1". 00051 // string x11 authentication cookie 00052 // uint32 x11 screen number 00053 packet.reset(); 00054 buf.putByte((byte) Session.SSH_MSG_CHANNEL_REQUEST); 00055 buf.putInt(channel.getRecipient()); 00056 buf.putString(Util.getBytes("x11-req")); 00057 buf.putByte((byte)(waitForReply() ? 1 : 0)); 00058 buf.putByte((byte)0); 00059 buf.putString(Util.getBytes("MIT-MAGIC-COOKIE-1")); 00060 buf.putString(ChannelX11.getFakedCookie(session)); 00061 buf.putInt(0); 00062 session.write(packet); 00063 } 00064 public bool waitForReply(){ return false; } 00065 } 00066 00067 }
1.5.9