From: Adam Tkac Date: Tue, 1 Feb 2011 14:34:55 +0000 (+0000) Subject: [Development] Add Security::ToString method X-Git-Tag: v1.0.90~73 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a9a7b4b34a6b586312f7f253ba07f2b8f0531399;p=tigervnc.git [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 cbc72aef..dba14fdb 100644 --- a/common/rfb/Security.cxx +++ b/common/rfb/Security.cxx @@ -108,6 +108,30 @@ bool Security::IsSupported(U32 secType) return false; } +char *Security::ToString(void) +{ + list::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; diff --git a/common/rfb/Security.h b/common/rfb/Security.h index c5527dc6..832735a3 100644 --- a/common/rfb/Security.h +++ b/common/rfb/Security.h @@ -90,6 +90,9 @@ namespace rfb { /* Get list of enabled VeNCrypt subtypes */ const std::list GetEnabledExtSecTypes(void); + /* Output char* is stored in static array */ + char *ToString(void); + private: std::list enabledSecTypes; };