Fix 'occurred' typo
[bpdyndnsd] / src / config.cpp
index 795b2ed..b326a11 100644 (file)
@@ -17,6 +17,7 @@
 #include "service_tzo.hpp"
 #include "service_zoneedit.hpp"
 #include "service_gnudip.hpp"
+#include "service_gnudip_fullhostname.hpp"
 
 #include <time.h>
 #include <iostream>
@@ -46,6 +47,7 @@ Config::Config()
     , DaemonMode(false)
     , Syslog(false)
     , EnableIPv6(false)
+    , LogPasswords(false)
     , Loglevel(0)
     , ConfigPath("/etc/bpdyndnsd")
     , WebcheckInterval(0)
@@ -73,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)
@@ -131,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.")
@@ -258,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>();
 
@@ -398,6 +405,20 @@ Service::Ptr Config::create_service(const string &protocol, const string& server
             return service;
         }
     }
+    else if(protocol == "gnudip-fullhostname")
+    {
+        if ( !server.empty() )
+        {
+            Service::Ptr service_gnudip_fullhostname(new ServiceGnudipFullhostname(protocol,server,hostname,login,password,Log,update_interval,max_updates_within_interval,max_equal_updates_in_succession,dns_cache_ttl,Proxy,ProxyPort));
+            return service_gnudip_fullhostname;
+        }
+        else
+        {
+            Log->print_gnudip_requires_servername();
+            Service::Ptr service;
+            return service;
+        }
+    }
     else
     {
         Log->print_unknown_protocol(protocol);
@@ -532,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>();
 
@@ -723,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.
  */