LCOV - code coverage report
Current view: top level - source3/param - loadparm_ctx.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 20 27 74.1 %
Date: 2024-04-21 15:09:00 Functions: 3 4 75.0 %

          Line data    Source code
       1             : /*
       2             :    Unix SMB/CIFS implementation.
       3             :    Parameter loading functions
       4             :    Copyright (C) Andrew Bartlett 2011
       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 "lib/param/s3_param.h"
      22             : 
      23      861213 : static struct loadparm_service *lp_service_for_s4_ctx(const char *servicename)
      24             : {
      25          49 :         TALLOC_CTX *mem_ctx;
      26          49 :         struct loadparm_service *service;
      27             : 
      28      861213 :         mem_ctx = talloc_stackframe();
      29      861213 :         service = lp_service(servicename);
      30      861213 :         talloc_free(mem_ctx);
      31             : 
      32      861213 :         return service;
      33             : }
      34             : 
      35           0 : static struct loadparm_service *lp_servicebynum_for_s4_ctx(int servicenum)
      36             : {
      37           0 :         TALLOC_CTX *mem_ctx;
      38           0 :         struct loadparm_service *service;
      39             : 
      40           0 :         mem_ctx = talloc_stackframe();
      41           0 :         service = lp_servicebynum(servicenum);
      42           0 :         talloc_free(mem_ctx);
      43             : 
      44           0 :         return service;
      45             : }
      46             : 
      47        2270 : static bool lp_load_for_s4_ctx(const char *filename)
      48             : {
      49          51 :         TALLOC_CTX *mem_ctx;
      50          51 :         bool status;
      51             : 
      52        2270 :         mem_ctx = talloc_stackframe();
      53        2270 :         status =  lp_load_no_reinit(filename);
      54        2270 :         talloc_free(mem_ctx);
      55             : 
      56        2270 :         return status;
      57             : }
      58             : 
      59             : static struct loadparm_s3_helpers s3_fns =
      60             : {
      61             :         .get_parm_ptr = lp_parm_ptr,
      62             :         .get_service = lp_service_for_s4_ctx,
      63             :         .get_servicebynum = lp_servicebynum_for_s4_ctx,
      64             :         .getservicebyname = getservicebyname,
      65             :         .get_numservices = lp_numservices,
      66             :         .load = lp_load_for_s4_ctx,
      67             :         .store_cmdline = store_lp_set_cmdline,
      68             :         .dump = lp_dump,
      69             :         .lp_include = lp_include,
      70             :         .init_ldap_debugging = init_ldap_debugging,
      71             :         .do_section = lp_do_section,
      72             :         .init_globals = loadparm_s3_init_globals,
      73             : };
      74             : 
      75      823089 : const struct loadparm_s3_helpers *loadparm_s3_helpers(void)
      76             : {
      77       10031 :         struct loadparm_s3_helpers *helpers;
      78      823089 :         helpers = &s3_fns;
      79      823089 :         helpers->globals = get_globals();
      80      823089 :         helpers->flags = get_flags();
      81      823089 :         return helpers;
      82             : }

Generated by: LCOV version 1.14