From: Aki Tuomi Date: Fri, 11 Dec 2015 14:52:30 +0000 (+0200) Subject: Use proper conversion on pipe backend X-Git-Tag: dnsdist-1.0.0-alpha1~34^2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0f7034b57caa387a538ff589aaadd7e9469789e3;p=pdns Use proper conversion on pipe backend --- diff --git a/modules/pipebackend/pipebackend.cc b/modules/pipebackend/pipebackend.cc index 6405e9cb7..0fc29ae4e 100644 --- a/modules/pipebackend/pipebackend.cc +++ b/modules/pipebackend/pipebackend.cc @@ -25,7 +25,6 @@ #include #include #include -#include #include "pipebackend.hh" static const char *kBackendId = "[PIPEBackend]"; @@ -56,7 +55,7 @@ void CoWrapper::launch() d_cp = new UnixRemote(d_command, d_timeout); else d_cp = new CoProcess(d_command, d_timeout); - d_cp->send("HELO\t"+lexical_cast(d_abiVersion)); + d_cp->send("HELO\t"+std::to_string(d_abiVersion)); string banner; d_cp->receive(banner); L<(d_abiVersion) + "(use ABI version 5 or later)\n"; + return "not supported on ABI version " + std::to_string(d_abiVersion) + "(use ABI version 5 or later)\n"; ostringstream oss; @@ -257,16 +256,16 @@ bool PipeBackend::get(DNSResourceRecord &r) } if(d_abiVersion >= 3) { - r.scopeMask = atoi(parts[1].c_str()); - r.auth = atoi(parts[2].c_str()); + r.scopeMask = std::stoi(parts[1]); + r.auth = (parts[2] == "1"); } else { r.scopeMask = 0; r.auth = 1; } r.qname=DNSName(parts[1+extraFields]); r.qtype=parts[3+extraFields]; - r.ttl=atoi(parts[4+extraFields].c_str()); - r.domain_id=atoi(parts[5+extraFields].c_str()); + r.ttl=pdns_stou(parts[4+extraFields]); + r.domain_id=std::stoi(parts[5+extraFields]); if(r.qtype.getCode() != QType::MX && r.qtype.getCode() != QType::SRV) { r.content.clear();