summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-05-03 21:28:37 +0200
committerVolker Lendecke <vlendec@samba.org>2011-05-04 00:03:47 +0200
commit7febcb5ffeb2d92f2a4f8abe2c0dac91f5c8a53e (patch)
tree1d52f7b5549f9940088031044be46d620340e1a1 /source3/libsmb
parentc616379e14f7db35429ac849bbc6eb3d4dc641ec (diff)
downloadsamba-7febcb5ffeb2d92f2a4f8abe2c0dac91f5c8a53e.tar.gz
samba-7febcb5ffeb2d92f2a4f8abe2c0dac91f5c8a53e.tar.bz2
samba-7febcb5ffeb2d92f2a4f8abe2c0dac91f5c8a53e.zip
s3: Filter out duplicates in name_query()
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed May 4 00:03:47 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 4ce56e684e..8d52ff140c 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -1330,14 +1330,30 @@ static bool name_query_validator(struct packet_struct *p, void *private_data)
for (i=0; i<nmb->answers->rdlength/6; i++) {
uint16_t flags;
struct in_addr ip;
+ struct sockaddr_storage addr;
+ int j;
flags = RSVAL(&nmb->answers->rdata[i*6], 0);
got_unique_netbios_name |= ((flags & 0x8000) == 0);
putip((char *)&ip,&nmb->answers->rdata[2+i*6]);
- in_addr_to_sockaddr_storage(
- &state->addrs[state->num_addrs], ip);
+ in_addr_to_sockaddr_storage(&addr, ip);
+
+ for (j=0; j<state->num_addrs; j++) {
+ if (sockaddr_equal(
+ (struct sockaddr *)&addr,
+ (struct sockaddr *)&state->addrs[j])) {
+ break;
+ }
+ }
+ if (j < state->num_addrs) {
+ /* Already got it */
+ continue;
+ }
+
DEBUGADD(2,("%s ",inet_ntoa(ip)));
+
+ state->addrs[state->num_addrs] = addr;
state->num_addrs += 1;
}
DEBUGADD(2,(")\n"));