]> source.dussan.org Git - tigervnc.git/commitdiff
[Development] java: Implement Plain Security type. (Martin Koegler)
authorAdam Tkac <atkac@redhat.com>
Thu, 11 Nov 2010 14:06:42 +0000 (14:06 +0000)
committerAdam Tkac <atkac@redhat.com>
Thu, 11 Nov 2010 14:06:42 +0000 (14:06 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4193 3789f03b-4d11-0410-bbf8-ca57d06f2519

java/src/com/tigervnc/vncviewer/RfbProto.java
java/src/com/tigervnc/vncviewer/VncViewer.java

index ab3c1521fb14f01d01113953154aa145c3c656bc..a0aade044876fe75c3dc05f8daf016ce66e07d26 100644 (file)
@@ -430,6 +430,7 @@ class RfbProto {
                {
                case SecTypeNone:
                case SecTypeVncAuth:
+               case SecTypePlain:
                    writeInt(secTypes[i]);
                    return secTypes[i];
                }
@@ -475,6 +476,17 @@ class RfbProto {
     readSecurityResult("VNC authentication");
   }
 
+    void authenticatePlain(String User, String Password) throws Exception {
+      byte[] user=User.getBytes();
+      byte[] password=Password.getBytes();
+      writeInt(user.length);
+      writeInt(password.length);
+      os.write(user);
+      os.write(password);
+
+      readSecurityResult("Plain authentication");
+    }
+
   //
   // Read security result.
   // Throws an exception on authentication failure.
index 19541afe9718523cfe2c5d9c2a9a1d936c3d7670..41f484f9a318ec37a1ae6a6fac6a8ccccea1d84e 100644 (file)
@@ -384,6 +384,14 @@ public class VncViewer extends java.applet.Applet
            secType = rfb.authenticateVeNCrypt();
            doAuthentification(secType);
            break;
+       case RfbProto.SecTypePlain:
+           showConnectionStatus("Plain authentication");
+           {
+               String user = askUser();
+               String pw = askPassword();
+               rfb.authenticatePlain(user,pw);
+           }
+           break;
        default:
            throw new Exception("Unknown authentication scheme " + secType);
        }