From 26e2814dbae4cf9b2bf6d31d1befa56f34ecdf19 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Tue, 17 Sep 2019 18:51:03 -0400 Subject: [PATCH] config: add replace_u (u = user value) method --- auto/mk-src.in | 9 +++++++++ common/config.cpp | 9 +++++++++ common/config.hpp | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/auto/mk-src.in b/auto/mk-src.in index 4aa5b606..76b3b16f 100644 --- a/auto/mk-src.in +++ b/auto/mk-src.in @@ -294,6 +294,15 @@ class: config string: key string: value + method: replace u + posib err + desc => Experimental method that is like replace but will mark + it as being set in an insecure context. + / + void + string: key + string: value + method: remove posib err desc => Remove a key and returns TRUE if it exists diff --git a/common/config.cpp b/common/config.cpp index a9201d0d..bb95a47b 100644 --- a/common/config.cpp +++ b/common/config.cpp @@ -809,6 +809,15 @@ namespace acommon { return set(entry); } + PosibErr Config::replace_u(ParmStr key, ParmStr value) + { + Entry * entry = new Entry; + entry->key = key; + entry->value = value; + entry->secure = false; + return set(entry); + } + PosibErr Config::remove(ParmStr key) { Entry * entry = new Entry; diff --git a/common/config.hpp b/common/config.hpp index c6a0c584..016edc36 100644 --- a/common/config.hpp +++ b/common/config.hpp @@ -145,6 +145,11 @@ namespace acommon { PosibErr replace(ParmStr, ParmStr); PosibErr remove(ParmStr); + // replace_u (u is for user value) is like replace except that it + // marks the value as insecure. It should be used when setting a + // config value to anything other than a known constant. + PosibErr replace_u(ParmStr, ParmStr); + bool empty() const {return !first_;} PosibErr merge(const Config & other);