if(pleft>1)
data.hostmaster=DNSName(attodot(parts[1])); // ahu@ds9a.nl -> ahu.ds9a.nl, piet.puk@ds9a.nl -> piet\.puk.ds9a.nl
- data.serial = pleft > 2 ? pdns_stou(parts[2]) : 0;
- if (data.serial == UINT_MAX && errno == ERANGE) throw PDNSException("serial number too large in '"+parts[2]+"'");
+ try {
+ data.serial = pleft > 2 ? pdns_stou(parts[2]) : 0;
+ if (data.serial == UINT_MAX && errno == ERANGE) throw PDNSException("serial number too large in '"+parts[2]+"'");
- data.refresh = pleft > 3 ? pdns_stou(parts[3])
- : ::arg().asNum("soa-refresh-default");
+ data.refresh = pleft > 3 ? pdns_stou(parts[3])
+ : ::arg().asNum("soa-refresh-default");
- data.retry = pleft > 4 ? pdns_stou(parts[4].c_str())
- : ::arg().asNum("soa-retry-default");
+ data.retry = pleft > 4 ? pdns_stou(parts[4].c_str())
+ : ::arg().asNum("soa-retry-default");
- data.expire = pleft > 5 ? pdns_stou(parts[5].c_str())
- : ::arg().asNum("soa-expire-default");
+ data.expire = pleft > 5 ? pdns_stou(parts[5].c_str())
+ : ::arg().asNum("soa-expire-default");
- data.default_ttl = pleft > 6 ? pdns_stou(parts[6].c_str())
- : ::arg().asNum("soa-minimum-ttl");
+ data.default_ttl = pleft > 6 ? pdns_stou(parts[6].c_str())
+ : ::arg().asNum("soa-minimum-ttl");
+ }
+ catch(const std::out_of_range& oor) {
+ throw PDNSException("Out of range exception parsing "+content);
+ }
}
string serializeSOAData(const SOAData &d)
if(str.empty())
return 0;
- unsigned int val=pdns_stou(str);
+ unsigned int val;
+ try {
+ val=pdns_stou(str);
+ }
+ catch (const std::out_of_range& oor) {
+ throw PDNSException("Unable to parse time specification '"+str+"' "+getLineOfFile());
+ }
+
char lc=dns_tolower(str[str.length()-1]);
if(!isdigit(lc))
switch(lc) {