LCOV - code coverage report
Current view: top level - source3/registry - reg_backend_smbconf.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 20 25 80.0 %
Date: 2024-04-21 15:09:00 Functions: 9 11 81.8 %

          Line data    Source code
       1             : /*
       2             :  *  Unix SMB/CIFS implementation.
       3             :  *  Virtual Windows Registry Layer
       4             :  *  Copyright (C) Volker Lendecke 2006
       5             :  *  Copyright (C) Michael Adam 2007
       6             :  *
       7             :  *  This program is free software; you can redistribute it and/or modify
       8             :  *  it under the terms of the GNU General Public License as published by
       9             :  *  the Free Software Foundation; either version 3 of the License, or
      10             :  *  (at your option) any later version.
      11             :  *
      12             :  *  This program is distributed in the hope that it will be useful,
      13             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      14             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      15             :  *  GNU General Public License for more details.
      16             :  *
      17             :  *  You should have received a copy of the GNU General Public License
      18             :  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
      19             :  */
      20             : 
      21             : #include "includes.h"
      22             : #include "registry.h"
      23             : #include "lib/privileges.h"
      24             : 
      25             : #undef DBGC_CLASS
      26             : #define DBGC_CLASS DBGC_REGISTRY
      27             : 
      28             : extern struct registry_ops regdb_ops;           /* these are the default */
      29             : 
      30     2933520 : static int smbconf_fetch_keys( const char *key, struct regsubkey_ctr *subkey_ctr )
      31             : {
      32     2933520 :         return regdb_ops.fetch_subkeys(key, subkey_ctr);
      33             : }
      34             : 
      35           0 : static bool smbconf_store_keys( const char *key, struct regsubkey_ctr *subkeys )
      36             : {
      37           0 :         return regdb_ops.store_subkeys(key, subkeys);
      38             : }
      39             : 
      40        1085 : static WERROR smbconf_create_subkey(const char *key, const char *subkey)
      41             : {
      42        1085 :         return regdb_ops.create_subkey(key, subkey);
      43             : }
      44             : 
      45        1094 : static WERROR smbconf_delete_subkey(const char *key, const char *subkey, bool lazy)
      46             : {
      47        1094 :         return regdb_ops.delete_subkey(key, subkey, lazy);
      48             : }
      49             : 
      50        9891 : static int smbconf_fetch_values(const char *key, struct regval_ctr *val)
      51             : {
      52        9891 :         return regdb_ops.fetch_values(key, val);
      53             : }
      54             : 
      55        4668 : static bool smbconf_store_values(const char *key, struct regval_ctr *val)
      56             : {
      57        4668 :         return regdb_ops.store_values(key, val);
      58             : }
      59             : 
      60         328 : static bool smbconf_reg_access_check(const char *keyname, uint32_t requested,
      61             :                                      uint32_t *granted,
      62             :                                      const struct security_token *token)
      63             : {
      64         328 :         if (!security_token_has_privilege(token, SEC_PRIV_DISK_OPERATOR)) {
      65           0 :                 return False;
      66             :         }
      67             : 
      68         328 :         *granted = REG_KEY_ALL;
      69         328 :         return True;
      70             : }
      71             : 
      72        1960 : static WERROR smbconf_get_secdesc(TALLOC_CTX *mem_ctx, const char *key,
      73             :                                   struct security_descriptor **psecdesc)
      74             : {
      75        1960 :         return regdb_ops.get_secdesc(mem_ctx, key, psecdesc);
      76             : }
      77             : 
      78           0 : static WERROR smbconf_set_secdesc(const char *key,
      79             :                                   struct security_descriptor *secdesc)
      80             : {
      81           0 :         return regdb_ops.set_secdesc(key, secdesc);
      82             : }
      83             : 
      84      286763 : static bool smbconf_subkeys_need_update(struct regsubkey_ctr *subkeys)
      85             : {
      86      286763 :         return regdb_ops.subkeys_need_update(subkeys);
      87             : }
      88             : 
      89       27077 : static bool smbconf_values_need_update(struct regval_ctr *values)
      90             : {
      91       27077 :         return regdb_ops.values_need_update(values);
      92             : }
      93             : 
      94             : /*
      95             :  * Table of function pointers for accessing smb.conf data
      96             :  */
      97             : 
      98             : struct registry_ops smbconf_reg_ops = {
      99             :         .fetch_subkeys = smbconf_fetch_keys,
     100             :         .fetch_values = smbconf_fetch_values,
     101             :         .store_subkeys = smbconf_store_keys,
     102             :         .store_values = smbconf_store_values,
     103             :         .create_subkey = smbconf_create_subkey,
     104             :         .delete_subkey = smbconf_delete_subkey,
     105             :         .reg_access_check = smbconf_reg_access_check,
     106             :         .get_secdesc = smbconf_get_secdesc,
     107             :         .set_secdesc = smbconf_set_secdesc,
     108             :         .subkeys_need_update = smbconf_subkeys_need_update,
     109             :         .values_need_update = smbconf_values_need_update,
     110             : };

Generated by: LCOV version 1.14