Signed-off-by: Martin Koegler <[email protected]>
---
common/rfb/Security.cxx | 34 +++++++++++++++++++++++-----------
common/rfb/Security.h | 21 +++++++++++----------
2 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx
index 8ea7572..ad51f1b 100644
--- a/common/rfb/Security.cxx
+++ b/common/rfb/Security.cxx
@@ -68,9 +68,21 @@ Security::Security(void)
delete secTypesStr;
}
-void Security::EnableSecType(U8 secType)
+const std::list<rdr::U8> Security::GetEnabledSecTypes(void)
{
- list<U8>::iterator i;
+ std::list<rdr::U8> result;
+ list<U32>::iterator i;
+
+ for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++)
+ if (*i < 0x100)
+ result.push_back(*i);
+
+ return result;
+}
+
+void Security::EnableSecType(U32 secType)
+{
+ list<U32>::iterator i;
for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++)
if (*i == secType)
@@ -79,9 +91,9 @@ void Security::EnableSecType(U8 secType)
enabledSecTypes.push_back(secType);
}
-bool Security::IsSupported(U8 secType)
+bool Security::IsSupported(U32 secType)
{
- list<U8>::iterator i;
+ list<U32>::iterator i;
for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++)
if (*i == secType)
@@ -90,7 +102,7 @@ bool Security::IsSupported(U8 secType)
return false;
}
-SSecurity* Security::GetSSecurity(U8 secType)
+SSecurity* Security::GetSSecurity(U32 secType)
{
if (!IsSupported(secType))
goto bail;
@@ -107,7 +119,7 @@ bail:
throw Exception("Security type not supported");
}
-CSecurity* Security::GetCSecurity(U8 secType)
+CSecurity* Security::GetCSecurity(U32 secType)
{
assert (CSecurity::upg != NULL); /* (upg == NULL) means bug in the viewer */
@@ -126,7 +138,7 @@ bail:
throw Exception("Security type not supported");
}
-rdr::U8 rfb::secTypeNum(const char* name)
+rdr::U32 rfb::secTypeNum(const char* name)
{
if (strcasecmp(name, "None") == 0) return secTypeNone;
if (strcasecmp(name, "VncAuth") == 0) return secTypeVncAuth;
@@ -139,7 +151,7 @@ rdr::U8 rfb::secTypeNum(const char* name)
return secTypeInvalid;
}
-const char* rfb::secTypeName(rdr::U8 num)
+const char* rfb::secTypeName(rdr::U32 num)
{
switch (num) {
case secTypeNone: return "None";
@@ -154,13 +166,13 @@ const char* rfb::secTypeName(rdr::U8 num)
}
}
-std::list<rdr::U8> rfb::parseSecTypes(const char* types_)
+std::list<rdr::U32> rfb::parseSecTypes(const char* types_)
{
- std::list<rdr::U8> result;
+ std::list<rdr::U32> result;
CharArray types(strDup(types_)), type;
while (types.buf) {
strSplit(types.buf, ',', &type.buf, &types.buf);
- rdr::U8 typeNum = secTypeNum(type.buf);
+ rdr::U32 typeNum = secTypeNum(type.buf);
if (typeNum != secTypeInvalid)
result.push_back(typeNum);
}
diff --git a/common/rfb/Security.h b/common/rfb/Security.h
index 4990a54..837f6b4 100644
--- a/common/rfb/Security.h
+++ b/common/rfb/Security.h
@@ -68,21 +68,22 @@ namespace rfb {
Security(void);
/* Enable/Disable certain security type */
- void EnableSecType(rdr::U8 secType);
- void DisableSecType(rdr::U8 secType) { enabledSecTypes.remove(secType); }
+ void EnableSecType(rdr::U32 secType);
+ void DisableSecType(rdr::U32 secType) { enabledSecTypes.remove(secType); }
/* Check if certain type is supported */
- bool IsSupported(rdr::U8 secType);
+ bool IsSupported(rdr::U32 secType);
/* Get list of enabled security types */
- const std::list<rdr::U8>& GetEnabledSecTypes(void)
+ const std::list<rdr::U8> GetEnabledSecTypes(void);
+ const std::list<rdr::U32>& GetEnabledExtSecTypes(void)
{ return enabledSecTypes; }
/* Create server side SSecurity class instance */
- SSecurity* GetSSecurity(rdr::U8 secType);
+ SSecurity* GetSSecurity(rdr::U32 secType);
/* Create client side CSecurity class instance */
- CSecurity* GetCSecurity(rdr::U8 secType);
+ CSecurity* GetCSecurity(rdr::U32 secType);
static StringParameter secTypes;
static void enableClientTypes();
@@ -92,12 +93,12 @@ namespace rfb {
* only in viewer-side code and MUST be set by viewer.
*/
private:
- std::list<rdr::U8> enabledSecTypes;
+ std::list<rdr::U32> enabledSecTypes;
};
- const char* secTypeName(rdr::U8 num);
- rdr::U8 secTypeNum(const char* name);
- std::list<rdr::U8> parseSecTypes(const char* types);
+ const char* secTypeName(rdr::U32 num);
+ rdr::U32 secTypeNum(const char* name);
+ std::list<rdr::U32> parseSecTypes(const char* types);
}
#endif
--
1.6.4.2
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Tigervnc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel