From 9e3784dc0b5a192235cbb2b5fd862cd7315281a8 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 5 Apr 2022 15:48:26 +0100 Subject: Fix converting a token list to a string. Fixes showing oper privs in /CHECK. --- src/inspstring.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/inspstring.cpp') diff --git a/src/inspstring.cpp b/src/inspstring.cpp index 3cbf06602..812719b08 100644 --- a/src/inspstring.cpp +++ b/src/inspstring.cpp @@ -210,9 +210,19 @@ void TokenList::Remove(const std::string& token) std::string TokenList::ToString() const { - std::string buffer(permissive ? "* " : "-* "); - buffer.append(stdalgo::string::join(tokens)); - return buffer; + if (permissive) + { + // If the token list is in permissive mode then the tokens are a list + // of disallowed tokens. + std::string buffer("*"); + for (TokenMap::const_iterator it = tokens.begin(); it != tokens.end(); ++it) + buffer.append(" -").append(*it); + return buffer; + } + + // If the token list is not in permissive mode then the token list is just + // a list of allowed tokens. + return stdalgo::string::join(tokens); } bool TokenList::operator==(const TokenList& other) const -- cgit v1.3.1-10-gc9f91