MCPcopy Create free account
hub / github.com/ceph/ceph / decode

Method decode

src/auth/KeyRing.cc:162–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void KeyRing::decode(bufferlist::const_iterator& bli)
163{
164 int ret;
165 bufferlist bl;
166 bli.copy_all(bl);
167 ConfFile cf;
168
169 if (cf.parse_bufferlist(&bl, nullptr) != 0) {
170 throw ceph::buffer::malformed_input("cannot parse buffer");
171 }
172
173 for (auto& [name, section] : cf) {
174 if (name == "global")
175 continue;
176
177 EntityName ename;
178 map<string, bufferlist> caps;
179 if (!ename.from_str(name)) {
180 ostringstream oss;
181 oss << "bad entity name in keyring: " << name;
182 throw ceph::buffer::malformed_input(oss.str().c_str());
183 }
184
185 for (auto& [k, val] : section) {
186 if (k.empty())
187 continue;
188 string key;
189 std::replace_copy(k.begin(), k.end(), back_inserter(key), '_', ' ');
190 ret = set_modifier(key.c_str(), val.c_str(), ename, caps);
191 if (ret < 0) {
192 ostringstream oss;
193 oss << "error setting modifier for [" << name << "] type=" << key
194 << " val=" << val;
195 throw ceph::buffer::malformed_input(oss.str().c_str());
196 }
197 }
198 }
199}
200
201int KeyRing::load(CephContext *cct, const std::string &filename)
202{

Callers

nothing calls this directly

Calls 9

copy_allMethod · 0.80
parse_bufferlistMethod · 0.80
malformed_inputClass · 0.50
from_strMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected