mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +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:
parent
da9c7b1938
commit
e034072c96
@ -372,6 +372,6 @@ NTSTATUS resolve_lmhosts_file_as_sockaddr(TALLOC_CTX *mem_ctx,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int name_type,
|
int name_type,
|
||||||
struct sockaddr_storage **return_iplist,
|
struct sockaddr_storage **return_iplist,
|
||||||
int *return_count);
|
size_t *return_count);
|
||||||
|
|
||||||
#endif /* __LIBNBT_H__ */
|
#endif /* __LIBNBT_H__ */
|
||||||
|
@ -164,7 +164,7 @@ NTSTATUS resolve_lmhosts_file_as_sockaddr(TALLOC_CTX *mem_ctx,
|
|||||||
const char *name,
|
const char *name,
|
||||||
int name_type,
|
int name_type,
|
||||||
struct sockaddr_storage **return_iplist,
|
struct sockaddr_storage **return_iplist,
|
||||||
int *return_count)
|
size_t *return_count)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* "lmhosts" means parse the local lmhosts file.
|
* "lmhosts" means parse the local lmhosts file.
|
||||||
@ -234,11 +234,6 @@ NTSTATUS resolve_lmhosts_file_as_sockaddr(TALLOC_CTX *mem_ctx,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((int)ret_count < 0) {
|
|
||||||
TALLOC_FREE(ctx);
|
|
||||||
endlmhosts(fp);
|
|
||||||
return NT_STATUS_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
*return_count = ret_count;
|
*return_count = ret_count;
|
||||||
*return_iplist = talloc_move(mem_ctx, &iplist);
|
*return_iplist = talloc_move(mem_ctx, &iplist);
|
||||||
TALLOC_FREE(ctx);
|
TALLOC_FREE(ctx);
|
||||||
|
@ -3406,16 +3406,23 @@ NTSTATUS internal_resolve_name(TALLOC_CTX *ctx,
|
|||||||
}
|
}
|
||||||
goto done;
|
goto done;
|
||||||
} else if (strequal(tok, "lmhosts")) {
|
} else if (strequal(tok, "lmhosts")) {
|
||||||
|
size_t lmcount = 0;
|
||||||
status = resolve_lmhosts_file_as_sockaddr(
|
status = resolve_lmhosts_file_as_sockaddr(
|
||||||
talloc_tos(),
|
talloc_tos(),
|
||||||
get_dyn_LMHOSTSFILE(),
|
get_dyn_LMHOSTSFILE(),
|
||||||
name,
|
name,
|
||||||
name_type,
|
name_type,
|
||||||
&ss_list,
|
&ss_list,
|
||||||
&icount);
|
&lmcount);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* This uglyness will go away once
|
||||||
|
* all resolve_XXX() return size_t *
|
||||||
|
* number of addresses.
|
||||||
|
*/
|
||||||
|
icount = (int)lmcount;
|
||||||
goto done;
|
goto done;
|
||||||
} else if (strequal(tok, "wins")) {
|
} else if (strequal(tok, "wins")) {
|
||||||
size_t wcount = 0;
|
size_t wcount = 0;
|
||||||
|
@ -53,7 +53,7 @@ static struct composite_context *resolve_name_lmhosts_send(
|
|||||||
struct composite_context *c;
|
struct composite_context *c;
|
||||||
struct resolve_lmhosts_state *state;
|
struct resolve_lmhosts_state *state;
|
||||||
struct sockaddr_storage *resolved_iplist;
|
struct sockaddr_storage *resolved_iplist;
|
||||||
int resolved_count, i;
|
size_t resolved_count = 0, i;
|
||||||
|
|
||||||
if (event_ctx == NULL) {
|
if (event_ctx == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user