Skip to content

Commit

Permalink
Remove non used lookup_cached_host, add whiteline between method defi…
Browse files Browse the repository at this point in the history
…nitions
  • Loading branch information
G10h4ck committed Jul 30, 2015
1 parent 18b6b9c commit 30b63ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
21 changes: 9 additions & 12 deletions nmap_dns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1016,18 +1016,6 @@ static void parse_etchosts(const char *fname) {
fclose(fp);
}

/* External interface to dns cache */
int lookup_cached_host(const struct sockaddr_storage * ip, char *name, size_t maxlen = HOST_NAME_MAX)
{
std::string str_name;
if (host_cache.lookup(*ip, str_name))
{
strncpy(name, str_name.c_str(), maxlen);
return 1;
}
return 0;
}

static void etchosts_init(void) {
static int initialized = 0;
if (initialized) return;
Expand Down Expand Up @@ -1365,6 +1353,7 @@ bool DNS::Factory::ipToPtr(const sockaddr_storage &ip, std::string &ptr)
}
return true;
}

bool DNS::Factory::ptrToIp(const std::string &ptr, sockaddr_storage &ip)
{
std::string ip_str;
Expand Down Expand Up @@ -1415,6 +1404,7 @@ bool DNS::Factory::ptrToIp(const std::string &ptr, sockaddr_storage &ip)
sockaddr_storage_inet_pton(ip_str.c_str(), &ip);
return true;
}

size_t DNS::Factory::buildSimpleRequest(const std::string &name, RECORD_TYPE rt, u8 *buf, size_t maxlen)
{
size_t ret=0 , tmp=0;
Expand All @@ -1430,13 +1420,15 @@ size_t DNS::Factory::buildSimpleRequest(const std::string &name, RECORD_TYPE rt,

return ret;
}

size_t DNS::Factory::buildReverseRequest(const sockaddr_storage &ip, u8 *buf, size_t maxlen)
{
std::string name;
if(ipToPtr(ip,name))
return buildSimpleRequest(name, PTR, buf, maxlen);
return 0;
}

size_t DNS::Factory::putUnsignedShort(u16 num, u8 *buf, size_t offset, size_t maxlen)
{
size_t max_access = offset+1;
Expand All @@ -1449,6 +1441,7 @@ size_t DNS::Factory::putUnsignedShort(u16 num, u8 *buf, size_t offset, size_t ma

return 0;
}

size_t DNS::Factory::putDomainName(const std::string &name, u8 *buf, size_t offset, size_t maxlen)
{
size_t ret=0;
Expand Down Expand Up @@ -1477,6 +1470,7 @@ size_t DNS::Factory::putDomainName(const std::string &name, u8 *buf, size_t offs

return ret;
}

size_t DNS::Factory::parseUnsignedShort(u16 &num, const u8 *buf, size_t offset, size_t maxlen)
{
size_t max_access = offset+1;
Expand All @@ -1489,6 +1483,7 @@ size_t DNS::Factory::parseUnsignedShort(u16 &num, const u8 *buf, size_t offset,

return 0;
}

size_t DNS::Factory::parseUnsignedInt(u32 &num, const u8 *buf, size_t offset, size_t maxlen)
{
size_t max_access = offset+3;
Expand All @@ -1501,6 +1496,7 @@ size_t DNS::Factory::parseUnsignedInt(u32 &num, const u8 *buf, size_t offset, si

return 0;
}

size_t DNS::Factory::parseDomainName(std::string &name, const u8 *buf, size_t offset, size_t maxlen)
{
size_t tmp, ret = 0;
Expand Down Expand Up @@ -1609,6 +1605,7 @@ size_t DNS::Answer::parseFromBuffer(const u8 *buf, size_t offset, size_t maxlen)

return ret;
}

DNS::Answer& DNS::Answer::operator=(const Answer &r)
{
name = r.name;
Expand Down
1 change: 0 additions & 1 deletion nmap_dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ class Packet
}

void nmap_mass_rdns(Target ** targets, int num_targets);
int lookup_cached_host(const struct sockaddr_storage * ip, char * name, size_t maxlen);

std::list<std::string> get_dns_servers();

Expand Down

0 comments on commit 30b63ff

Please sign in to comment.