]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: OSDMonitor: return EINVAL if we unable to parse addr
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 7 Mar 2016 15:08:48 +0000 (23:08 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 7 Apr 2016 09:29:21 +0000 (17:29 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
qa/workunits/cephtool/test.sh
src/mon/OSDMonitor.cc

index 7fabf508fa7fec6979cbbbaaad08f64c3e2e6301..1d70ba9e4813d3e8eb3825aeda74abac41af1c36 100755 (executable)
@@ -1041,6 +1041,9 @@ function test_mon_osd()
   expect_false "ceph osd blacklist $bl/-1"
   expect_false "ceph osd blacklist $bl/foo"
 
+  # test with wrong address
+  expect_false "ceph osd blacklist 1234.56.78.90/100"
+
   # Test `clear`
   ceph osd blacklist add $bl
   ceph osd blacklist ls | grep $bl
index b6e0668edd647953314b8c4067b8d24d24578f58..b87b567b15203be8b012aabc4556cb1168f3393c 100644 (file)
@@ -6732,8 +6732,11 @@ done:
     string addrstr;
     cmd_getval(g_ceph_context, cmdmap, "addr", addrstr);
     entity_addr_t addr;
-    if (!addr.parse(addrstr.c_str(), 0))
+    if (!addr.parse(addrstr.c_str(), 0)) {
       ss << "unable to parse address " << addrstr;
+      err = -EINVAL;
+      goto reply;
+    }
     else {
       string blacklistop;
       cmd_getval(g_ceph_context, cmdmap, "blacklistop", blacklistop);