From: bert hubert Date: Fri, 4 Apr 2014 10:26:18 +0000 (+0200) Subject: perform checking on single IP address, no longer use wildcard CNAME. X-Git-Tag: rec-3.6.0-rc1~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10e693307c2c79380e147ee26864e7f88473c25c;p=pdns perform checking on single IP address, no longer use wildcard CNAME. --- diff --git a/pdns/ws-recursor.cc b/pdns/ws-recursor.cc index 16887c30f..a437ed687 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."<