The branch, v3-6-test has been updated via 6e7e7bb s3:registry: move regio.h from include/ to registry/ via 5727944 s3:registry: move the reg_db.h from include/ to registry/ via 70204f6 s3:registry: move prototype from reg_init_smbconf.c to its own header. via a74b734 s3:registry: move prototype from reg_init_full.c to its own header. via f0599af s3:registry: move prototypes from reg_init_basic.c to their own header. via a64095c s3:registry: move reg_api_regf prototypes to their own header file. via 378f481 s3:registry: move the reg_api prototypes to their own header. via 9fcf1f0 s3:registry:reg_api: update (C) via e45d0b7 s3:services_db: convert get_common_service_dispname() to talloc via 020df4a s3:registry: regfio fix the build via cca1ae4 s3:registry: remove now (finally) obsolete reg_util_registry.{c,h} via 4260ef9 s3:services_db: does not need legacy registry code any more. via 798e847 s3:services_db: rewrite svcctl_init_keys() to use reg_api calls instead of legacy via 2f6ee60 s3:services_db: extract core of svcctl_set_secdesc to _internal version via 08146db s3:services_db: create the "Security" subkey if it does not exist in svcctl_set_secdesc() via 9407bbd s3:services_db: remove bogus comments via f573c8a s3:services_db: remove unused legacy function svcctl_fetch_regvalues(). via 7d62c97 s3:rpc_server:ntsvcs: registry is not directly used an more. via ad4d9a2 s3:rpc_server:ntsvcs: use svcctl_lookup_dispname instead of legacy svcctl in _PNP_GetDeviceRegProp via 94d448d s3:rpc_server: registry is not direclty used in the svcctl server any more via 0019d2c s3:srv_ntsvcs_nt: make fill_svc_config() use svcctl_get_string_value() via 02c1ed2 s3:services_db: publish svcctl_get_string_value() via 89255c0 s3:services_db: factor out common code of lookup_dispname and lookup_description via c4b1f96 s3:services_db: change svcctl_lookup_description() to use reg_api functions via e5c2593 s3:services_db: rewrite svcctl_lookup_description() to use a tmp talloc ctx via 74b9ec1 s3:services_db: change svcctl_lookup_dispname() to use reg_api functions via c671942 s3:services_db: make svcctl_lookup_dispname() use a temp talloc ctx via 5e9df32 s3:services_db: change svcctl_get_secdesc() to use reg_api functions via c05cf4c s3:services_db: use temp talloc ctx in svcctl_get_secdesc() via 525bc57 s3:services_db: remove the TALLOC_CTX argument from svcctl_set_secdesc via 3b03e66 s3:services_db: fix a debug message via 3a2de89 s3:services_db: rewrite svcctl_set_secdesc to use tmp talloc ctx via 275f5bf s3:services_db: rewrite svcctl_set_secdesc() using reg_api calls instead of legacy via fa7abb8 s3:services_db: untanlge assignments from check in read_init_file(). via 97a9e13 s3:services_db: untangle assignments from check in construct_service_sd(). via 8f23cc8 s3:registry: move prototypes of unused hilvl functions to ret_api_util.h and comment them out via 77fdb9c s3:registry: move (commented out) hilvl util functions to reg_api_util.c via c299a3c s3:registry: move higher level function reg_open_path to new module reg_api_util from 0e8b6f2 s3: Streamline regdb_normalize_keynames_fn a bit
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test - Log ----------------------------------------------------------------- commit 6e7e7bbcf8ebbb742e52f9001b19db785c640f2e Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 09:08:33 2010 +0200 s3:registry: move regio.h from include/ to registry/ commit 57279442344edc6d9c42edd6f77627ee47f03550 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 08:53:49 2010 +0200 s3:registry: move the reg_db.h from include/ to registry/ commit 70204f6d24275e02b90ec1d13facd6476a02504d Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 08:50:54 2010 +0200 s3:registry: move prototype from reg_init_smbconf.c to its own header. commit a74b73447dc49619a71904c4cadcc5a9b4e4082f Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 08:45:06 2010 +0200 s3:registry: move prototype from reg_init_full.c to its own header. commit f0599afe42087766e7c7e571f3e1e849fce1772f Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 08:37:14 2010 +0200 s3:registry: move prototypes from reg_init_basic.c to their own header. commit a64095c309de4cd0a251baf1cabdfa3594d4c436 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 08:23:20 2010 +0200 s3:registry: move reg_api_regf prototypes to their own header file. These two calls are currently only used in the WINREG rpc server. And this reqires linking in the regfio code. commit 378f481962cea8899dee1b9167a634d7905f0b93 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 08:11:18 2010 +0200 s3:registry: move the reg_api prototypes to their own header. commit 9fcf1f03309bcfcdced1e58f91e5f8c969681254 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 07:44:56 2010 +0200 s3:registry:reg_api: update (C) commit e45d0b760dd7c12e13e6a76e3635915d233b1764 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 07:40:36 2010 +0200 s3:services_db: convert get_common_service_dispname() to talloc commit 020df4a141e3ab28a943e2c03943f17fc520b18a Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 07:40:13 2010 +0200 s3:registry: regfio fix the build commit cca1ae44b3749d7a7f5cd3b2a1f259061fb90e36 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 06:51:38 2010 +0200 s3:registry: remove now (finally) obsolete reg_util_registry.{c,h} commit 4260ef920edabbfead16a2f2bdd531385e920192 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 06:49:40 2010 +0200 s3:services_db: does not need legacy registry code any more. commit 798e84780e2e7fe470b8f6f97ed0c8e04122e5ee Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 06:48:19 2010 +0200 s3:services_db: rewrite svcctl_init_keys() to use reg_api calls instead of legacy commit 2f6ee6007e20cab5b84f7fad2137c7725fd1a00a Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 03:11:43 2010 +0200 s3:services_db: extract core of svcctl_set_secdesc to _internal version The internal version operates on an already opened key. commit 08146db06993ec0718f15b36e3aac9d8c4568cb6 Author: Michael Adam <ob...@samba.org> Date: Tue Sep 21 03:00:29 2010 +0200 s3:services_db: create the "Security" subkey if it does not exist in svcctl_set_secdesc() Windows behaves like this. - Tests will follow. commit 9407bbd2c82d809b183fafad7aa6daef711029b9 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 11:24:36 2010 +0200 s3:services_db: remove bogus comments (from copy and paste probably...) commit f573c8ae6d2e393a6565f099c1d564a136af5884 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 11:20:37 2010 +0200 s3:services_db: remove unused legacy function svcctl_fetch_regvalues(). commit 7d62c974664e4e7dca80095a94263e52adf6abe8 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 11:18:33 2010 +0200 s3:rpc_server:ntsvcs: registry is not directly used an more. commit ad4d9a24edf87a408a3217b616db81aaf63b29fa Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 11:17:38 2010 +0200 s3:rpc_server:ntsvcs: use svcctl_lookup_dispname instead of legacy svcctl in _PNP_GetDeviceRegProp commit 94d448dbf4d8ce33d51348afb5d27ecaded38c53 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 10:57:53 2010 +0200 s3:rpc_server: registry is not direclty used in the svcctl server any more commit 0019d2c32c710804d21c8aa33a9524371336e689 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 10:30:30 2010 +0200 s3:srv_ntsvcs_nt: make fill_svc_config() use svcctl_get_string_value() instead of using legacy svcctl_fetch_regvalues() commit 02c1ed2cac15a2ce2f566b7617641da4ec8679e6 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 10:27:56 2010 +0200 s3:services_db: publish svcctl_get_string_value() commit 89255c085ca23f942c4f88316f0726e7d6dcfbbf Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 08:06:30 2010 +0200 s3:services_db: factor out common code of lookup_dispname and lookup_description into a new function svcctl_get_string_value() commit c4b1f960d11007e6bd1ddd1795d7aed6aec00bda Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 06:19:57 2010 +0200 s3:services_db: change svcctl_lookup_description() to use reg_api functions commit e5c2593abbb7944ae068383efb648a0c0d9ba720 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 06:03:58 2010 +0200 s3:services_db: rewrite svcctl_lookup_description() to use a tmp talloc ctx Also remove a possible memory by tallocing the result string also in a default case, where a string constant was returned before. commit 74b9ec1f8b621db55919baa0866707bdd982e757 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 08:11:07 2010 +0200 s3:services_db: change svcctl_lookup_dispname() to use reg_api functions commit c6719429100ded65bf35cd3ad9deb6a9c8a7ad52 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 04:58:27 2010 +0200 s3:services_db: make svcctl_lookup_dispname() use a temp talloc ctx commit 5e9df32643ce79cd521cfda2b0d7b87e23f5e029 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 04:41:59 2010 +0200 s3:services_db: change svcctl_get_secdesc() to use reg_api functions commit c05cf4cd495636dcd78b23e5aaecf1945a7e0eb8 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 04:12:42 2010 +0200 s3:services_db: use temp talloc ctx in svcctl_get_secdesc() commit 525bc5715fd10db445d3cb6f76ec517b507259a6 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 03:38:45 2010 +0200 s3:services_db: remove the TALLOC_CTX argument from svcctl_set_secdesc commit 3b03e6633ed9442b07df5a4063a6417756f6f76c Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 03:36:23 2010 +0200 s3:services_db: fix a debug message commit 3a2de89e7c51109533554784e2b3ebfd1ad5b952 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 03:34:49 2010 +0200 s3:services_db: rewrite svcctl_set_secdesc to use tmp talloc ctx and add a common exit point commit 275f5bf73852b8c21d66195a7f629e148022e37d Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 02:43:33 2010 +0200 s3:services_db: rewrite svcctl_set_secdesc() using reg_api calls instead of legacy commit fa7abb86f2d7efd633646e7df86ac00c51e11996 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 00:46:59 2010 +0200 s3:services_db: untanlge assignments from check in read_init_file(). commit 97a9e13b4aa637f1eeaa57ca350aa00c420e709d Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 00:40:44 2010 +0200 s3:services_db: untangle assignments from check in construct_service_sd(). commit 8f23cc8a2a33fae0d7048bf1a2abd2ca4a1874b1 Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 19:32:28 2010 +0200 s3:registry: move prototypes of unused hilvl functions to ret_api_util.h and comment them out commit 77fdb9c020c412e4cc39ff1886b6a491e5eee10a Author: Michael Adam <ob...@samba.org> Date: Mon Sep 20 19:30:58 2010 +0200 s3:registry: move (commented out) hilvl util functions to reg_api_util.c commit c299a3ca3de2bb8c13fc968de9f136714b2754ae Author: Michael Adam <ob...@samba.org> Date: Thu Oct 28 23:10:50 2010 +0200 s3:registry: move higher level function reg_open_path to new module reg_api_util The reg_api.c code should just export functions that direclty relate to winreg api calls. ----------------------------------------------------------------------- Summary of changes: libgpo/gpext/gpext.c | 1 + source3/Makefile.in | 4 +- source3/include/proto.h | 7 +- source3/include/regfio.h | 225 ------------ source3/include/registry.h | 76 ---- source3/lib/smbconf/smbconf_reg.c | 3 + source3/libgpo/gpo_reg.c | 3 + source3/registry/reg_api.c | 157 +--------- source3/registry/reg_api.h | 72 ++++ source3/registry/reg_api_regf.c | 1 + source3/registry/reg_api_regf.h | 35 ++ source3/registry/reg_api_util.c | 182 ++++++++++ source3/registry/reg_api_util.h | 46 +++ source3/{include => registry}/reg_db.h | 0 source3/registry/reg_init_basic.c | 1 + source3/registry/reg_init_basic.h | 26 ++ source3/registry/reg_init_full.c | 2 + source3/registry/reg_init_full.h | 27 ++ source3/registry/reg_init_smbconf.c | 2 + source3/registry/reg_init_smbconf.h | 27 ++ source3/registry/reg_util_legacy.c | 51 --- source3/registry/reg_util_legacy.h | 45 --- source3/registry/regfio.h | 226 ++++++++++++ source3/rpc_server/srv_eventlog_nt.c | 2 + source3/rpc_server/srv_ntsvcs_nt.c | 32 +- source3/rpc_server/srv_svcctl_nt.c | 31 +-- source3/rpc_server/srv_winreg_nt.c | 2 + source3/services/services_db.c | 588 +++++++++++++++----------------- source3/smbd/server.c | 1 + source3/utils/net_registry.c | 2 + source3/utils/net_rpc_registry.c | 2 +- source3/utils/profiles.c | 2 +- 32 files changed, 969 insertions(+), 912 deletions(-) delete mode 100644 source3/include/regfio.h create mode 100644 source3/registry/reg_api.h create mode 100644 source3/registry/reg_api_regf.h create mode 100644 source3/registry/reg_api_util.c create mode 100644 source3/registry/reg_api_util.h rename source3/{include => registry}/reg_db.h (100%) create mode 100644 source3/registry/reg_init_basic.h create mode 100644 source3/registry/reg_init_full.h create mode 100644 source3/registry/reg_init_smbconf.h delete mode 100644 source3/registry/reg_util_legacy.c delete mode 100644 source3/registry/reg_util_legacy.h create mode 100644 source3/registry/regfio.h Changeset truncated at 500 lines: diff --git a/libgpo/gpext/gpext.c b/libgpo/gpext/gpext.c index 9a09337..4dbf6fb 100644 --- a/libgpo/gpext/gpext.c +++ b/libgpo/gpext/gpext.c @@ -25,6 +25,7 @@ #if _SAMBA_BUILD_ == 3 #include "libgpo/gpo_proto.h" #include "registry.h" +#include "registry/reg_api.h" #endif static struct gp_extension *extensions = NULL; diff --git a/source3/Makefile.in b/source3/Makefile.in index d44bd6f..bbf3200 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -646,6 +646,7 @@ REG_BASE_OBJ = registry/reg_api.o \ REG_SMBCONF_OBJ = $(REG_BASE_OBJ) \ registry/reg_util_token.o \ + registry/reg_api_util.o \ $(REG_BACKENDS_SMBCONF_OBJ) \ $(REG_INIT_SMBCONF_OBJ) @@ -654,8 +655,7 @@ REG_FULL_OBJ = $(REG_SMBCONF_OBJ) \ $(REG_INIT_FULL_OBJ) \ registry/reg_eventlog.o \ registry/reg_perfcount.o \ - librpc/gen_ndr/ndr_perfcount.o \ - registry/reg_util_legacy.o + librpc/gen_ndr/ndr_perfcount.o LIB_EVENTLOG_OBJ = lib/eventlog/eventlog.o diff --git a/source3/include/proto.h b/source3/include/proto.h index f7f751c..4f38e1d 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -4418,10 +4418,13 @@ bool init_service_op_table( void ); void svcctl_init_keys( void ); struct security_descriptor *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ); -bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, struct security_descriptor *sec_desc, NT_USER_TOKEN *token ); +bool svcctl_set_secdesc(const char *name, struct security_descriptor *sec_desc, + NT_USER_TOKEN *token ); +const char *svcctl_get_string_value(TALLOC_CTX *ctx, const char *key_name, + const char *value_name, + NT_USER_TOKEN *token); const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ); const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token ); -struct regval_ctr *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token ); /* The following definitions come from services/svc_netlogon.c */ diff --git a/source3/include/regfio.h b/source3/include/regfio.h deleted file mode 100644 index f2d952b..0000000 --- a/source3/include/regfio.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Windows NT registry I/O library - * Copyright (c) Gerald (Jerry) Carter 2005 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. - */ - -/************************************************************ - * Most of this information was obtained from - * http://www.wednesday.demon.co.uk/dosreg.html - * Thanks Nigel! - ***********************************************************/ - -#include "registry/reg_parse_prs.h" - -#ifndef _REGFIO_H -#define _REGFIO_H - -struct regsubkey_ctr; - -/* Macros */ - -#define REGF_BLOCKSIZE 0x1000 -#define REGF_ALLOC_BLOCK 0x1000 - -/* header sizes for various records */ - -#define REGF_HDR_SIZE 4 -#define HBIN_HDR_SIZE 4 -#define HBIN_HEADER_REC_SIZE 0x24 -#define REC_HDR_SIZE 2 - -#define REGF_OFFSET_NONE 0xffffffff - -/* Flags for the vk records */ - -#define VK_FLAG_NAME_PRESENT 0x0001 -#define VK_DATA_IN_OFFSET 0x80000000 - -/* NK record macros */ - -#define NK_TYPE_LINKKEY 0x0010 -#define NK_TYPE_NORMALKEY 0x0020 -#define NK_TYPE_ROOTKEY 0x002c - -#define HBIN_STORE_REF(x, y) { x->hbin = y; y->ref_count++ }; -#define HBIN_REMOVE_REF(x, y) { x->hbin = NULL; y->ref_count-- /* if the count == 0; we can clean up */ }; - - -/* HBIN block */ -struct regf_hbin; -typedef struct regf_hbin { - struct regf_hbin *prev, *next; - uint32 file_off; /* my offset in the registry file */ - uint32 free_off; /* offset to free space within the hbin record */ - uint32 free_size; /* amount of data left in the block */ - int ref_count; /* how many active records are pointing to this block (not used currently) */ - - char header[HBIN_HDR_SIZE]; /* "hbin" */ - uint32 first_hbin_off; /* offset from first hbin block */ - uint32 block_size; /* block size of this blockually a multiple of 4096Kb) */ - - prs_struct ps; /* data */ - - bool dirty; /* has this hbin block been modified? */ -} REGF_HBIN; - -/* ??? List -- list of key offsets and hashed names for consistency */ - -typedef struct { - uint32 nk_off; - uint8 keycheck[sizeof(uint32)]; - char *fullname; -} REGF_HASH_REC; - -typedef struct { - REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ - uint32 hbin_off; /* offset from beginning of this hbin block */ - uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ - - char header[REC_HDR_SIZE]; - uint16 num_keys; - REGF_HASH_REC *hashes; -} REGF_LF_REC; - -/* Key Value */ - -typedef struct { - REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ - uint32 hbin_off; /* offset from beginning of this hbin block */ - uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ - uint32 rec_off; /* offset stored in the value list */ - - char header[REC_HDR_SIZE]; - char *valuename; - uint32 data_size; - uint32 data_off; - uint8 *data; - uint32 type; - uint16 flag; -} REGF_VK_REC; - - -/* Key Security */ -struct _regf_sk_rec; - -typedef struct _regf_sk_rec { - struct _regf_sk_rec *next, *prev; - REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ - uint32 hbin_off; /* offset from beginning of this hbin block */ - uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ - - uint32 sk_off; /* offset parsed from NK record used as a key - to lookup reference to this SK record */ - - char header[REC_HDR_SIZE]; - uint32 prev_sk_off; - uint32 next_sk_off; - uint32 ref_count; - uint32 size; - struct security_descriptor *sec_desc; -} REGF_SK_REC; - -/* Key Name */ - -typedef struct { - REGF_HBIN *hbin; /* pointer to HBIN record (in memory) containing this nk record */ - uint32 hbin_off; /* offset from beginning of this hbin block */ - uint32 subkey_index; /* index to next subkey record to return */ - uint32 rec_size; /* ((start_offset - end_offset) & 0xfffffff8) */ - - /* header information */ - - char header[REC_HDR_SIZE]; - uint16 key_type; - NTTIME mtime; - uint32 parent_off; /* back pointer in registry hive */ - uint32 classname_off; - char *classname; - char *keyname; - - /* max lengths */ - - uint32 max_bytes_subkeyname; /* max subkey name * 2 */ - uint32 max_bytes_subkeyclassname; /* max subkey classname length (as if) */ - uint32 max_bytes_valuename; /* max valuename * 2 */ - uint32 max_bytes_value; /* max value data size */ - - /* unknowns */ - - uint32 unk_index; /* nigel says run time index ? */ - - /* children */ - - uint32 num_subkeys; - uint32 subkeys_off; /* hash records that point to NK records */ - uint32 num_values; - uint32 values_off; /* value lists which point to VK records */ - uint32 sk_off; /* offset to SK record */ - - /* link in the other records here */ - - REGF_LF_REC subkeys; - REGF_VK_REC *values; - REGF_SK_REC *sec_desc; - -} REGF_NK_REC; - -/* REGF block */ - -typedef struct { - /* run time information */ - - int fd; /* file descriptor */ - int open_flags; /* flags passed to the open() call */ - TALLOC_CTX *mem_ctx; /* memory context for run-time file access information */ - REGF_HBIN *block_list; /* list of open hbin blocks */ - - /* file format information */ - - char header[REGF_HDR_SIZE]; /* "regf" */ - uint32 data_offset; /* offset to record in the first (or any?) hbin block */ - uint32 last_block; /* offset to last hbin block in file */ - uint32 checksum; /* XOR of bytes 0x0000 - 0x01FB */ - NTTIME mtime; - - REGF_SK_REC *sec_desc_list; /* list of security descriptors referenced by NK records */ - - /* unknowns used to simply writing */ - - uint32 unknown1; - uint32 unknown2; - uint32 unknown3; - uint32 unknown4; - uint32 unknown5; - uint32 unknown6; - -} REGF_FILE; - -/* Function Declarations */ - -REGF_FILE* regfio_open( const char *filename, int flags, int mode ); -int regfio_close( REGF_FILE *r ); - -REGF_NK_REC* regfio_rootkey( REGF_FILE *file ); -REGF_NK_REC* regfio_fetch_subkey( REGF_FILE *file, REGF_NK_REC *nk ); -REGF_NK_REC* regfio_write_key ( REGF_FILE *file, const char *name, - struct regval_ctr *values, struct regsubkey_ctr *subkeys, - struct security_descriptor *sec_desc, REGF_NK_REC *parent ); - - -#endif /* _REGFIO_H */ - diff --git a/source3/include/registry.h b/source3/include/registry.h index 7543ffb..975b00a 100644 --- a/source3/include/registry.h +++ b/source3/include/registry.h @@ -129,80 +129,4 @@ struct registry_key { #define REG_KEY_HKPD 1 #define REG_KEY_HKPT 2 - -/* The following definitions come from registry/reg_api.c */ - -WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive, - uint32 desired_access, - const struct nt_user_token *token, - struct registry_key **pkey); -WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent, - const char *name, uint32 desired_access, - struct registry_key **pkey); -WERROR reg_enumkey(TALLOC_CTX *mem_ctx, struct registry_key *key, - uint32 idx, char **name, NTTIME *last_write_time); -WERROR reg_enumvalue(TALLOC_CTX *mem_ctx, struct registry_key *key, - uint32 idx, char **pname, struct registry_value **pval); -WERROR reg_queryvalue(TALLOC_CTX *mem_ctx, struct registry_key *key, - const char *name, struct registry_value **pval); -WERROR reg_querymultiplevalues(TALLOC_CTX *mem_ctx, - struct registry_key *key, - uint32_t num_names, - const char **names, - uint32_t *pnum_vals, - struct registry_value **pvals); -WERROR reg_queryinfokey(struct registry_key *key, uint32_t *num_subkeys, - uint32_t *max_subkeylen, uint32_t *max_subkeysize, - uint32_t *num_values, uint32_t *max_valnamelen, - uint32_t *max_valbufsize, uint32_t *secdescsize, - NTTIME *last_changed_time); -WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent, - const char *subkeypath, uint32 desired_access, - struct registry_key **pkey, - enum winreg_CreateAction *paction); -WERROR reg_deletekey(struct registry_key *parent, const char *path); -WERROR reg_setvalue(struct registry_key *key, const char *name, - const struct registry_value *val); -WERROR reg_deletevalue(struct registry_key *key, const char *name); -WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key, - struct security_descriptor **psecdesc); -WERROR reg_setkeysecurity(struct registry_key *key, - struct security_descriptor *psecdesc); -WERROR reg_getversion(uint32_t *version); -WERROR reg_deleteallvalues(struct registry_key *key); -WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path, - uint32 desired_access, const struct nt_user_token *token, - struct registry_key **pkey); -WERROR reg_deletekey_recursive(TALLOC_CTX *ctx, - struct registry_key *parent, - const char *path); -WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, - struct registry_key *parent, - const char *path); -WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path, - uint32 desired_access, - const struct nt_user_token *token, - enum winreg_CreateAction *paction, - struct registry_key **pkey); -WERROR reg_delete_path(const struct nt_user_token *token, - const char *orig_path); - -/* The following definitions come from registry/reg_api_regf.c */ - -WERROR reg_restorekey(struct registry_key *key, const char *fname); -WERROR reg_savekey(struct registry_key *key, const char *fname); - -/* The following definitions come from registry/reg_init_basic.c */ - -WERROR registry_init_common(void); -WERROR registry_init_basic(void); - -/* The following definitions come from registry/reg_init_full.c */ - -WERROR registry_init_full(void); - -/* The following definitions come from registry/reg_init_smbconf.c */ - -WERROR registry_init_smbconf(const char *keyname); - #endif /* _REGISTRY_H */ diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index 08d559b..8ae6d5a 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -20,8 +20,11 @@ #include "includes.h" #include "lib/smbconf/smbconf_private.h" #include "registry.h" +#include "registry/reg_api.h" #include "registry/reg_backend_db.h" #include "registry/reg_util_token.h" +#include "registry/reg_api_util.h" +#include "registry/reg_init_smbconf.h" #include "lib/smbconf/smbconf_init.h" #include "lib/smbconf/smbconf_reg.h" diff --git a/source3/libgpo/gpo_reg.c b/source3/libgpo/gpo_reg.c index 5b56ecd..e5bc643 100644 --- a/source3/libgpo/gpo_reg.c +++ b/source3/libgpo/gpo_reg.c @@ -21,7 +21,10 @@ #include "../libgpo/gpo.h" #include "libgpo/gpo_proto.h" #include "registry.h" +#include "registry/reg_api.h" #include "registry/reg_backend_db.h" +#include "registry/reg_api_util.h" +#include "registry/reg_init_basic.h" /**************************************************************** diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 7a6f10c..743e139 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -2,7 +2,7 @@ * Unix SMB/CIFS implementation. * Virtual Windows Registry Layer * Copyright (C) Volker Lendecke 2006 - * Copyright (C) Michael Adam 2007-2008 + * Copyright (C) Michael Adam 2007-2010 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,6 +64,7 @@ #include "includes.h" #include "registry.h" +#include "reg_api.h" #include "reg_cachehook.h" #include "reg_util_internal.h" #include "reg_backend_db.h" @@ -779,62 +780,6 @@ WERROR reg_deleteallvalues(struct registry_key *key) } /* - * Utility function to open a complete registry path including the hive prefix. - */ - -WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path, - uint32 desired_access, const struct nt_user_token *token, - struct registry_key **pkey) -{ - struct registry_key *hive, *key; - char *path, *p; - WERROR err; - - if (!(path = SMB_STRDUP(orig_path))) { - return WERR_NOMEM; - } - - p = strchr(path, '\\'); - - if ((p == NULL) || (p[1] == '\0')) { - /* - * No key behind the hive, just return the hive - */ - - err = reg_openhive(mem_ctx, path, desired_access, token, - &hive); - if (!W_ERROR_IS_OK(err)) { - SAFE_FREE(path); - return err; - } - SAFE_FREE(path); - *pkey = hive; - return WERR_OK; - } - - *p = '\0'; - - err = reg_openhive(mem_ctx, path, KEY_ENUMERATE_SUB_KEYS, token, - &hive); - if (!W_ERROR_IS_OK(err)) { - SAFE_FREE(path); - return err; - } - - err = reg_openkey(mem_ctx, hive, p+1, desired_access, &key); - - TALLOC_FREE(hive); - SAFE_FREE(path); - - if (!W_ERROR_IS_OK(err)) { - return err; - } - - *pkey = key; - return WERR_OK; -} - -/* * Utility function to delete a registry key with all its subkeys. * Note that reg_deletekey returns ACCESS_DENIED when called on a * key that has subkeys. @@ -940,101 +885,3 @@ WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, return reg_deletekey_recursive_trans(ctx, parent, path, false); } -#if 0 -/* these two functions are unused. */ - -/** - * Utility function to create a registry key without opening the hive - * before. Assumes the hive already exists. - */ - -WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path, - uint32 desired_access, - const struct nt_user_token *token, -- Samba Shared Repository