]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: Monitor: resolve keyring option to a file before loading keyring
authorJoao Eduardo Luis <joao.luis@inktank.com>
Tue, 9 Oct 2012 20:25:54 +0000 (21:25 +0100)
committerSage Weil <sage@inktank.com>
Tue, 9 Oct 2012 20:36:28 +0000 (13:36 -0700)
Otherwise our keyring default location, or any other similarly formatted
location, will be taken as the actual location for the keyring and fail.

Reported-by: tziOm (at) #ceph
Fixes: 3276
Backport: argonaut

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/Monitor.cc

index 57de1ca54cef7186de6786aeb92bf00eb892f2eb..73280b0e8780a1c264d3a167f348ccc8c1df4d38 100644 (file)
@@ -2383,7 +2383,13 @@ int Monitor::mkfs(bufferlist& osdmapbl)
   }
 
   KeyRing keyring;
-  r = keyring.load(g_ceph_context, g_conf->keyring);
+  string keyring_filename;
+  if (!ceph_resolve_file_search(g_conf->keyring, keyring_filename)) {
+    derr << "unable to find a keyring file on " << g_conf->keyring << dendl;
+    return -ENOENT;
+  }
+
+  r = keyring.load(g_ceph_context, keyring_filename);
   if (r < 0) {
     derr << "unable to load initial keyring " << g_conf->keyring << dendl;
     return r;