MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3-linux / Export

Method Export

src/configmgr/configmgr-configuration.cpp:582–629  ·  view source on GitHub ↗

* Exports the configuration, including all the available settings * specific to the Linux client. The output format is JSON. * * @return Returns a Json::Value object containing the serialized * configuration profile */

Source from the content-addressed store, hash-verified

580 * configuration profile
581 */
582Json::Value Configuration::Export() const
583{
584 Json::Value ret;
585
586 ret["object_path"] = GetPath();
587 ret["owner"] = (uint32_t)object_acl_->GetOwner();
588 ret["name"] = filter_ctrl_chars(prop_name_, true);
589
590 if (prop_tags_.size() > 0)
591 {
592 for (const auto &tag : prop_tags_)
593 {
594 ret["tags"].append(filter_ctrl_chars(tag, true));
595 }
596 }
597
598 ret["import_timestamp"] = (Json::Value::UInt64)prop_import_timestamp_;
599 ret["last_used_timestamp"] = (Json::Value::UInt64)prop_last_used_timestamp_;
600 ret["locked_down"] = prop_locked_down_;
601 ret["transfer_owner_session"] = prop_transfer_owner_session_;
602 ret["readonly"] = prop_readonly_;
603 ret["single_use"] = prop_single_use_;
604 ret["used_count"] = prop_used_count_;
605 ret["valid"] = prop_valid_;
606 ret["profile"] = options_.json_export();
607 ret["dco"] = prop_dco_;
608
609 ret["public_access"] = object_acl_->GetPublicAccess();
610
611 for (const auto &e : object_acl_->GetAccessList())
612 {
613 ret["acl"].append(e);
614 }
615
616 for (const auto &ov : override_list_)
617 {
618 if (std::holds_alternative<bool>(ov.value))
619 {
620 ret["overrides"][ov.key] = std::get<bool>(ov.value);
621 }
622 else
623 {
624 ret["overrides"][ov.key] = std::get<std::string>(ov.value);
625 }
626 }
627
628 return ret;
629}
630
631
632void Configuration::TransferOwnership(uid_t new_owner_uid)

Callers

nothing calls this directly

Calls 6

filter_ctrl_charsFunction · 0.85
sizeMethod · 0.80
json_exportMethod · 0.80
GetOwnerMethod · 0.45
GetPublicAccessMethod · 0.45
GetAccessListMethod · 0.45

Tested by

no test coverage detected