]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: AuthMonitor: don't try to auth import a null buffer
authorSage Weil <sage@inktank.com>
Fri, 12 Jul 2013 20:12:51 +0000 (13:12 -0700)
committerSage Weil <sage@inktank.com>
Fri, 12 Jul 2013 22:50:49 +0000 (15:50 -0700)
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 <file>".

Fixes: #4599
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
src/mon/AuthMonitor.cc
src/mon/MonCommands.h

index feec3f523d8bb7d68267421178b2216714105556..9f8c2ea260d81429e2c9f9e28783e23c537f6367 100644 (file)
@@ -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 {
index 74f52bad87dedd97149254dd051f4be5a847f645..d93100f8219e8bde42c94b916fcc036315457e2f 100644 (file)
@@ -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 <file>", \
        "auth", "rw", "cli,rest")
 COMMAND("auth add " \
        "name=entity,type=CephString " \