r19531: Make struct ldb_dn opaque and local to ldb_dn.c
[Samba/aatanasov.git] / source4 / lib / registry / reg_samba.c
blob3553c4cb6d19149749f2fd4d7df57c296b90e14c
1 /*
2 Unix SMB/CIFS implementation.
3 Copyright (C) Jelmer Vernooij 2004.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "includes.h"
21 #include "registry.h"
23 /**
24 * @file
25 * @brief Samba-specific registry functions
28 static WERROR reg_samba_get_predef (struct registry_context *ctx, uint32_t hkey, struct registry_key **k)
30 WERROR error;
31 const char *conf;
32 char *backend;
33 const char *location;
34 const char *hivename = reg_get_predef_name(hkey);
36 *k = NULL;
38 conf = lp_parm_string(-1, "registry", hivename);
40 if (!conf) {
41 return WERR_NOT_SUPPORTED;
44 location = strchr(conf, ':');
45 if (location) {
46 backend = talloc_strndup(ctx, conf, (int)(location - conf));
47 location++;
48 } else {
49 backend = talloc_strdup(ctx, "ldb");
50 location = conf;
53 /* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes
54 * and HKEY_CURRENT_USER\Software\Classes */
56 /* FIXME: HKEY_CURRENT_CONFIG is an alias for HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current */
58 /* FIXME: HKEY_PERFORMANCE_DATA is dynamically generated */
60 /* FIXME: HKEY_LOCAL_MACHINE\Hardware is autogenerated */
62 /* FIXME: HKEY_LOCAL_MACHINE\Security\SAM is an alias for HKEY_LOCAL_MACHINE\SAM */
64 error = reg_open_hive(ctx, backend, location, ctx->session_info, ctx->credentials, k);
66 talloc_free(backend);
68 return error;
71 _PUBLIC_ WERROR reg_open_local (TALLOC_CTX *mem_ctx,
72 struct registry_context **ctx,
73 struct auth_session_info *session_info,
74 struct cli_credentials *credentials)
76 *ctx = talloc(mem_ctx, struct registry_context);
77 (*ctx)->credentials = talloc_reference(*ctx, credentials);
78 (*ctx)->session_info = talloc_reference(*ctx, session_info);
79 (*ctx)->get_predefined_key = reg_samba_get_predef;
81 return WERR_OK;