TSG-22708 Adapt to the change in the DECRYPTION_KEYRING table name

This commit is contained in:
fengweihao
2024-10-16 16:52:26 +08:00
parent 498c7328b1
commit d581a97262
3 changed files with 16 additions and 15 deletions

View File

@@ -1105,7 +1105,7 @@ finish:
static struct pxy_obj_keyring* get_obj_for_id(char *keyring_uuid_str)
{
struct pxy_obj_keyring *pxy_obj=NULL;
pxy_obj = (struct pxy_obj_keyring*)maat_plugin_table_get_ex_data(g_cert_store->instance, "PXY_PROFILE_KEYRING", keyring_uuid_str, strlen(keyring_uuid_str));
pxy_obj = (struct pxy_obj_keyring*)maat_plugin_table_get_ex_data(g_cert_store->instance, "DECRYPTION_KEYRING", keyring_uuid_str, strlen(keyring_uuid_str));
return pxy_obj;
}
@@ -1566,7 +1566,7 @@ int http_get_request_uri(struct evhttp_request *evh_req, struct http_request *re
const char *keyring_uuid_str=NULL, *is_valid=NULL, *sni=NULL;
keyring_uuid_str = evhttp_find_header(&headers, "keyring_uuid_str");
keyring_uuid_str = evhttp_find_header(&headers, "keyring_id");
if(keyring_uuid_str == NULL)
{
xret =-1;
@@ -2238,7 +2238,7 @@ void keyring_table_new_cb(const char *table_name, const char *key, const char* t
cJSON* pxy_profile_keyring = cJSON_Parse(table_line);
if(pxy_profile_keyring == NULL)
{
mesa_runtime_log(RLOG_LV_INFO, MODULE_NAME, "PXY_PROFILE_KEYRING parse table_line failed %s", table_line);
mesa_runtime_log(RLOG_LV_INFO, MODULE_NAME, "DECRYPTION_KEYRING parse table_line failed %s", table_line);
return;
}
@@ -2262,12 +2262,12 @@ void keyring_table_new_cb(const char *table_name, const char *key, const char* t
{
memcpy(pxy_obj->keyring_type, value_string, strlen(value_string));
}
value_string = keyring_get_value_string(pxy_profile_keyring, "private_key_path");
value_string = keyring_get_value_string(pxy_profile_keyring, "private_key_file");
if(value_string != NULL)
{
private_file = value_string;
}
value_string = keyring_get_value_string(pxy_profile_keyring, "public_key_path");
value_string = keyring_get_value_string(pxy_profile_keyring, "public_key_file");
if(value_string != NULL)
{
public_file = value_string;
@@ -2283,13 +2283,13 @@ void keyring_table_new_cb(const char *table_name, const char *key, const char* t
memcpy(pxy_obj->v3_ctl, value_string, strlen(value_string));
}
int value_int = keyring_get_value_number(pxy_profile_keyring, "reissue_expiry_hour");
int value_int = keyring_get_value_number(pxy_profile_keyring, "reissue_expiry_date");
if(value_int > 0)
{
pxy_obj->expire_time = value_int;
}
value_int = keyring_get_value_number(pxy_profile_keyring, "include_root");
value_int = keyring_get_value_number(pxy_profile_keyring, "is_send_root_cert");
if(value_int > 0)
{
pxy_obj->is_send = value_int;
@@ -2442,7 +2442,7 @@ int kerying_profile_init(const char * main_profile)
{
goto finish;
}
ret=maat_plugin_table_ex_schema_register(g_cert_store->instance, "PXY_PROFILE_KEYRING", keyring_table_new_cb,keyring_table_free_cb,
ret=maat_plugin_table_ex_schema_register(g_cert_store->instance, "DECRYPTION_KEYRING", keyring_table_new_cb,keyring_table_free_cb,
keyring_table_dup_cb, 0, NULL);
if(ret<0)
{
@@ -2450,7 +2450,7 @@ int kerying_profile_init(const char * main_profile)
}
return 0;
finish:
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "certstore register table PXY_PROFILE_KEYRING failed");
mesa_runtime_log(RLOG_LV_FATAL, MODULE_NAME, "certstore register table DECRYPTION_KEYRING failed");
exit(1);
return -1;
}

View File

@@ -3,11 +3,11 @@
"object2object_table": "OBJECT_GROUP",
"plugin_table": [
{
"table_name": "PXY_PROFILE_KEYRING",
"table_name": "DECRYPTION_KEYRING",
"table_content": [
{"uuid":"fbc46c83-426e-4998-b712-362351896d08","name":"root","keyring_type":"root","private_key_path":"/home/fengweihao/tool/test_cert/root/tango-ca-v3-trust-ca.pem","public_key_path":"/home/fengweihao/tool/test_cert/root/tango-ca-v3-trust-ca.pem","reissue_expiry_hour":24,"include_root":0,"public_key_algo":"rsa2048","crl":"null","use_hsm":0,"slot_id":0,"vsys":"1","is_valid":1,"modified_time":"1716531859000000"},
{"uuid":"9aacf38b-11e9-4859-a754-d66fae988801","name":"intermediate","keyring_type":"intermediate","private_key_path":"/home/fengweihao/tool/test_cert/Intermediate/tang-ca-v3-intermediate-01-key.pem","public_key_path":"/home/fengweihao/tool/test_cert/Intermediate/tang-ca-v3-intermediate-01-cer.pem","reissue_expiry_hour":24,"include_root":1,"public_key_algo":"rsa2048","crl":"null","use_hsm":0,"slot_id":0,"vsys":"1","is_valid":1,"modified_time":"1716531859000000"},
{"uuid":"21d04c59-35c3-4b36-b05c-c373f6fe7ab3","name":"end-entity","keyring_type":"end-entity","private_key_path":"/home/fengweihao/tool/test_cert/end-entity/tang-ca-v3-www.bing.com-key.pem","public_key_path":"/home/fengweihao/tool/test_cert/end-entity/tang-ca-v3-www.bing.com-cer.pem","reissue_expiry_hour":24,"include_root":1,"public_key_algo":"rsa2048","crl":"null","use_hsm":0,"slot_id":0,"vsys":"1","is_valid":1,"modified_time":"1716531859000000"}
{"uuid":"fbc46c83-426e-4998-b712-362351896d08","name":"root","keyring_type":"root","private_key_file":"/home/fengweihao/tool/test_cert/root/tango-ca-v3-trust-ca.pem","public_key_file":"/home/fengweihao/tool/test_cert/root/tango-ca-v3-trust-ca.pem","reissue_expiry_date":24,"is_send_root_cert":0,"public_key_algo":"rsa2048","crl":"null","use_hsm":0,"slot_id":0,"vsys":"1","is_valid":1},
{"uuid":"9aacf38b-11e9-4859-a754-d66fae988801","name":"intermediate","keyring_type":"intermediate","private_key_file":"/home/fengweihao/tool/test_cert/Intermediate/tang-ca-v3-intermediate-01-key.pem","public_key_file":"/home/fengweihao/tool/test_cert/Intermediate/tang-ca-v3-intermediate-01-cer.pem","reissue_expiry_date":24,"is_send_root_cert":1,"public_key_algo":"rsa2048","crl":"null","use_hsm":0,"slot_id":0,"vsys":"1","is_valid":1},
{"uuid":"21d04c59-35c3-4b36-b05c-c373f6fe7ab3","name":"end-entity","keyring_type":"end-entity","private_key_file":"/home/fengweihao/tool/test_cert/end-entity/tang-ca-v3-www.bing.com-key.pem","public_key_file":"/home/fengweihao/tool/test_cert/end-entity/tang-ca-v3-www.bing.com-cer.pem","reissue_expiry_date":24,"is_send_root_cert":1,"public_key_algo":"rsa2048","crl":"null","use_hsm":0,"slot_id":0,"vsys":"1","is_valid":1}
]
}
]

View File

@@ -1,11 +1,12 @@
[
{
"table_id":0,
"table_name":"PXY_PROFILE_KEYRING",
"table_name":"DECRYPTION_KEYRING",
"table_type":"plugin",
"custom": {
"key_name":"uuid",
"key_type":"pointer"
"key_type":"pointer",
"foreign_names": ["private_key_file", "public_key_file"]
}
}
]