MCPcopy Create free account
hub / github.com/apache/trafficserver / CB_Load_Secret

Function CB_Load_Secret

tests/tools/plugins/ssl_secret_load_test.cc:94–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94int
95CB_Load_Secret(TSCont /* cont ATS_UNUSED */, TSEvent /* event ATS_UNUSED */, void *edata)
96{
97 TSSecretID *id = reinterpret_cast<TSSecretID *>(edata);
98
99 Dbg(dbg_ctl, "Load secret for %*.s", static_cast<int>(id->cert_name_len), id->cert_name);
100
101 std::string newname;
102 std::string data_item;
103 struct stat statdata;
104
105 update_file_name(std::string_view{id->cert_name, id->cert_name_len}, newname);
106
107 Dbg(dbg_ctl, "Really load secret for %s", newname.c_str());
108
109 // Load the secret and add it to the map
110 if (!load_file(newname, &statdata, data_item)) {
111 return TS_ERROR;
112 }
113 secret_versions.insert(std::make_pair(std::string{id->cert_name, id->cert_name_len}, statdata.st_mtime));
114
115 TSSslSecretSet(id->cert_name, id->cert_name_len, data_item.data(), data_item.size());
116
117 if (id->key_name_len > 0) {
118 Dbg(dbg_ctl, "Load secret for %*.s", static_cast<int>(id->key_name_len), id->key_name);
119 update_file_name(std::string_view{id->key_name, id->key_name_len}, newname);
120
121 Dbg(dbg_ctl, "Really load secret for %s", newname.c_str());
122
123 // Load the secret and add it to the map
124 if (!load_file(newname, &statdata, data_item)) {
125 return TS_ERROR;
126 }
127 secret_versions.insert(std::make_pair(std::string{id->key_name, id->key_name_len}, statdata.st_mtime));
128
129 TSSslSecretSet(id->key_name, id->key_name_len, data_item.data(), data_item.size());
130 }
131
132 return TS_SUCCESS;
133}
134
135int
136CB_Update_Secret(TSCont cont, TSEvent /* event ATS_UNUSED */, void * /* edata ATS_UNUSED */)

Callers

nothing calls this directly

Calls 7

update_file_nameFunction · 0.85
load_fileFunction · 0.85
TSSslSecretSetFunction · 0.85
c_strMethod · 0.45
insertMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected