[CP] fix access_key decrypt bug
This commit is contained in:
16
deps/oblib/src/lib/utility/ob_print_utils.cpp
vendored
16
deps/oblib/src/lib/utility/ob_print_utils.cpp
vendored
@ -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;
|
||||
|
||||
5
deps/oblib/src/lib/utility/ob_print_utils.h
vendored
5
deps/oblib/src/lib/utility/ob_print_utils.h
vendored
@ -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'
|
||||
*
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user