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

lib: addns: Fix ads_dns_lookup_ns(), ads_dns_query_dcs(), ads_dns_query_gcs(), ads_dns_query_kdcs(), ads_dns_query_pdc() to return size_t *.

Easier to do all callers at once.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Jeremy Allison 2020-09-10 16:19:37 +01:00 committed by Noel Power
parent 2ebf3191f2
commit 62e99efa3d
6 changed files with 18 additions and 34 deletions

View File

@ -347,7 +347,7 @@ NTSTATUS ads_dns_lookup_ns_recv(struct tevent_req *req,
NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
const char *dnsdomain,
struct dns_rr_ns **nslist,
int *numns)
size_t *numns)
{
struct tevent_context *ev;
struct tevent_req *req;
@ -791,7 +791,7 @@ static NTSTATUS ads_dns_query_internal(TALLOC_CTX *ctx,
const char *realm,
const char *sitename,
struct dns_rr_srv **dclist,
int *numdcs )
size_t *numdcs )
{
char *name;
NTSTATUS status;
@ -827,10 +827,6 @@ static NTSTATUS ads_dns_query_internal(TALLOC_CTX *ctx,
status = ads_dns_lookup_srv(ctx, name, dclist, &num_srvs);
done:
/* check overflow size_t -> int */
if ((int)num_srvs < 0) {
return NT_STATUS_INVALID_PARAMETER;
}
*numdcs = num_srvs;
return status;
}
@ -843,7 +839,7 @@ NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
const char *realm,
const char *sitename,
struct dns_rr_srv **dclist,
int *numdcs )
size_t *numdcs )
{
NTSTATUS status;
@ -865,7 +861,7 @@ NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
const char *realm,
const char *sitename,
struct dns_rr_srv **dclist,
int *numdcs )
size_t *numdcs )
{
NTSTATUS status;
@ -889,7 +885,7 @@ NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
const char *dns_forest_name,
const char *sitename,
struct dns_rr_srv **dclist,
int *numdcs )
size_t *numdcs )
{
NTSTATUS status;
@ -910,7 +906,7 @@ NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
const char *dns_domain_name,
struct dns_rr_srv **dclist,
int *numdcs )
size_t *numdcs )
{
return ads_dns_query_internal(ctx,
"_ldap",
@ -929,7 +925,7 @@ NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
const char *dns_forest_name,
const char *domain_guid,
struct dns_rr_srv **dclist,
int *numdcs )
size_t *numdcs )
{
/*_ldap._tcp.DomainGuid.domains._msdcs.DnsForestName */

View File

@ -47,7 +47,7 @@ NTSTATUS ads_dns_lookup_ns_recv(struct tevent_req *req,
NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
const char *dnsdomain,
struct dns_rr_ns **nslist,
int *numns);
size_t *numns);
struct tevent_req *ads_dns_lookup_a_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
const char *name);
@ -83,24 +83,24 @@ NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
const char *realm,
const char *sitename,
struct dns_rr_srv **dclist,
int *numdcs );
size_t *numdcs );
NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
const char *realm,
const char *sitename,
struct dns_rr_srv **dclist,
int *numdcs );
size_t *numdcs );
NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
const char *dns_forest_name,
const char *sitename,
struct dns_rr_srv **dclist,
int *numdcs );
size_t *numdcs );
NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
const char *dns_domain_name,
struct dns_rr_srv **dclist,
int *numdcs );
size_t *numdcs );
NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
const char *dns_forest_name,
const char *domain_guid,
struct dns_rr_srv **dclist,
int *numdcs );
size_t *numdcs );
#endif /* _ADS_DNS_H */

View File

@ -522,7 +522,7 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
size_t i;
NTSTATUS status;
struct dns_rr_srv *dcs = NULL;
int numdcs = 0;
size_t numdcs = 0;
struct ip_service_name *dclist = NULL;
size_t ret_count = 0;
size_t num_dns_lookups = 0;
@ -576,12 +576,6 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
return status;
}
/* Wrap protect. */
if (numdcs < 0) {
TALLOC_FREE(dcs);
return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
}
if (numdcs == 0) {
TALLOC_FREE(dcs);
return NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;

View File

@ -2945,10 +2945,10 @@ static NTSTATUS resolve_ads(TALLOC_CTX *ctx,
struct sockaddr_storage **return_addrs,
size_t *return_count)
{
int i;
size_t i;
NTSTATUS status;
struct dns_rr_srv *dcs = NULL;
int numdcs = 0;
size_t numdcs = 0;
size_t numaddrs = 0;
size_t num_srv_addrs = 0;
struct sockaddr_storage *srv_addrs = NULL;
@ -3008,12 +3008,6 @@ static NTSTATUS resolve_ads(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
/* Paranoia. */
if (numdcs < 0) {
TALLOC_FREE(dcs);
return NT_STATUS_INVALID_PARAMETER;
}
/*
* Split the returned values into 2 arrays. First one
* is a struct sockaddr_storage array that contains results

View File

@ -1516,7 +1516,7 @@ static NTSTATUS net_update_dns_internal(struct net_context *c,
int num_addrs, bool remove_host)
{
struct dns_rr_ns *nameservers = NULL;
int ns_count = 0, i;
size_t ns_count = 0, i;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
DNS_ERROR dns_err;
fstring dns_server;

View File

@ -102,7 +102,7 @@ static int net_lookup_ldap(struct net_context *c, int argc, const char **argv)
const char *domain;
struct sockaddr_storage ss;
struct dns_rr_srv *dcs = NULL;
int numdcs = 0;
size_t numdcs = 0;
char *sitename;
TALLOC_CTX *ctx;
NTSTATUS status;