commit | 218ee7bcbef1c066a2be56f087ab8c824b529188 | [log] [tgz] |
---|---|---|
author | Václav Kubernát <kubernat@cesnet.cz> | Wed Mar 30 22:35:26 2022 +0200 |
committer | Jan Kundrát <jan.kundrat@cesnet.cz> | Thu Mar 31 14:16:28 2022 +0200 |
tree | 461a7d899fdefc9a17f445ba899239cc4c5b8d27 | |
parent | a63a3faff5f289668827c97451de43b16819b4d0 [diff] [blame] |
Disallow cd out of the prepare context Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/202 Change-Id: I8e9772ebd1fa86469e2c497b9813686b3ff361d5
diff --git a/src/interpreter.cpp b/src/interpreter.cpp index 43e2269..8030f3f 100644 --- a/src/interpreter.cpp +++ b/src/interpreter.cpp
@@ -89,6 +89,9 @@ void Interpreter::operator()(const cd_& cd) const { + if (auto rpcInputPath = m_datastore.inputDatastorePath(); rpcInputPath && !pathToDataString(cd.m_path, Prefixes::WhenNeeded).starts_with(m_parser.currentNode())) { + throw std::runtime_error("Can't cd out of `prepare` context"); + } m_parser.changeNode(cd.m_path); }