Skip to content

Commit

Permalink
check argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteYue committed Jul 10, 2024
1 parent bfb2443 commit 940247c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cloud/src/meta-service/meta_service_resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,15 @@ static int alter_storage_vault(InstanceInfoPB& instance, Transaction* txn,
msg = ss.str();
return -1;
}
const auto& obj_info = vault.obj_info();
if (obj_info.has_bucket() || obj_info.has_endpoint() || obj_info.has_prefix() ||
obj_info.has_provider()) {
code = MetaServiceCode::INVALID_ARGUMENT;
std::stringstream ss;
ss << "Only ak, sk can be altered";
msg = ss.str();
return -1;
}
const auto& name = vault.name();
auto name_itr = std::find_if(instance.storage_vault_names().begin(),
instance.storage_vault_names().end(),
Expand Down Expand Up @@ -555,7 +564,6 @@ static int alter_storage_vault(InstanceInfoPB& instance, Transaction* txn,
}
StorageVaultPB alter;
alter.ParseFromString(val);
const auto& obj_info = vault.obj_info();
if (obj_info.has_ak()) {
alter.mutable_obj_info()->set_ak(obj_info.ak());
}
Expand Down

0 comments on commit 940247c

Please sign in to comment.