2 * Unix SMB/CIFS implementation.
3 * Virtual Windows Registry Layer
4 * Copyright (C) Volker Lendecke 2006
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 2 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #define DBGC_CLASS DBGC_RPC_SRV
26 extern REGISTRY_OPS regdb_ops
; /* these are the default */
28 static int smbconf_fetch_keys( const char *key
, REGSUBKEY_CTR
*subkey_ctr
)
30 return regdb_ops
.fetch_subkeys(key
, subkey_ctr
);
33 static BOOL
smbconf_store_keys( const char *key
, REGSUBKEY_CTR
*subkeys
)
35 return regdb_ops
.store_subkeys(key
, subkeys
);
38 static int smbconf_fetch_values( const char *key
, REGVAL_CTR
*val
)
40 return regdb_ops
.fetch_values(key
, val
);
43 static BOOL
smbconf_store_values( const char *key
, REGVAL_CTR
*val
)
46 int num_values
= regval_ctr_numvals(val
);
48 for (i
=0; i
< num_values
; i
++) {
49 REGISTRY_VALUE
*theval
= regval_ctr_specific_value(val
, i
);
50 const char *valname
= regval_name(theval
);
52 if (registry_smbconf_valname_forbidden(valname
)) {
53 DEBUG(0, ("smbconf_store_values: value '%s' forbidden "
54 "in registry.\n", valname
));
58 return regdb_ops
.store_values(key
, val
);
61 static BOOL
smbconf_reg_access_check(const char *keyname
, uint32 requested
,
63 const struct nt_user_token
*token
)
65 if (!(user_has_privileges(token
, &se_disk_operators
))) {
69 *granted
= REG_KEY_ALL
;
73 static WERROR
smbconf_get_secdesc(TALLOC_CTX
*mem_ctx
, const char *key
,
74 struct security_descriptor
**psecdesc
)
76 return regdb_ops
.get_secdesc(mem_ctx
, key
, psecdesc
);
79 static WERROR
smbconf_set_secdesc(const char *key
,
80 struct security_descriptor
*secdesc
)
82 return regdb_ops
.set_secdesc(key
, secdesc
);
87 * Table of function pointers for accessing smb.conf data
90 REGISTRY_OPS smbconf_reg_ops
= {
95 smbconf_reg_access_check
,