]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: do a shallow copy for MetaRequest::perms
authorGreg Farnum <gfarnum@redhat.com>
Mon, 12 Sep 2016 22:42:26 +0000 (15:42 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:57 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/MetaRequest.h
src/client/UserPerm.h

index 3d0fc4488fc9f62c7125e7d7180a71e9e1d081c5..f28f36af896528f52787b50778be6165a627be78 100644 (file)
@@ -172,7 +172,7 @@ public:
   void set_filepath2(const filepath& fp) { path2 = fp; }
   void set_string2(const char *s) { path2.set_path(s, 0); }
   void set_caller_perms(const UserPerm& _perms) {
-    perms = _perms;
+    perms.shallow_copy(_perms);
     head.caller_uid = perms.uid();
     head.caller_gid = perms.gid();
   }
index b1af6cdaec1677536dd4583162fa5f93b0cca02d..43b5347d2045c3e530571c5a21404ec571677793 100644 (file)
@@ -58,8 +58,7 @@ public:
     deep_copy(*this, o);
     return *this;
   }
-  // FIXME: stop doing a deep-copy all the time. We need it on stuff
-  // that lasts longer than a single "syscall", but not for MetaRequests et al
+
   uid_t uid() const { return m_uid; }
   gid_t gid() const { return m_gid; }
   bool gid_in_groups(gid_t gid) const {
@@ -75,6 +74,13 @@ public:
     gid_count = count;
   }
   void take_gids() { alloced_gids = true; }
+  void shallow_copy(const UserPerm& o) {
+    m_uid = o.m_uid;
+    m_gid = o.m_gid;
+    gid_count = o.gid_count;
+    gids = o.gids;
+    alloced_gids = false;
+  }
 };
 
 #endif