From 10e693307c2c79380e147ee26864e7f88473c25c Mon Sep 17 00:00:00 2001 From: bert hubert Date: Fri, 4 Apr 2014 12:26:18 +0200 Subject: [PATCH] perform checking on single IP address, no longer use wildcard CNAME. --- pdns/ws-recursor.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 16887c30f0..a437ed687f 100644 --- a/pdns/ws-recursor.cc +++ b/pdns/ws-recursor.cc @@ -200,7 +200,17 @@ static void doCreateZone(const Value& document) if (kind == "NATIVE") { if (rd) throw ApiException("kind=Native and recursion_desired are mutually exclusive"); - + if(!singleIPTarget.empty()) { + try { + ComboAddress rem(singleIPTarget); + if(rem.sin4.sin_family != AF_INET) + throw ApiException(""); + singleIPTarget = rem.toString(); + } + catch(...) { + throw ApiException("Single IP target '"+singleIPTarget+"' is invalid"); + } + } string zonefilename = ::arg()["experimental-api-config-dir"] + "/" + confbasename + ".zone"; ofstream ofzone(zonefilename.c_str()); if (!ofzone) { @@ -209,8 +219,8 @@ static void doCreateZone(const Value& document) ofzone << "; Generated by pdns-recursor REST API, DO NOT EDIT" << endl; ofzone << zonename << "\tIN\tSOA\tlocal.zone.\thostmaster."<