From: Sage Weil Date: Fri, 12 Jul 2013 20:12:51 +0000 (-0700) Subject: mon: AuthMonitor: don't try to auth import a null buffer X-Git-Tag: v0.67-rc1~59^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c0845a979919e270d0782dd48ab7f4f71e4b53d7;p=ceph.git mon: AuthMonitor: don't try to auth import a null buffer Hangs result if 'ceph auth import' is attempted without -i. Check for this case and return error status. Also, update auth import help to more-clearly indicate that "input" means "-i ". Fixes: #4599 Signed-off-by: Dan Mick Reviewed-by: Sage Weil --- diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index feec3f523d8b..9f8c2ea260d8 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -718,6 +718,12 @@ bool AuthMonitor::prepare_command(MMonCommand *m) if (prefix == "auth import") { bufferlist bl = m->get_data(); + if (bl.length() == 0) { + ss << "auth import: no data supplied"; + getline(ss, rs); + mon->reply_command(m, -EINVAL, rs, get_last_committed()); + return true; + } bufferlist::iterator iter = bl.begin(); KeyRing keyring; try { diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 74f52bad87de..d93100f8219e 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -159,7 +159,7 @@ COMMAND("auth print-key name=entity,type=CephString", "display requested key", \ COMMAND("auth print_key name=entity,type=CephString", "display requested key", \ "auth", "r", "cli,rest") COMMAND("auth list", "list authentication state", "auth", "r", "cli,rest") -COMMAND("auth import", "auth import: read keyring file from input", \ +COMMAND("auth import", "auth import: read keyring file from -i ", \ "auth", "rw", "cli,rest") COMMAND("auth add " \ "name=entity,type=CephString " \