summaryrefslogtreecommitdiffstats
path: root/common/rfb/Security.cxx
diff options
context:
space:
mode:
authorAdam Tkac <atkac@redhat.com>2010-10-01 08:33:29 +0000
committerAdam Tkac <atkac@redhat.com>2010-10-01 08:33:29 +0000
commitbfd66c1e8c526dff1757bf349c9bb4d87906265f (patch)
tree35bc549a432e2b823e215483e666afb2e832ebbe /common/rfb/Security.cxx
parentef5e17fe2f7c0ab7b47aa616960dfa9fffd7425a (diff)
downloadtigervnc-bfd66c1e8c526dff1757bf349c9bb4d87906265f.tar.gz
tigervnc-bfd66c1e8c526dff1757bf349c9bb4d87906265f.zip
[Development] Move Get{C,S}Security from Security class to separate classes.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4156 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb/Security.cxx')
-rw-r--r--common/rfb/Security.cxx102
1 files changed, 2 insertions, 100 deletions
diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx
index 2ea51fac..cbc72aef 100644
--- a/common/rfb/Security.cxx
+++ b/common/rfb/Security.cxx
@@ -52,41 +52,11 @@ using namespace std;
static LogWriter vlog("Security");
-UserPasswdGetter *CSecurity::upg = NULL;
-
-StringParameter Security::secTypesViewer
-("SecurityTypes",
- "Specify which security scheme to use (None, VncAuth)",
-#ifdef HAVE_GNUTLS
- "VeNCrypt,X509Plain,TLSPlain,X509Vnc,TLSVnc,X509None,TLSNone,VncAuth,None",
-#else
- "VncAuth,None",
-#endif
-ConfViewer);
-
-StringParameter Security::secTypesServer
-("SecurityTypes",
- "Specify which security scheme to use (None, VncAuth)",
-#ifdef HAVE_GNUTLS
- "VeNCrypt,TLSVnc,VncAuth",
-#else
- "VncAuth",
-#endif
-ConfServer);
-
-Security::Security(SecurityClassType secClassType)
+Security::Security(StringParameter &secTypes)
{
char *secTypesStr;
- switch (secClassType) {
- case SecurityViewer:
- secTypesStr = secTypesViewer.getData();
- break;
- case SecurityServer:
- secTypesStr = secTypesServer.getData();
- break;
- };
-
+ secTypesStr = secTypes.getData();
enabledSecTypes = parseSecTypes(secTypesStr);
delete secTypesStr;
@@ -138,74 +108,6 @@ bool Security::IsSupported(U32 secType)
return false;
}
-SSecurity* Security::GetSSecurity(U32 secType)
-{
- if (!IsSupported(secType))
- goto bail;
-
- switch (secType) {
- case secTypeNone: return new SSecurityNone();
- case secTypeVncAuth: return new SSecurityVncAuth();
- case secTypeVeNCrypt: return new SSecurityVeNCrypt(this);
- case secTypePlain: return new SSecurityPlain();
-#ifdef HAVE_GNUTLS
- case secTypeTLSNone:
- return new SSecurityStack(secTypeTLSNone, new SSecurityTLS(true));
- case secTypeTLSVnc:
- return new SSecurityStack(secTypeTLSVnc, new SSecurityTLS(true), new SSecurityVncAuth());
- case secTypeTLSPlain:
- return new SSecurityStack(secTypeTLSPlain, new SSecurityTLS(true), new SSecurityPlain());
- case secTypeX509None:
- return new SSecurityStack(secTypeX509None, new SSecurityTLS(false));
- case secTypeX509Vnc:
- return new SSecurityStack(secTypeX509None, new SSecurityTLS(false), new SSecurityVncAuth());
- case secTypeX509Plain:
- return new SSecurityStack(secTypeX509Plain, new SSecurityTLS(false), new SSecurityPlain());
-#endif
- }
-
-bail:
- throw Exception("Security type not supported");
-}
-
-CSecurity* Security::GetCSecurity(U32 secType)
-{
- assert (CSecurity::upg != NULL); /* (upg == NULL) means bug in the viewer */
-
- if (!IsSupported(secType))
- goto bail;
-
- switch (secType) {
- case secTypeNone: return new CSecurityNone();
- case secTypeVncAuth: return new CSecurityVncAuth();
- case secTypeVeNCrypt: return new CSecurityVeNCrypt(this);
- case secTypePlain: return new CSecurityPlain();
-#ifdef HAVE_GNUTLS
- case secTypeTLSNone:
- return new CSecurityStack(secTypeTLSNone, "TLS with no password",
- new CSecurityTLS(true));
- case secTypeTLSVnc:
- return new CSecurityStack(secTypeTLSVnc, "TLS with VNCAuth",
- new CSecurityTLS(true), new CSecurityVncAuth());
- case secTypeTLSPlain:
- return new CSecurityStack(secTypeTLSPlain, "TLS with Username/Password",
- new CSecurityTLS(true), new CSecurityPlain());
- case secTypeX509None:
- return new CSecurityStack(secTypeX509None, "X509 with no password",
- new CSecurityTLS(false));
- case secTypeX509Vnc:
- return new CSecurityStack(secTypeX509None, "X509 with VNCAuth",
- new CSecurityTLS(false), new CSecurityVncAuth());
- case secTypeX509Plain:
- return new CSecurityStack(secTypeX509Plain, "X509 with Username/Password",
- new CSecurityTLS(false), new CSecurityPlain());
-#endif
- }
-
-bail:
- throw Exception("Security type not supported");
-}
-
rdr::U32 rfb::secTypeNum(const char* name)
{
if (strcasecmp(name, "None") == 0) return secTypeNone;