don't log passwords by default, but make password logging optional
[bpdyndnsd] / src / config.cpp
index 863a978..b326a11 100644 (file)
@@ -47,6 +47,7 @@ Config::Config()
     , DaemonMode(false)
     , Syslog(false)
     , EnableIPv6(false)
+    , LogPasswords(false)
     , Loglevel(0)
     , ConfigPath("/etc/bpdyndnsd")
     , WebcheckInterval(0)
@@ -74,6 +75,7 @@ Config::Config(Logger::Ptr _log, Serviceholder::Ptr _serviceholder)
     , DaemonMode(false)
     , Syslog(false)
     , EnableIPv6(false)
+    , LogPasswords(false)
     , Loglevel(0)
     , ConfigPath("/etc/bpdyndnsd")
     , WebcheckInterval(0)
@@ -132,6 +134,7 @@ void Config::define_config_options()
         ("daemon_mode",po::value<bool>()->default_value(false),"Run as system daemon.")
         ("loglevel",po::value<int>()->default_value(0),"Loglevel.")
         ("syslog",po::value<bool>()->default_value(false),"Use syslog facility.")
+        ("log_passwords",po::value<bool>()->default_value(false),"Log passwords in cleartext.")
         ("enable_ipv6",po::value<bool>()->default_value(false),"Try to use IPv6.")
         ("webcheck_enabled",po::value<bool>()->default_value(false),"Use webcheck url to determine actual IP address.")
         ("webcheck_url",po::value<string>()->default_value(""),"Use this URL to determine IP.")
@@ -259,6 +262,9 @@ int Config::parse_cmd_line(int argc, char *argv[])
         if ( VariablesMap.count("syslog") )
             Syslog = VariablesMap["syslog"].as<bool>();
 
+        if ( VariablesMap.count("log_passwords") )
+            LogPasswords = VariablesMap["log_passwords"].as<bool>();
+
         if ( VariablesMap.count("enable_ipv6") )
             EnableIPv6 = VariablesMap["enable_ipv6"].as<bool>();
 
@@ -547,6 +553,9 @@ int Config::load_main_config_file(const string& full_filename)
             if ( VariablesMap.count("syslog") )
                 Syslog = VariablesMap["syslog"].as<bool>();
 
+            if ( VariablesMap.count("log_passwords") )
+                LogPasswords = VariablesMap["log_passwords"].as<bool>();
+
             if ( VariablesMap.count("enable_ipv6") )
                 EnableIPv6 = VariablesMap["enable_ipv6"].as<bool>();
 
@@ -738,6 +747,16 @@ bool Config::get_syslog() const
 
 
 /**
+ * Getter for member LogPasswords.
+ * @return True if we want to log passwords in cleartext.
+ */
+bool Config::get_log_passwords() const
+{
+    return LogPasswords;
+}
+
+
+/**
  * Getter for member EnableIPv6
  * @return Wether IPv6 should be used or not.
  */