]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Also check min/max uid on snap removal
authorWido den Hollander <wido@42on.com>
Fri, 8 Aug 2014 10:03:56 +0000 (12:03 +0200)
committerWido den Hollander <wido@42on.com>
Fri, 8 Aug 2014 10:03:56 +0000 (12:03 +0200)
Not only check if the uid is correct when creating a snapshot, but also
verify if the UID is correct when trying to remove a snapshot.

Fixes: #9029
src/common/config_opts.h
src/mds/Server.cc

index ee4353f2af93b9ccd1c299f5d6ab325c70c7bb36..57089d99bffe7a4bf1dd8d18fe81984f2282b8c3 100644 (file)
@@ -383,8 +383,8 @@ OPTION(mds_op_history_size, OPT_U32, 20)    // Max number of completed ops to tr
 OPTION(mds_op_history_duration, OPT_U32, 600) // Oldest completed op to track
 OPTION(mds_op_complaint_time, OPT_FLOAT, 30) // how many seconds old makes an op complaint-worthy
 OPTION(mds_op_log_threshold, OPT_INT, 5) // how many op log messages to show in one go
-OPTION(mds_snap_min_uid, OPT_U32, 0) // The minimum UID required to create a snapshot
-OPTION(mds_snap_max_uid, OPT_U32, 65536) // The maximum UID allowed to create a snapshot
+OPTION(mds_mksnap_min_uid, OPT_U32, 0) // The minimum UID required to create a snapshot
+OPTION(mds_mksnap_max_uid, OPT_U32, 65536) // The maximum UID allowed to create a snapshot
 
 // If true, compact leveldb store on mount
 OPTION(osd_compact_leveldb_on_mount, OPT_BOOL, false)
index dbf0f07da33e636e4562eb3dc121924eb2b2eac1..b9704f41088b42114f6ecd544d7475279bdc0065 100644 (file)
@@ -7373,7 +7373,7 @@ void Server::handle_client_mksnap(MDRequestRef& mdr)
   
   const string &snapname = req->get_filepath().last_dentry();
 
-  if (mdr->client_request->get_caller_uid() < g_conf->mds_snap_min_uid || mdr->client_request->get_caller_uid() > g_conf->mds_snap_max_uid) {
+  if (mdr->client_request->get_caller_uid() < g_conf->mds_mksnap_min_uid || mdr->client_request->get_caller_uid() > g_conf->mds_mksnap_max_uid) {
     dout(20) << "mksnap " << snapname << " on " << *diri << " denied to uid " << mdr->client_request->get_caller_uid() << dendl;
     reply_request(mdr, -EPERM);
     return;
@@ -7511,6 +7511,13 @@ void Server::handle_client_rmsnap(MDRequestRef& mdr)
   }
 
   const string &snapname = req->get_filepath().last_dentry();
+
+  if (mdr->client_request->get_caller_uid() < g_conf->mds_mksnap_min_uid || mdr->client_request->get_caller_uid() > g_conf->mds_mksnap_max_uid) {
+    dout(20) << "rmsnap " << snapname << " on " << *diri << " denied to uid " << mdr->client_request->get_caller_uid() << dendl;
+    reply_request(mdr, -EPERM);
+    return;
+  }
+
   dout(10) << "rmsnap " << snapname << " on " << *diri << dendl;
 
   // does snap exist?