pam_winbind: fix pam_sm_chauthtok for storing modified cached creds.
[Samba/gbeck.git] / source3 / registry / reg_backend_smbconf.c
blob2e4a5f1c1d7ec84e9113177e398fa01d2627321f
1 /*
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/>.
21 #include "includes.h"
23 #undef DBGC_CLASS
24 #define DBGC_CLASS DBGC_REGISTRY
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 )
45 return regdb_ops.store_values(key, val);
48 static bool smbconf_reg_access_check(const char *keyname, uint32 requested,
49 uint32 *granted,
50 const struct nt_user_token *token)
52 if (!(user_has_privileges(token, &se_disk_operators))) {
53 return False;
56 *granted = REG_KEY_ALL;
57 return True;
60 static WERROR smbconf_get_secdesc(TALLOC_CTX *mem_ctx, const char *key,
61 struct security_descriptor **psecdesc)
63 return regdb_ops.get_secdesc(mem_ctx, key, psecdesc);
66 static WERROR smbconf_set_secdesc(const char *key,
67 struct security_descriptor *secdesc)
69 return regdb_ops.set_secdesc(key, secdesc);
74 * Table of function pointers for accessing smb.conf data
77 REGISTRY_OPS smbconf_reg_ops = {
78 .fetch_subkeys = smbconf_fetch_keys,
79 .fetch_values = smbconf_fetch_values,
80 .store_subkeys = smbconf_store_keys,
81 .store_values = smbconf_store_values,
82 .reg_access_check = smbconf_reg_access_check,
83 .get_secdesc = smbconf_get_secdesc,
84 .set_secdesc = smbconf_set_secdesc,