Skip to content

Commit

Permalink
s3:libads: Check if we have a valid sockaddr
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Schneider <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>

Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Mon Jun 27 20:39:31 UTC 2022 on sn-devel-184
  • Loading branch information
cryptomilk authored and jrasamba committed Jun 27, 2022
1 parent d96a6ca commit fbf134c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions source3/libads/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ static NTSTATUS cldap_ping_list(ADS_STRUCT *ads,
for (i = 0; i < count; i++) {
char server[INET6_ADDRSTRLEN];

if (is_zero_addr(&sa_list[i].u.ss)) {
continue;
}

print_sockaddr(server, sizeof(server), &sa_list[i].u.ss);

if (!NT_STATUS_IS_OK(
Expand Down Expand Up @@ -563,6 +567,10 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads)

ok = get_dc_name(c_domain, c_realm, srv_name, &ip_out);
if (ok) {
if (is_zero_addr(&ip_out)) {
return NT_STATUS_NO_LOGON_SERVERS;
}

/*
* we call ads_try_connect() to fill in the
* ads->config details
Expand Down Expand Up @@ -692,6 +700,12 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
status = ADS_ERROR_NT(NT_STATUS_NOT_FOUND);
goto out;
}

if (is_zero_addr(&ss)) {
status = ADS_ERROR_NT(NT_STATUS_NOT_FOUND);
goto out;
}

ok = ads_try_connect(ads, ads->server.gc, &ss);
if (ok) {
goto got_connection;
Expand Down

0 comments on commit fbf134c

Please sign in to comment.