diff options
author | Joao Eduardo Luis <joao.luis@inktank.com> | 2012-10-09 21:25:54 +0100 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-12-11 10:08:21 -0800 |
commit | acebcce91448421c34a72850a380fcd1aabe9f41 (patch) | |
tree | 5127365442a2bc05f7f090a99206cd8eaad4c243 | |
parent | 7ab00a796d2233c3804f52fbba16c2f3ed0c297b (diff) | |
download | ceph-acebcce91448421c34a72850a380fcd1aabe9f41.tar.gz |
mon: Monitor: resolve keyring option to a file before loading keyring
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>
(cherry picked from commit 7ef0df25e001bfae303feb3ae36514608767b1f2)
-rw-r--r-- | src/mon/Monitor.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1db0a257e4a..4be84ed0ce3 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2048,7 +2048,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; |