Skip to content

Commit

Permalink
[dns-cache] - fix dnscache lookup. The current code assumed that the …
Browse files Browse the repository at this point in the history
…strIpAddress parameter was an empty string. That wasn't the case for e.x. nfs. In the case the nmblookup failed - but the caller has given a non-empty string in strIpAddress - this string was cached for the given hostname and returned back with return true. This fixes the problem by clearing the strIpAddress param before starting lookups. Thx to drloco for pointing it out.
  • Loading branch information
Memphiz committed Nov 20, 2012
1 parent 10bcf4f commit 4cbe756
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions xbmc/network/DNSNameCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddre
{
// first see if this is already an ip address
unsigned long address = inet_addr(strHostName.c_str());
strIpAddress.Empty();

if (address != INADDR_NONE)
{
strIpAddress.Format("%d.%d.%d.%d", (address & 0xFF), (address & 0xFF00) >> 8, (address & 0xFF0000) >> 16, (address & 0xFF000000) >> 24 );
Expand Down

1 comment on commit 4cbe756

@theuni
Copy link
Contributor

@theuni theuni commented on 4cbe756 Nov 20, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I believe I was seeing this when trying the android port. Might be worth another shot now :)

Please sign in to comment.