~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to source3/registry/reg_backend_smbconf.c

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
23
#undef DBGC_CLASS
 
24
#define DBGC_CLASS DBGC_REGISTRY
 
25
 
 
26
extern REGISTRY_OPS regdb_ops;          /* these are the default */
 
27
 
 
28
static int smbconf_fetch_keys( const char *key, struct regsubkey_ctr *subkey_ctr )
 
29
{
 
30
        return regdb_ops.fetch_subkeys(key, subkey_ctr);
 
31
}
 
32
 
 
33
static bool smbconf_store_keys( const char *key, struct regsubkey_ctr *subkeys )
 
34
{
 
35
        return regdb_ops.store_subkeys(key, subkeys);
 
36
}
 
37
 
 
38
static WERROR smbconf_create_subkey(const char *key, const char *subkey)
 
39
{
 
40
        return regdb_ops.create_subkey(key, subkey);
 
41
}
 
42
 
 
43
static WERROR smbconf_delete_subkey(const char *key, const char *subkey)
 
44
{
 
45
        return regdb_ops.delete_subkey(key, subkey);
 
46
}
 
47
 
 
48
static int smbconf_fetch_values( const char *key, REGVAL_CTR *val )
 
49
{
 
50
        return regdb_ops.fetch_values(key, val);
 
51
}
 
52
 
 
53
static bool smbconf_store_values( const char *key, REGVAL_CTR *val )
 
54
{
 
55
        return regdb_ops.store_values(key, val);
 
56
}
 
57
 
 
58
static bool smbconf_reg_access_check(const char *keyname, uint32 requested,
 
59
                                     uint32 *granted,
 
60
                                     const struct nt_user_token *token)
 
61
{
 
62
        if (!(user_has_privileges(token, &se_disk_operators))) {
 
63
                return False;
 
64
        }
 
65
 
 
66
        *granted = REG_KEY_ALL;
 
67
        return True;
 
68
}
 
69
 
 
70
static WERROR smbconf_get_secdesc(TALLOC_CTX *mem_ctx, const char *key,
 
71
                                  struct security_descriptor **psecdesc)
 
72
{
 
73
        return regdb_ops.get_secdesc(mem_ctx, key, psecdesc);
 
74
}
 
75
 
 
76
static WERROR smbconf_set_secdesc(const char *key,
 
77
                                  struct security_descriptor *secdesc)
 
78
{
 
79
        return regdb_ops.set_secdesc(key, secdesc);
 
80
}
 
81
 
 
82
 
 
83
/*
 
84
 * Table of function pointers for accessing smb.conf data
 
85
 */
 
86
 
 
87
REGISTRY_OPS smbconf_reg_ops = {
 
88
        .fetch_subkeys = smbconf_fetch_keys,
 
89
        .fetch_values = smbconf_fetch_values,
 
90
        .store_subkeys = smbconf_store_keys,
 
91
        .store_values = smbconf_store_values,
 
92
        .create_subkey = smbconf_create_subkey,
 
93
        .delete_subkey = smbconf_delete_subkey,
 
94
        .reg_access_check = smbconf_reg_access_check,
 
95
        .get_secdesc = smbconf_get_secdesc,
 
96
        .set_secdesc = smbconf_set_secdesc,
 
97
};