]> source.dussan.org Git - tigervnc.git/commitdiff
Make sure attributes propagate through security wrappers 83/head
authorPierre Ossman <ossman@cendio.se>
Tue, 2 Dec 2014 14:13:22 +0000 (15:13 +0100)
committerPierre Ossman <ossman@cendio.se>
Tue, 2 Dec 2014 14:13:22 +0000 (15:13 +0100)
Both SSecurityVeNCrypt and SSecurityStack are wrappers around other
security objects, so they need to delegate the properties of those
sub-objects properly.

common/rfb/SSecurityStack.cxx
common/rfb/SSecurityStack.h
common/rfb/SSecurityVeNCrypt.cxx
common/rfb/SSecurityVeNCrypt.h

index 9ddc9f2fcbdf09caa36d07c2aeca04ccaf391902..478ce4f61f8597c82fd14baa8555f21a096bac41 100644 (file)
@@ -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;
+}
index c80a3b9f6a49274666fc8e1c347469ea724d862f..dd743d286345ea37dd139c431f7e95f671a5d5be 100644 (file)
@@ -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;
index 39647f6e6753212d37581a7a9551ce6c397cbb63..7c137498b50a923a4cc22bc6400b923781d77237 100644 (file)
@@ -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();
+}
index 849a702f34f4d5c05d703702b9afd583a8cee5e5..f9c753f0a7a1c604803c789aa461ee1d34daef0b 100644 (file)
@@ -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;