#include "include/assert.h"
#include "include/str_list.h"
+#include "mds/MDSAuthCaps.h"
+#include "osd/OSDCap.h"
+
#define dout_subsys ceph_subsys_mon
#undef dout_prefix
#define dout_prefix _prefix(_dout, mon, get_last_committed())
return 0;
}
+bool AuthMonitor::valid_caps(const vector<string>& caps, ostream *out)
+{
+ for (vector<string>::const_iterator p = caps.begin();
+ p != caps.end(); p += 2) {
+ if ((p+1) == caps.end()) {
+ *out << "cap '" << *p << "' has no value";
+ return false;
+ }
+ if (*p == "mon") {
+ MonCap tmp;
+ if (!tmp.parse(*(p+1), out)) {
+ return false;
+ }
+ } else if (*p == "osd") {
+ OSDCap ocap;
+ if (!ocap.parse(*(p+1), out)) {
+ return false;
+ }
+ } else if (*p == "mds") {
+ MDSAuthCaps mdscap;
+ if (!mdscap.parse(g_ceph_context, *(p+1), out)) {
+ return false;
+ }
+ } else {
+ *out << "unknown cap type '" << *p << "'";
+ return false;
+ }
+ }
+ return true;
+}
+
bool AuthMonitor::prepare_command(MonOpRequestRef op)
{
MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
#include <set>
using namespace std;
+#include "global/global_init.h"
#include "include/ceph_features.h"
#include "include/types.h"
#include "msg/Messenger.h"
pending_auth.push_back(inc);
}
- /* validate mon caps ; don't care about caps for other services as
+ /* validate mon/osd/mds caps ; don't care about caps for other services as
* we don't know how to validate them */
- bool valid_caps(const vector<string>& caps, ostream *out) {
- for (vector<string>::const_iterator p = caps.begin();
- p != caps.end(); p += 2) {
- if (!p->empty() && *p != "mon")
- continue;
- MonCap tmp;
- if (!tmp.parse(*(p+1), out))
- return false;
- }
- return true;
- }
+ bool valid_caps(const vector<string>& caps, ostream *out);
void on_active();
bool should_propose(double& delay);
mon/Elector.cc \
mon/HealthMonitor.cc \
mon/DataHealthService.cc \
- mon/ConfigKeyService.cc
+ mon/ConfigKeyService.cc \
+ mds/MDSAuthCaps.cc \
+ osd/OSDCap.cc
libmon_a_LIBADD =
noinst_LIBRARIES += libmon.a