2 * Unix SMB/CIFS implementation.
3 * Virtual Windows Registry Layer
4 * Copyright (C) Volker Lendecke 2006
5 * Copyright (C) Michael Adam 2007
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.
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.
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/>.
23 #include "lib/privileges.h"
26 #define DBGC_CLASS DBGC_REGISTRY
28 extern struct registry_ops regdb_ops
; /* these are the default */
30 static int smbconf_fetch_keys( const char *key
, struct regsubkey_ctr
*subkey_ctr
)
32 return regdb_ops
.fetch_subkeys(key
, subkey_ctr
);
35 static bool smbconf_store_keys( const char *key
, struct regsubkey_ctr
*subkeys
)
37 return regdb_ops
.store_subkeys(key
, subkeys
);
40 static WERROR
smbconf_create_subkey(const char *key
, const char *subkey
)
42 return regdb_ops
.create_subkey(key
, subkey
);
45 static WERROR
smbconf_delete_subkey(const char *key
, const char *subkey
, bool lazy
)
47 return regdb_ops
.delete_subkey(key
, subkey
, lazy
);
50 static int smbconf_fetch_values(const char *key
, struct regval_ctr
*val
)
52 return regdb_ops
.fetch_values(key
, val
);
55 static bool smbconf_store_values(const char *key
, struct regval_ctr
*val
)
57 return regdb_ops
.store_values(key
, val
);
60 static bool smbconf_reg_access_check(const char *keyname
, uint32 requested
,
62 const struct security_token
*token
)
64 if (!security_token_has_privilege(token
, SEC_PRIV_DISK_OPERATOR
)) {
68 *granted
= REG_KEY_ALL
;
72 static WERROR
smbconf_get_secdesc(TALLOC_CTX
*mem_ctx
, const char *key
,
73 struct security_descriptor
**psecdesc
)
75 return regdb_ops
.get_secdesc(mem_ctx
, key
, psecdesc
);
78 static WERROR
smbconf_set_secdesc(const char *key
,
79 struct security_descriptor
*secdesc
)
81 return regdb_ops
.set_secdesc(key
, secdesc
);
86 * Table of function pointers for accessing smb.conf data
89 struct registry_ops smbconf_reg_ops
= {
90 .fetch_subkeys
= smbconf_fetch_keys
,
91 .fetch_values
= smbconf_fetch_values
,
92 .store_subkeys
= smbconf_store_keys
,
93 .store_values
= smbconf_store_values
,
94 .create_subkey
= smbconf_create_subkey
,
95 .delete_subkey
= smbconf_delete_subkey
,
96 .reg_access_check
= smbconf_reg_access_check
,
97 .get_secdesc
= smbconf_get_secdesc
,
98 .set_secdesc
= smbconf_set_secdesc
,