1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

libcli: nbt: Fix resolve_lmhosts_file_as_sockaddr() to return size_t * count of addresses.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Jeremy Allison 2020-09-08 13:58:49 -07:00 committed by Noel Power
parent da9c7b1938
commit e034072c96
4 changed files with 11 additions and 9 deletions

View File

@ -372,6 +372,6 @@ NTSTATUS resolve_lmhosts_file_as_sockaddr(TALLOC_CTX *mem_ctx,
const char *name,
int name_type,
struct sockaddr_storage **return_iplist,
int *return_count);
size_t *return_count);
#endif /* __LIBNBT_H__ */

View File

@ -164,7 +164,7 @@ NTSTATUS resolve_lmhosts_file_as_sockaddr(TALLOC_CTX *mem_ctx,
const char *name,
int name_type,
struct sockaddr_storage **return_iplist,
int *return_count)
size_t *return_count)
{
/*
* "lmhosts" means parse the local lmhosts file.
@ -234,11 +234,6 @@ NTSTATUS resolve_lmhosts_file_as_sockaddr(TALLOC_CTX *mem_ctx,
break;
}
if ((int)ret_count < 0) {
TALLOC_FREE(ctx);
endlmhosts(fp);
return NT_STATUS_INVALID_PARAMETER;
}
*return_count = ret_count;
*return_iplist = talloc_move(mem_ctx, &iplist);
TALLOC_FREE(ctx);

View File

@ -3406,16 +3406,23 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
}
goto done;
} else if (strequal(tok, "lmhosts")) {
size_t lmcount = 0;
status = resolve_lmhosts_file_as_sockaddr(
talloc_tos(),
get_dyn_LMHOSTSFILE(),
name,
name_type,
&ss_list,
&icount);
&lmcount);
if (!NT_STATUS_IS_OK(status)) {
continue;
}
/*
* This uglyness will go away once
* all resolve_XXX() return size_t *
* number of addresses.
*/
icount = (int)lmcount;
goto done;
} else if (strequal(tok, "wins")) {
size_t wcount = 0;

View File

@ -53,7 +53,7 @@ static struct composite_context *resolve_name_lmhosts_send(
struct composite_context *c;
struct resolve_lmhosts_state *state;
struct sockaddr_storage *resolved_iplist;
int resolved_count, i;
size_t resolved_count = 0, i;
if (event_ctx == NULL) {
return NULL;