Skip to content

Commit

Permalink
Refresh client certs after unpairing a single client
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Apr 17, 2024
1 parent 5ef7b03 commit cef0b19
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/nvhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@ namespace nvhttp {
client.certs.emplace_back(named_cert.cert);
}
}


// Empty certificate chain and import certs from file
cert_chain.clear();
for (auto &cert : client.certs) {
cert_chain.add(crypto::x509(cert));
}
for (auto &named_cert : client.named_devices) {
cert_chain.add(crypto::x509(named_cert.cert));
}

client_root = client;
}

Expand Down Expand Up @@ -1063,14 +1074,6 @@ namespace nvhttp {
conf_intern.pkey = file_handler::read_file(config::nvhttp.pkey.c_str());
conf_intern.servercert = file_handler::read_file(config::nvhttp.cert.c_str());

client_t &client = client_root;
for (auto &cert : client.certs) {
cert_chain.add(crypto::x509(cert));
}
for (auto &named_cert : client.named_devices) {
cert_chain.add(crypto::x509(named_cert.cert));
}

auto add_cert = std::make_shared<safe::queue_t<crypto::x509_t>>(30);

// resume doesn't always get the parameter "localAudioPlayMode"
Expand Down Expand Up @@ -1235,6 +1238,7 @@ namespace nvhttp {
}

save_state();
load_state();
return removed;
}
} // namespace nvhttp

0 comments on commit cef0b19

Please sign in to comment.