Skip to content

Commit

Permalink
Update named_cert_t to better match sunshine_state.json
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderfrangos committed Feb 10, 2024
1 parent 5ff80ad commit 735d788
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/nvhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace nvhttp {

struct named_cert_t {
std::string name;
std::string uniqueID;
std::string uuid;
std::string cert;
};

Expand Down Expand Up @@ -197,7 +197,7 @@ namespace nvhttp {
pt::ptree named_cert_node;
named_cert_node.put("name"s, named_cert.name);
named_cert_node.put("cert"s, named_cert.cert);
named_cert_node.put("uuid"s, named_cert.uniqueID);
named_cert_node.put("uuid"s, named_cert.uuid);
named_cert_nodes.push_back(std::make_pair(""s, named_cert_node));
}
root.add_child("root.named_devices"s, named_cert_nodes);
Expand Down Expand Up @@ -251,7 +251,7 @@ namespace nvhttp {
named_cert_t named_cert;
named_cert.name = ""s;
named_cert.cert = el.get_value<std::string>();
named_cert.uniqueID = uuid_util::uuid_t::generate().string();
named_cert.uuid = uuid_util::uuid_t::generate().string();
client.named_devices.emplace_back(named_cert);
client.certs.emplace_back(named_cert.cert);
}
Expand All @@ -264,7 +264,7 @@ namespace nvhttp {
named_cert_t named_cert;
named_cert.name = el.get_child("name").get_value<std::string>();
named_cert.cert = el.get_child("cert").get_value<std::string>();
named_cert.uniqueID = el.get_child("uuid").get_value<std::string>();
named_cert.uuid = el.get_child("uuid").get_value<std::string>();
client.named_devices.emplace_back(named_cert);
client.certs.emplace_back(named_cert.cert);
}
Expand Down Expand Up @@ -624,7 +624,7 @@ namespace nvhttp {
named_cert_t named_cert;
named_cert.name = name;
named_cert.cert = sess.client.cert;
named_cert.uniqueID = uuid_util::uuid_t::generate().string();
named_cert.uuid = uuid_util::uuid_t::generate().string();
client.named_devices.emplace_back(named_cert);

// response to the request for pin
Expand Down Expand Up @@ -753,7 +753,7 @@ namespace nvhttp {
for (auto &named_cert : client.named_devices) {
pt::ptree named_cert_node;
named_cert_node.put("name"s, named_cert.name);
named_cert_node.put("uuid"s, named_cert.uniqueID);
named_cert_node.put("uuid"s, named_cert.uuid);
named_cert_nodes.push_back(std::make_pair(""s, named_cert_node));
}

Expand Down Expand Up @@ -1156,11 +1156,11 @@ namespace nvhttp {
* ```
*/
int
unpair_client(std::string uniqueID) {
unpair_client(std::string uuid) {
int removed = 0;
client_t &client = client_root;
for (auto it = client.named_devices.begin(); it != client.named_devices.end();) {
if ((*it).uniqueID == uniqueID) {
if ((*it).uuid == uuid) {
// Find matching cert and remove it
for (auto cert = client.certs.begin(); cert != client.certs.end();) {
if ((*cert) == (*it).cert) {
Expand Down

0 comments on commit 735d788

Please sign in to comment.