From ecc6d7d76571926b6011a3396b5b8d9458d713fc Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 9 Aug 2014 20:39:05 +0200 Subject: [PATCH] allow configuring the port --- CMakeLists.txt | 2 +- dyn-nsupdate.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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); -- 2.30.2