From: Ralf Jung Date: Sat, 9 Aug 2014 18:39:05 +0000 (+0200) Subject: allow configuring the port X-Git-Url: https://git.ralfj.de/dyn-nsupdate.git/commitdiff_plain/ecc6d7d76571926b6011a3396b5b8d9458d713fc?hp=4c50ee5d8b2eb10d1fa5a1c8ec340fb769614ffd allow configuring the port --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f714aeb..58f11b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ) set(DYNNSUPDATE_CONFIG_FILE "/some/config/file" CACHE FILEPATH "Choose the file dyn-nsupdate reads its configuration from (for security reasons, this is hard-coded in the binary)") -set(CMAKE_CXX_FLAGS "-Wall -Wextra ${CMAKE_CXX_FLAGS}") +set(CMAKE_CXX_FLAGS "-Wall -Wextra ${CMAKE_CXX_FLAGS} -std=c++11") add_definitions("-DCONFIG_FILE=\"${DYNNSUPDATE_CONFIG_FILE}\"") diff --git a/dyn-nsupdate.cpp b/dyn-nsupdate.cpp index fd804d0..b0a7aed 100644 --- a/dyn-nsupdate.cpp +++ b/dyn-nsupdate.cpp @@ -56,6 +56,7 @@ int main(int argc, const char ** argv) property_tree::ptree config; property_tree::ini_parser::read_ini(CONFIG_FILE, config); std::string nsupdate = config.get("nsupdate"); + unsigned server_port = config.get("port", 53); /* Given the domain, check whether the password matches */ optional correct_password = config.get_optional(path(domain+"/password", '/')); @@ -86,7 +87,7 @@ int main(int argc, const char ** argv) exit(1); } /* exec nsupdate */ - execl(nsupdate.c_str(), nsupdate.c_str(), "-l", (char *)NULL); + execl(nsupdate.c_str(), nsupdate.c_str(), "-p", std::to_string(server_port).c_str(), "-l", (char *)NULL); /* There was an error */ std::cerr << "There was an error executing nsupdate." << std::endl; exit(1);