libsmb: Remove ip_service based resolve_lmhosts
authorVolker Lendecke <vl@samba.org>
Tue, 15 Dec 2015 20:52:38 +0000 (21:52 +0100)
committerUri Simchoni <uri@samba.org>
Wed, 13 Jan 2016 06:48:30 +0000 (07:48 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/libsmb/namequery.c

index 38c6648f02b343cc76b3a84a7c9ada0fe5bda305..4709c035545d340d7aa2833fbc1d5cbbe063044f 100644 (file)
@@ -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")) {