aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com
diff options
context:
space:
mode:
authorAdam Tkac <atkac@redhat.com>2010-11-11 14:06:42 +0000
committerAdam Tkac <atkac@redhat.com>2010-11-11 14:06:42 +0000
commit6a663cda55625a1560e7da93d920b214e187fa73 (patch)
tree5993b09465ffb816de05f307d5966b299d6d8caa /java/src/com
parent71def36c8950bd9c2b54e2e4a885d365ae0d49bb (diff)
downloadtigervnc-6a663cda55625a1560e7da93d920b214e187fa73.tar.gz
tigervnc-6a663cda55625a1560e7da93d920b214e187fa73.zip
[Development] java: Implement Plain Security type. (Martin Koegler)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4193 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/src/com')
-rw-r--r--java/src/com/tigervnc/vncviewer/RfbProto.java12
-rw-r--r--java/src/com/tigervnc/vncviewer/VncViewer.java8
2 files changed, 20 insertions, 0 deletions
diff --git a/java/src/com/tigervnc/vncviewer/RfbProto.java b/java/src/com/tigervnc/vncviewer/RfbProto.java
index ab3c1521..a0aade04 100644
--- a/java/src/com/tigervnc/vncviewer/RfbProto.java
+++ b/java/src/com/tigervnc/vncviewer/RfbProto.java
@@ -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.
diff --git a/java/src/com/tigervnc/vncviewer/VncViewer.java b/java/src/com/tigervnc/vncviewer/VncViewer.java
index 19541afe..41f484f9 100644
--- a/java/src/com/tigervnc/vncviewer/VncViewer.java
+++ b/java/src/com/tigervnc/vncviewer/VncViewer.java
@@ -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);
}