2 Unix SMB/CIFS implementation.
3 Copyright (C) Jelmer Vernooij 2004-2007.
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 3 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, see <http://www.gnu.org/licenses/>.
21 #include "param/param.h"
25 * @brief Samba-specific registry functions
28 static WERROR
mount_samba_hive(struct registry_context
*ctx
,
29 struct tevent_context
*event_ctx
,
30 struct loadparm_context
*lp_ctx
,
31 struct auth_session_info
*auth_info
,
32 struct cli_credentials
*creds
,
37 struct hive_key
*hive
;
40 location
= talloc_asprintf(ctx
, "%s/%s.ldb",
41 lp_private_dir(lp_ctx
),
43 W_ERROR_HAVE_NO_MEMORY(location
);
45 error
= reg_open_hive(ctx
, location
, auth_info
, creds
, event_ctx
, lp_ctx
, &hive
);
47 if (W_ERROR_EQUAL(error
, WERR_BADFILE
))
48 error
= reg_open_ldb_file(ctx
, location
, auth_info
,
49 creds
, event_ctx
, lp_ctx
, &hive
);
51 if (!W_ERROR_IS_OK(error
))
54 return reg_mount_hive(ctx
, hive
, hive_id
, NULL
);
58 _PUBLIC_ WERROR
reg_open_samba(TALLOC_CTX
*mem_ctx
,
59 struct registry_context
**ctx
,
60 struct tevent_context
*ev_ctx
,
61 struct loadparm_context
*lp_ctx
,
62 struct auth_session_info
*session_info
,
63 struct cli_credentials
*credentials
)
67 result
= reg_open_local(mem_ctx
, ctx
);
68 if (!W_ERROR_IS_OK(result
)) {
72 mount_samba_hive(*ctx
, ev_ctx
, lp_ctx
, session_info
, credentials
,
73 "hklm", HKEY_LOCAL_MACHINE
);
75 mount_samba_hive(*ctx
, ev_ctx
, lp_ctx
, session_info
, credentials
,
76 "hkcr", HKEY_CLASSES_ROOT
);
78 /* FIXME: Should be mounted from NTUSER.DAT in the home directory of the
80 mount_samba_hive(*ctx
, ev_ctx
, lp_ctx
, session_info
, credentials
,
81 "hkcu", HKEY_CURRENT_USER
);
83 mount_samba_hive(*ctx
, ev_ctx
, lp_ctx
, session_info
, credentials
,
86 /* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes
87 * and HKEY_CURRENT_USER\Software\Classes */
89 /* FIXME: HKEY_CURRENT_CONFIG is an alias for HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current */
91 /* FIXME: HKEY_PERFORMANCE_DATA is dynamically generated */
93 /* FIXME: HKEY_LOCAL_MACHINE\Hardware is autogenerated */
95 /* FIXME: HKEY_LOCAL_MACHINE\Security\SAM is an alias for HKEY_LOCAL_MACHINE\SAM */