[CP] fix access_key decrypt bug

This commit is contained in:
WenJinyu
2023-01-06 04:08:09 +00:00
committed by ob-robot
parent 82de09db7c
commit 889807b98b
3 changed files with 22 additions and 1 deletions

View File

@ -52,6 +52,21 @@ int hex_to_cstr(const void *in_data,
const int64_t buff_size)
{
int ret = OB_SUCCESS;
int64_t pos = 0;
if (OB_FAIL(hex_to_cstr(in_data, data_length, buff, buff_size, pos))) {
LOG_WARN("fail to hex to cstr", K(ret), K(in_data));
}
return ret;
}
int hex_to_cstr(const void *in_data,
const int64_t data_length,
char *buff,
const int64_t buff_size,
int64_t &pos)
{
int ret = OB_SUCCESS;
pos = 0;
if (OB_ISNULL(in_data) || 0 != data_length % 2
|| OB_ISNULL(buff) || buff_size < data_length / 2 + 1) {
ret = OB_INVALID_ARGUMENT;
@ -69,6 +84,7 @@ int hex_to_cstr(const void *in_data,
}
}
if (OB_SUCC(ret)) {
pos = data_length / 2;
buff[data_length / 2] = '\0';
}
return ret;

View File

@ -43,6 +43,11 @@ int hex_to_cstr(const void *in_data,
const int64_t data_lenth,
char *buff,
const int64_t buff_size);
int hex_to_cstr(const void *in_data,
const int64_t data_length,
char *buff,
const int64_t buff_size,
int64_t &pos);
/**
* convert the input buffer into hex string, not include '\0'
*

View File

@ -1310,7 +1310,7 @@ int ObBackupStorageInfo::parse_authorization_(const char *authorization)
}
} else if (0 == strncmp(ACCESS_KEY, token, strlen(ACCESS_KEY))) {
if (OB_FAIL(set_storage_info_field_(token, access_key_, sizeof(access_key_)))) {
LOG_WARN("failed to set access id", K(ret), K(token));
LOG_WARN("failed to set access key", K(ret), K(token));
}
} else {
ret = OB_INVALID_ARGUMENT;