diff options
author | Jeremy Allison <jra@samba.org> | 2020-08-24 11:54:26 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-08-25 16:21:32 +0000 |
commit | 54454b30ff7da2af857b3fcc31ece6f2b39cfb09 (patch) | |
tree | 87f18dd6dd9210e3cf10c2c3f898b66dc19bda9e /source3 | |
parent | 2056b0d9c3feb553882e598042c5b56be4974412 (diff) | |
download | samba-54454b30ff7da2af857b3fcc31ece6f2b39cfb09.tar.gz |
s3: libsmb: Cleanup - Remove two more sockaddr casts inside remove_duplicate_addrs2().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Mulder <dmulder@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/namequery.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 464a9b7b4a4..7975e226f72 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1203,13 +1203,28 @@ int remove_duplicate_addrs2(struct ip_service *iplist, int count ) /* One loop to set duplicates to a zero addr. */ for ( i=0; i<count; i++ ) { - if ( is_zero_addr(&iplist[i].ss)) { + bool ok; + struct samba_sockaddr sa_i = {0}; + + ok = sockaddr_storage_to_samba_sockaddr(&sa_i, &iplist[i].ss); + if (!ok) { + continue; + } + + if (is_zero_addr(&sa_i.u.ss)) { continue; } for ( j=i+1; j<count; j++ ) { - if (sockaddr_equal((struct sockaddr *)(void *)&iplist[i].ss, - (struct sockaddr *)(void *)&iplist[j].ss) && + struct samba_sockaddr sa_j = {0}; + + ok = sockaddr_storage_to_samba_sockaddr(&sa_j, + &iplist[j].ss); + if (!ok) { + continue; + } + + if (sockaddr_equal(&sa_i.u.sa, &sa_j.u.sa) && iplist[i].port == iplist[j].port) { zero_sockaddr(&iplist[j].ss); } |