Per client DO/UNDO commands server part - done

This commit is contained in:
Yukino Song
2025-01-22 21:04:29 +08:00
parent f4e445a58b
commit 4403cff32f
6 changed files with 175 additions and 12 deletions

View File

@@ -5,11 +5,14 @@
#pragma once
#include <array>
#include <list>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <openssl/sha.h>
#include <openssl/x509.h>
#include <boost/property_tree/ptree.hpp>
#include "utility.h"
namespace crypto {
@@ -78,10 +81,25 @@ namespace crypto {
return static_cast<uint32_t>(p) == 0;
}
struct command_entry_t {
std::string cmd;
bool elevated;
// Serialize method
static inline boost::property_tree::ptree serialize(const command_entry_t& entry) {
boost::property_tree::ptree node;
node.put("cmd", entry.cmd);
node.put("elevated", entry.elevated);
return node;
}
};
struct named_cert_t {
std::string name;
std::string uuid;
std::string cert;
std::list<command_entry_t> do_cmds;
std::list<command_entry_t> undo_cmds;
PERM perm;
};