From: Pierre Ossman Date: Tue, 2 Dec 2014 14:13:22 +0000 (+0100) Subject: Make sure attributes propagate through security wrappers X-Git-Tag: v1.4.90~71^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=555815a4e3e14c67ac00130f7affa0138ff47d20;p=tigervnc.git Make sure attributes propagate through security wrappers Both SSecurityVeNCrypt and SSecurityStack are wrappers around other security objects, so they need to delegate the properties of those sub-objects properly. --- diff --git a/common/rfb/SSecurityStack.cxx b/common/rfb/SSecurityStack.cxx index 9ddc9f2f..478ce4f6 100644 --- a/common/rfb/SSecurityStack.cxx +++ b/common/rfb/SSecurityStack.cxx @@ -65,3 +65,20 @@ const char* SSecurityStack::getUserName() const return c; } + +SConnection::AccessRights SSecurityStack::getAccessRights() const +{ + SConnection::AccessRights accessRights; + + if (!state0 && !state1) + return SSecurity::getAccessRights(); + + accessRights = SConnection::AccessFull; + + if (state0) + accessRights &= state0->getAccessRights(); + if (state1) + accessRights &= state1->getAccessRights(); + + return accessRights; +} diff --git a/common/rfb/SSecurityStack.h b/common/rfb/SSecurityStack.h index c80a3b9f..dd743d28 100644 --- a/common/rfb/SSecurityStack.h +++ b/common/rfb/SSecurityStack.h @@ -31,6 +31,7 @@ namespace rfb { virtual bool processMsg(SConnection* cc); virtual int getType() const { return type; }; virtual const char* getUserName() const; + virtual SConnection::AccessRights getAccessRights() const; protected: short state; SSecurity* state0; diff --git a/common/rfb/SSecurityVeNCrypt.cxx b/common/rfb/SSecurityVeNCrypt.cxx index 39647f6e..7c137498 100644 --- a/common/rfb/SSecurityVeNCrypt.cxx +++ b/common/rfb/SSecurityVeNCrypt.cxx @@ -171,3 +171,16 @@ bool SSecurityVeNCrypt::processMsg(SConnection* sc) return ssecurity->processMsg(sc); } +const char* SSecurityVeNCrypt::getUserName() const +{ + if (ssecurity == NULL) + return NULL; + return ssecurity->getUserName(); +} + +SConnection::AccessRights SSecurityVeNCrypt::getAccessRights() const +{ + if (ssecurity == NULL) + return SSecurity::getAccessRights(); + return ssecurity->getAccessRights(); +} diff --git a/common/rfb/SSecurityVeNCrypt.h b/common/rfb/SSecurityVeNCrypt.h index 849a702f..f9c753f0 100644 --- a/common/rfb/SSecurityVeNCrypt.h +++ b/common/rfb/SSecurityVeNCrypt.h @@ -39,8 +39,9 @@ namespace rfb { SSecurityVeNCrypt(SecurityServer *sec); ~SSecurityVeNCrypt(); virtual bool processMsg(SConnection* sc);// { return true; } - virtual int getType() const { return secTypeVeNCrypt; } - virtual const char* getUserName() const { return NULL; } + virtual int getType() const { return chosenType; } + virtual const char* getUserName() const; + virtual SConnection::AccessRights getAccessRights() const; protected: SSecurity *ssecurity;