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

Method loadSecret

src/iocore/net/SSLSecret.cc:58–85  ·  view source on GitHub ↗

NOTE: The secret_map_mutex should not be held by the caller of this function. The implementation of this function may call a plugin's TS_EVENT_SSL_SECRET handler which in turn may grab a lock for secret_map_mutex via a TSSslSecretSet call. These events will result in a deadlock.

Source from the content-addressed store, hash-verified

56// secret_map_mutex via a TSSslSecretSet call. These events will result in a
57// deadlock.
58void
59SSLSecret::loadSecret(const std::string &name1, const std::string &name2, std::string &data1, std::string &data2)
60{
61 // Call the load secret hooks
62 //
63 class APIHook *curHook = g_lifecycle_hooks->get(TS_LIFECYCLE_SSL_SECRET_HOOK);
64 TSSecretID secret_name;
65 secret_name.cert_name = name1.data();
66 secret_name.cert_name_len = name1.size();
67 secret_name.key_name = name2.data();
68 secret_name.key_name_len = name2.size();
69 while (curHook) {
70 curHook->blocking_invoke(TS_EVENT_SSL_SECRET, &secret_name);
71 curHook = curHook->next();
72 }
73
74 data1 = this->getSecret(name1);
75 data2 = name2.empty() ? std::string{} : this->getSecret(name2);
76 if (data1.empty() || (!name2.empty() && data2.empty())) {
77 // If none of them loaded it, assume it is a file
78 data1 = loadFile(name1);
79 setSecret(name1, data1);
80 if (!name2.empty()) {
81 data2 = loadFile(name2);
82 setSecret(name2, data2);
83 }
84 }
85}
86
87std::string
88SSLSecret::loadFile(const std::string &name)

Callers 1

getOrLoadSecretMethod · 0.95

Calls 8

getSecretMethod · 0.95
loadFileFunction · 0.85
getMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
blocking_invokeMethod · 0.45
nextMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected