1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

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>
This commit is contained in:
Jeremy Allison 2020-08-24 11:54:26 -07:00
parent 2056b0d9c3
commit 54454b30ff

View File

@ -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);
}