| 92 | } |
| 93 | |
| 94 | int |
| 95 | CB_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 | |
| 135 | int |
| 136 | CB_Update_Secret(TSCont cont, TSEvent /* event ATS_UNUSED */, void * /* edata ATS_UNUSED */) |
nothing calls this directly
no test coverage detected