From 812e07418eae036f079bec7835516a86ae89f86e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 15 Dec 2015 21:52:38 +0100 Subject: [PATCH] libsmb: Remove ip_service based resolve_lmhosts Signed-off-by: Volker Lendecke Reviewed-by: Uri Simchoni --- source3/libsmb/namequery.c | 59 ++++++-------------------------------- 1 file changed, 9 insertions(+), 50 deletions(-) diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 38c6648f02b..4709c035545 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -2274,54 +2274,6 @@ fail: return status; } -/******************************************************** - Resolve via "lmhosts" method. -*********************************************************/ - -static NTSTATUS resolve_lmhosts(const char *name, int name_type, - struct ip_service **return_iplist, - int *return_count) -{ - /* - * "lmhosts" means parse the local lmhosts file. - */ - struct sockaddr_storage *ss_list; - NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; - TALLOC_CTX *ctx = NULL; - - *return_iplist = NULL; - *return_count = 0; - - DEBUG(3,("resolve_lmhosts: " - "Attempting lmhosts lookup for name %s<0x%x>\n", - name, name_type)); - - ctx = talloc_init("resolve_lmhosts"); - if (!ctx) { - return NT_STATUS_NO_MEMORY; - } - - status = resolve_lmhosts_file_as_sockaddr(get_dyn_LMHOSTSFILE(), - name, name_type, - ctx, - &ss_list, - return_count); - if (NT_STATUS_IS_OK(status)) { - if (convert_ss2service(return_iplist, - ss_list, - return_count)) { - talloc_free(ctx); - return NT_STATUS_OK; - } else { - talloc_free(ctx); - return NT_STATUS_NO_MEMORY; - } - } - talloc_free(ctx); - return status; -} - - /******************************************************** Resolve via "hosts" method. *********************************************************/ @@ -2747,9 +2699,16 @@ NTSTATUS internal_resolve_name(const char *name, goto done; } } else if (strequal(tok, "lmhosts")) { - status = resolve_lmhosts(name, name_type, - return_iplist, return_count); + struct sockaddr_storage *ss_list; + status = resolve_lmhosts_file_as_sockaddr( + get_dyn_LMHOSTSFILE(), name, name_type, + talloc_tos(), &ss_list, return_count); if (NT_STATUS_IS_OK(status)) { + if (!convert_ss2service(return_iplist, + ss_list, + return_count)) { + status = NT_STATUS_NO_MEMORY; + } goto done; } } else if (strequal(tok, "wins")) { -- 2.34.1