diff options
author | Stephen Morris <stephen@isc.org> | 2012-12-11 19:16:38 +0100 |
---|---|---|
committer | Stephen Morris <stephen@isc.org> | 2012-12-14 17:20:15 +0100 |
commit | 8ea9bddd35ab3a5716a51310ccc4cc6a3d96b572 (patch) | |
tree | 556ed84f5e3e8ffe03b733c2954e9cb1cd486627 /src/lib/dhcpsrv/lease_mgr_factory.h | |
parent | Merge #2428 (diff) | |
download | kea-8ea9bddd35ab3a5716a51310ccc4cc6a3d96b572.tar.xz kea-8ea9bddd35ab3a5716a51310ccc4cc6a3d96b572.zip |
[2524] Add method to redact password from access string
The access string is logged: as it includes the password, this
is removed from the message logged.
Diffstat (limited to 'src/lib/dhcpsrv/lease_mgr_factory.h')
-rw-r--r-- | src/lib/dhcpsrv/lease_mgr_factory.h | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/lib/dhcpsrv/lease_mgr_factory.h b/src/lib/dhcpsrv/lease_mgr_factory.h index 338c9415d7..da86d5feb3 100644 --- a/src/lib/dhcpsrv/lease_mgr_factory.h +++ b/src/lib/dhcpsrv/lease_mgr_factory.h @@ -66,21 +66,21 @@ public: /// @note When called, the current lease manager is <b>always</b> destroyed /// and a new one created - even if the parameters are the same. /// - /// dbconfig is a generic way of passing parameters. Parameters are passed + /// dbaccess is a generic way of passing parameters. Parameters are passed /// in the "name=value" format, separated by spaces. The data MUST include /// a keyword/value pair of the form "type=dbtype" giving the database /// type, e.q. "mysql" or "sqlite3". /// - /// @param dbconfig Database configuration parameters. These are in - /// the form of "keyword=value" pairs, separated by spaces. These - /// are back-end specific, although must include the "type" keyword - /// which gives the backend in use. + /// @param dbaccess Database access parameters. These are in the form of + /// "keyword=value" pairs, separated by spaces. They are backend- + /// -end specific, although must include the "type" keyword which + /// gives the backend in use. /// - /// @throw isc::InvalidParameter dbconfig string does not contain the "type" + /// @throw isc::InvalidParameter dbaccess string does not contain the "type" /// keyword. - /// @throw isc::dhcp::InvalidType The "type" keyword in dbconfig does not + /// @throw isc::dhcp::InvalidType The "type" keyword in dbaccess does not /// identify a supported backend. - static void create(const std::string& dbconfig); + static void create(const std::string& dbaccess); /// @brief Destroy lease manager /// @@ -89,7 +89,7 @@ public: /// lease manager is available. static void destroy(); - /// @brief Return Current Lease Manager + /// @brief Return current lease manager /// /// Returns an instance of the "current" lease manager. An exception /// will be thrown if none is available. @@ -98,15 +98,26 @@ public: /// create() to create one before calling this method. static LeaseMgr& instance(); - /// @brief Parse Database Parameters + /// @brief Parse database access string /// /// Parses the string of "keyword=value" pairs and separates them /// out into the map. /// - /// @param dbconfig Database configuration string + /// @param dbaccess Database access string. /// /// @return std::map<std::string, std::string> Map of keyword/value pairs. - static LeaseMgr::ParameterMap parse(const std::string& dbconfig); + static LeaseMgr::ParameterMap parse(const std::string& dbaccess); + + /// @brief Redact database access string + /// + /// Takes the database parameters and returns a database access string + /// passwords replaced by asterisks. This string is used in log messages. + /// + /// @param dbaccess Database access parameters (output of "parse"). + /// + /// @return Redacted database access string. + static std::string redactedAccessString( + const LeaseMgr::ParameterMap& parameters); private: /// @brief Hold pointer to lease manager |