LCOV - code coverage report
Current view: top level - source4/libcli/resolve - resolve_lp.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 17 19 89.5 %
Date: 2024-04-21 15:09:00 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             :    Samba utility functions
       4             :    Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
       5             :    
       6             :    This program is free software; you can redistribute it and/or modify
       7             :    it under the terms of the GNU General Public License as published by
       8             :    the Free Software Foundation; either version 3 of the License, or
       9             :    (at your option) any later version.
      10             :    
      11             :    This program is distributed in the hope that it will be useful,
      12             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :    GNU General Public License for more details.
      15             :    
      16             :    You should have received a copy of the GNU General Public License
      17             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      18             : */
      19             : 
      20             : #include "includes.h"
      21             : #include "libcli/resolve/resolve.h"
      22             : #include "param/param.h"
      23             : 
      24       67003 : struct resolve_context *lpcfg_resolve_context(struct loadparm_context *lp_ctx)
      25             : {
      26       67003 :         const char **methods = lpcfg_name_resolve_order(lp_ctx);
      27        1322 :         int i;
      28       67003 :         struct resolve_context *ret = resolve_context_init(lp_ctx);
      29             : 
      30       67003 :         if (ret == NULL)
      31           0 :                 return NULL;
      32             : 
      33      335015 :         for (i = 0; methods != NULL && methods[i] != NULL; i++) {
      34      268012 :                 if (!strcmp(methods[i], "wins")) {
      35       67003 :                         if (lpcfg_disable_netbios(lp_ctx) == false) {
      36       67003 :                                 resolve_context_add_wins_method_lp(ret, lp_ctx);
      37             :                         }
      38      201009 :                 } else if (!strcmp(methods[i], "bcast")) {
      39       67003 :                         if (lpcfg_disable_netbios(lp_ctx) == false) {
      40       67003 :                                 resolve_context_add_bcast_method_lp(ret, lp_ctx);
      41             :                         }
      42      134006 :                 } else if (!strcmp(methods[i], "lmhosts")) {
      43       67003 :                         resolve_context_add_lmhosts_method(ret);
      44       67003 :                 } else if (!strcmp(methods[i], "host")) {
      45       67003 :                         resolve_context_add_host_method(ret);
      46             :                 } else {
      47           0 :                         DEBUG(0, ("Unknown resolve method '%s'\n", methods[i]));
      48             :                 }
      49             :         }
      50             : 
      51       65681 :         return ret;
      52             : }

Generated by: LCOV version 1.14