[Development] Add Security::ToString method
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4245 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx
index cbc72ae..dba14fd 100644
--- a/common/rfb/Security.cxx
+++ b/common/rfb/Security.cxx
@@ -108,6 +108,30 @@
return false;
}
+char *Security::ToString(void)
+{
+ list<U32>::iterator i;
+ static char out[128]; /* Should be enough */
+ bool firstpass = true;
+ const char *name;
+
+ memset(out, 0, sizeof(out));
+
+ for (i = enabledSecTypes.begin(); i != enabledSecTypes.end(); i++) {
+ name = secTypeName(*i);
+ if (name[0] == '[') /* Unknown security type */
+ continue;
+
+ if (!firstpass)
+ strncat(out, ",", sizeof(out) - 1);
+ else
+ firstpass = false;
+ strncat(out, name, sizeof(out) - 1);
+ }
+
+ return out;
+}
+
rdr::U32 rfb::secTypeNum(const char* name)
{
if (strcasecmp(name, "None") == 0) return secTypeNone;