Mercurial > hg > Applications > TreeVNC
changeset 10:73abb3b86ce7
before change
author | one |
---|---|
date | Wed, 15 Aug 2012 17:08:10 +0900 |
parents | 1a30763734cf |
children | 57ae9fbb1245 |
files | .DS_Store src/main/java/ac/ryukyu/treevnc/client/MyVncClient.java src/main/java/com/glavsoft/rfb/protocol/auth/RequireAuthentication.java |
diffstat | 3 files changed, 45 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/ac/ryukyu/treevnc/client/MyVncClient.java Tue Aug 14 17:14:48 2012 +0900 +++ b/src/main/java/ac/ryukyu/treevnc/client/MyVncClient.java Wed Aug 15 17:08:10 2012 +0900 @@ -27,8 +27,8 @@ import com.glavsoft.viewer.swing.ParametersHandler.ConnectionParams; -public class MyVncClient extends Viewer implements Runnable, - IRfbSessionListener, WindowListener, IChangeSettingsListener { +public class MyVncClient extends Viewer implements IRfbSessionListener, + WindowListener, IChangeSettingsListener { /** * @@ -91,12 +91,10 @@ //getHostData(); } //SwingUtilities.invokeLater(myClient); - Thread th = new Thread(myClient); - th.start(); + myClient.mainLoop(); } - @Override - public void run() { + public void mainLoop() { // getHostData(); ConnectionManager connectionManager = new ConnectionManager(this, isApplet); if (forceReconnection) { @@ -164,7 +162,7 @@ } - private void setArgments(String[] args) { + public void setArgments(String[] args) { arguments = args; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/com/glavsoft/rfb/protocol/auth/RequireAuthentication.java Wed Aug 15 17:08:10 2012 +0900 @@ -0,0 +1,40 @@ +package com.glavsoft.rfb.protocol.auth; + +import com.glavsoft.exceptions.TransportException; +import com.glavsoft.rfb.CapabilityContainer; +import com.glavsoft.rfb.IPasswordRetriever; +import com.glavsoft.transport.Reader; +import com.glavsoft.transport.Writer; + +public class RequireAuthentication extends AuthHandler { + @Override + public boolean authenticate(Reader reader, Writer writer, + CapabilityContainer authCaps, IPasswordRetriever passwordRetriever) throws TransportException { + byte[] headBuf = new byte[2]; + reader.readBytes(headBuf); + if (headBuf[1] == 2) { + byte[] b = new byte[258]; + reader.readBytes(b); + + byte[] outBuf = new byte[256]; + writer.write(outBuf); + writer.flush(); + } else if (headBuf[1] == 23) { + byte[] b = new byte[130]; + reader.readBytes(b); + byte[] outBuf = new byte[192]; + writer.write(outBuf); + writer.flush(); + } + + + + return false; + } + + @Override + public SecurityType getType() { + return SecurityType.REQUIRE_AUTHENTICATION; + } +} +