@@ -6346,11 +6346,10 @@ void Server::handle_client_setvxattr(const MDRequestRef& mdr, CInode *cur)
63466346 client_t exclude_ct = mdr->get_client ();
63476347 mdcache->broadcast_quota_to_client (cur, exclude_ct, true );
63486348 } else if (name == " ceph.quiesce.block" sv) {
6349- bool val;
6350- try {
6351- val = boost::lexical_cast<bool >(value);
6352- } catch (boost::bad_lexical_cast const &) {
6353- dout (10 ) << " bad vxattr value, unable to parse bool for " << name << dendl;
6349+ std::string errstr;
6350+ bool val = strict_strtob (value, &errstr);
6351+ if (!errstr.empty ()) {
6352+ dout (10 ) << " bad vxattr value, unable to parse bool for " << name << " : " << errstr << dendl;
63546353 respond_to_request (mdr, -EINVAL);
63556354 return ;
63566355 }
@@ -6408,7 +6407,13 @@ void Server::handle_client_setvxattr(const MDRequestRef& mdr, CInode *cur)
64086407 }
64096408 value = " 0" ;
64106409 }
6411- val = boost::lexical_cast<bool >(value);
6410+ std::string errstr;
6411+ val = strict_strtob (value, &errstr);
6412+ if (!errstr.empty ()) {
6413+ dout (10 ) << " bad vxattr value, unable to parse bool for " << name << " : " << errstr << dendl;
6414+ respond_to_request (mdr, -EINVAL);
6415+ return ;
6416+ }
64126417 } catch (boost::bad_lexical_cast const &) {
64136418 dout (10 ) << " bad vxattr value, unable to parse bool for " << name << dendl;
64146419 respond_to_request (mdr, -EINVAL);
@@ -6557,7 +6562,13 @@ void Server::handle_client_setvxattr(const MDRequestRef& mdr, CInode *cur)
65576562 }
65586563 value = " 0" ;
65596564 }
6560- val = boost::lexical_cast<bool >(value);
6565+ std::string errstr;
6566+ val = strict_strtob (value, &errstr);
6567+ if (!errstr.empty ()) {
6568+ dout (10 ) << " bad vxattr value, unable to parse bool for " << name << " : " << errstr << dendl;
6569+ respond_to_request (mdr, -EINVAL);
6570+ return ;
6571+ }
65616572 } catch (boost::bad_lexical_cast const &) {
65626573 dout (10 ) << " bad vxattr value, unable to parse bool for " << name << dendl;
65636574 respond_to_request (mdr, -EINVAL);
@@ -6625,11 +6636,10 @@ void Server::handle_client_setvxattr(const MDRequestRef& mdr, CInode *cur)
66256636 return ;
66266637 }
66276638
6628- bool val;
6629- try {
6630- val = boost::lexical_cast<bool >(value);
6631- } catch (boost::bad_lexical_cast const &) {
6632- dout (10 ) << " bad vxattr value, unable to parse bool for " << name << dendl;
6639+ std::string errstr;
6640+ bool val = strict_strtob (value, &errstr);
6641+ if (!errstr.empty ()) {
6642+ dout (10 ) << " bad vxattr value, unable to parse bool for " << name << " : " << errstr << dendl;
66336643 respond_to_request (mdr, -EINVAL);
66346644 return ;
66356645 }
0 commit comments