# HG changeset patch # User Nobuyasu Oshiro # Date 1319453478 -32400 # Node ID 1d16dcf966e134a8fc88fa33803fee2186d4470c # Parent 3c055da4d0504fb2e4e7234a15b37dbd87b50e3f# Parent 107b965effc1107a7d6626033257b415dcd8e91e merge 166 diff -r 107b965effc1 -r 1d16dcf966e1 .hgignore~ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore~ Mon Oct 24 19:51:18 2011 +0900 @@ -0,0 +1,6 @@ +syntax: glob +*.jar +GPATH +GRTAGS +GSYMS +GTAGS diff -r 107b965effc1 -r 1d16dcf966e1 build.xml~ --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.xml~ Mon Oct 24 19:51:18 2011 +0900 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 107b965effc1 -r 1d16dcf966e1 src/myVncProxy/MyRfbProto.java --- a/src/myVncProxy/MyRfbProto.java Wed Oct 19 12:00:16 2011 +0900 +++ b/src/myVncProxy/MyRfbProto.java Mon Oct 24 19:51:18 2011 +0900 @@ -39,6 +39,15 @@ * CheckMillis is one of new msgType for RFB 3.855. */ final static byte SpeedCheckMillis = 4; + + // Secyrity type of OS X + final static int SecTypeReqAccess = 32; + + // Supported authentication types + final static int AuthAccess = 32; + + + private static final int INFLATE_BUFSIZE = 1024*100; boolean printStatusFlag = false; long startCheckTime; @@ -129,6 +138,28 @@ servSock = new ServerSocket(port); acceptPort = port; } + + void authenticationRequestAccess() throws IOException { + + byte[] inBuf = new byte[260]; + int i = 0; + readFully(inBuf); + +// int[] data = {109, -98, -21, -71, -16, 54, 116, 53, -42, -46, -58, 71, 3, -59, 92, 29, -115, -67, -96, 97, -125, -55, 49, 91, 85, -54, 56, -11, 105, -68, -102, 5, 126, 60, -93, -12, 97, 4, 71, -12, -63, 36, 18, -111, -55, -24, -21, 89, 48, -104, 62, -55, 6, -49, -69, 126, -110, -26, -116, 3, 52, -91, 75, 112, 124, -103, -79, -50, 6, 21, 46, -119, -42, 100, 42, -42, -16, -9, -123, -101, 7, 83, 60, 102, -43, 112, -8, 61, -40, -46, 123, 76, -105, 98, -54, -59, 116, 81, 52, -60, 81, -107, -61, 101, -104, 18, 82, -71, -82, -25, 4, -64, 77, 25, 99, 10, -122, 4, -111, 79, -82, -114, 46, -14, 62, 100, -116, 103, 117, -102, -117, -32, 103, 110, 25, 23, 65, 30, -113, -36, -47, 115, 92, 55, -45, -98, -84, -120, -3, -1, -55, 87, -40, 62, 39, 32, -71, 96, 105, -109, 107, -3, 9, 84, 28, 14, -115, 1, -45, -94, 31, -57, 45, -20, 39, -109, -63, -57, 121, -127, -45, -96, 113, -103, 113, -36, -88, 72, -55, -22, -87, 24, -50, -57, -57, -125, -27, 42, 72, -78, 11, 43, -96, -111, 2, -43, 21, -87, 9, -49, -110, 126, 29, 62, -36, 84, 124, 30, -20, -38, -8, -9, -4, 114, -62, 29, -40, 41, 105, 22, 104, -51, -41, -28, -38, 96, -98, -119, -53, 2, 42, 6, 32, 92, -86, 127, 81, 59, -45, -24, -7, -88, 111, -41, -75, 16}; + byte[] outBuf = new byte[256]; + os.write(outBuf); + os.flush(); + + int result = readU32(); + if(result == 1) { + System.out.println("faild authentication "); + throw new IOException(); + } + + + + + } /* * default port number is 5999. @@ -280,14 +311,42 @@ // security-types // 1:None os.write(1); + +/* + os.write(4); + os.write(30); + os.write(31); + os.write(32); + os.write(35); + os.flush(); +*/ } void readSecType(InputStream is) throws IOException { byte[] b = new byte[1]; is.read(b); + } + + + void readSecType(InputStream is, OutputStream os) throws IOException { + byte[] b = new byte[1]; + is.read(b); + + int count = 260; + int[] data = {0, 2, 0, -128, -1, -1, -1, -1, -1, -1, -1, -1, -55, 15, -38, -94, 33, 104, -62, 52, -60, -58, 98, -117, -128, -36, 28, -47, 41, 2, 78, 8, -118, 103, -52, 116, 2, 11, -66, -90, 59, 19, -101, 34, 81, 74, 8, 121, -114, 52, 4, -35, -17, -107, 25, -77, -51, 58, 67, 27, 48, 43, 10, 109, -14, 95, 20, 55, 79, -31, 53, 109, 109, 81, -62, 69, -28, -123, -75, 118, 98, 94, 126, -58, -12, 76, 66, -23, -90, 55, -19, 107, 11, -1, 92, -74, -12, 6, -73, -19, -18, 56, 107, -5, 90, -119, -97, -91, -82, -97, 36, 17, 124, 75, 31, -26, 73, 40, 102, 81, -20, -26, 83, -127, -1, -1, -1, -1, -1, -1, -1, -1, -111, 73, -29, 30, 57, -67, -75, -77, -49, -50, -99, -76, -80, -80, 14, 65, 57, -105, -103, -54, -102, 3, 39, -44, 39, 35, 118, -84, -64, 37, -117, -21, 89, -31, -68, 70, 5, 122, -92, -119, 9, 121, 63, -112, -60, 122, -46, -69, -36, 92, -103, -92, 74, 92, -73, 87, 120, -8, 116, -47, 111, 20, -41, 110, 122, -3, -94, 14, 42, -51, -59, 48, -54, -125, 117, 60, 77, -52, -31, 98, 32, -2, -102, -15, -29, 58, -14, -106, -116, -32, -86, 50, -32, -16, -3, -123, 87, 88, -118, 10, 120, -107, -37, 125, -110, 59, 87, 93, -24, 124, -99, 18, 78, -13, -49, -34, -24, -27, 1, 114, -67, -98, -56, -3, 85, -67, -126, 77}; + for(int i=0; i bufs = c.poll(); int inputIndex = 0; diff -r 107b965effc1 -r 1d16dcf966e1 src/myVncProxy/RfbProto.java --- a/src/myVncProxy/RfbProto.java Wed Oct 19 12:00:16 2011 +0900 +++ b/src/myVncProxy/RfbProto.java Mon Oct 24 19:51:18 2011 +0900 @@ -349,7 +349,9 @@ // Find first supported security type. for (int i = 0; i < nSecTypes; i++) { - if (secTypes[i] == SecTypeNone || secTypes[i] == SecTypeVncAuth) { +// if (secTypes[i] == SecTypeNone || secTypes[i] == SecTypeVncAuth) { + if (secTypes[i] == SecTypeNone || secTypes[i] == SecTypeVncAuth + || secTypes[i] == MyRfbProto.SecTypeReqAccess ) { secType = secTypes[i]; break; } diff -r 107b965effc1 -r 1d16dcf966e1 src/myVncProxy/VncProxyService.java --- a/src/myVncProxy/VncProxyService.java Wed Oct 19 12:00:16 2011 +0900 +++ b/src/myVncProxy/VncProxyService.java Mon Oct 24 19:51:18 2011 +0900 @@ -301,6 +301,10 @@ } switch (authType) { + case MyRfbProto.AuthAccess: + rfb.authenticationRequestAccess(); + System.out.println("authenticateion Request right of Acces"); + break; case RfbProto.AuthNone: showConnectionStatus("No authentication needed"); rfb.authenticateNone();