From 8f8c56bfbcbfe8f80afb09eb1d481a108b252bee Mon Sep 17 00:00:00 2001 From: Andrew Kroeger Date: Fri, 28 Mar 2008 01:08:49 -0500 Subject: Convert some more files to GPLv3. (This used to be commit ebe5e8399422eb7e2ff4deb546338823e2718907) --- source4/lib/registry/hive.c | 2 +- source4/lib/registry/hive.h | 2 +- source4/lib/registry/local.c | 2 +- source4/lib/registry/patchfile.h | 2 +- source4/lib/registry/patchfile_dotreg.c | 2 +- source4/lib/registry/patchfile_preg.c | 2 +- source4/lib/registry/tests/hive.c | 2 +- source4/lib/registry/tests/registry.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index ad6a6421ab..fc2d0fe869 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -6,7 +6,7 @@ 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 2 of the License, or + 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, diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h index 87f335663d..2410885718 100644 --- a/source4/lib/registry/hive.h +++ b/source4/lib/registry/hive.h @@ -5,7 +5,7 @@ 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 2 of the License, or + 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, diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 3e463100c9..5bf2d86588 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -5,7 +5,7 @@ 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 2 of the License, or + 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, diff --git a/source4/lib/registry/patchfile.h b/source4/lib/registry/patchfile.h index 9289390685..d586aa4c31 100644 --- a/source4/lib/registry/patchfile.h +++ b/source4/lib/registry/patchfile.h @@ -6,7 +6,7 @@ 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 2 of the License, or + 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, diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index 6de642ecb8..5150c90291 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -7,7 +7,7 @@ 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 2 of the License, or + 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, diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index 0d39e67450..8f02a0b5e3 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -6,7 +6,7 @@ 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 2 of the License, or + 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, diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 1e56f125c5..70b0241b04 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -7,7 +7,7 @@ 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 2 of the License, or + 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, diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 7d14b3a412..e5e34c11e0 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -7,7 +7,7 @@ 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 2 of the License, or + 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, -- cgit From f41b9a9dde0dcad17e3a137537548f9bd9ab3901 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 1 Apr 2008 15:08:30 +0200 Subject: Rename libsamba-config to libsamba-hostconfig. (This used to be commit c46b7e90e347da76156ddcae4866adb88e9fec21) --- source4/lib/registry/config.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index b2d7ce202e..70ffce020a 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -52,7 +52,7 @@ PRIVATE_PROTO_HEADER = tools/common.h INSTALLDIR = BINDIR OBJ_FILES = tools/regdiff.o PRIVATE_DEPENDENCIES = \ - LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS + LIBSAMBA-HOSTCONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS # End BINARY regdiff ################################################ @@ -64,7 +64,7 @@ MANPAGES += lib/registry/man/regdiff.1 INSTALLDIR = BINDIR OBJ_FILES = tools/regpatch.o PRIVATE_DEPENDENCIES = \ - LIBSAMBA-CONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS \ + LIBSAMBA-HOSTCONFIG registry LIBPOPT POPT_SAMBA POPT_CREDENTIALS \ registry_common # End BINARY regpatch ################################################ @@ -77,7 +77,7 @@ MANPAGES += lib/registry/man/regpatch.1 INSTALLDIR = BINDIR OBJ_FILES = tools/regshell.o PRIVATE_DEPENDENCIES = \ - LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ + LIBSAMBA-HOSTCONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ SMBREADLINE registry_common # End BINARY regshell ################################################ @@ -90,7 +90,7 @@ MANPAGES += lib/registry/man/regshell.1 INSTALLDIR = BINDIR OBJ_FILES = tools/regtree.o PRIVATE_DEPENDENCIES = \ - LIBSAMBA-CONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ + LIBSAMBA-HOSTCONFIG LIBPOPT registry POPT_SAMBA POPT_CREDENTIALS \ registry_common # End BINARY regtree ################################################ -- cgit From afe3e8172ddaa5e4aa811faceecda4f943d6e2ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 04:53:27 +0200 Subject: Install public header files again and include required prototypes. (This used to be commit 47ffbbf67435904754469544390b67d34c958343) --- source4/lib/registry/tests/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c index 145e599504..6eae26bc46 100644 --- a/source4/lib/registry/tests/generic.c +++ b/source4/lib/registry/tests/generic.c @@ -112,7 +112,7 @@ static bool test_reg_val_description_nullname(struct torture_context *ctx) return true; } -_PUBLIC_ struct torture_suite *torture_registry(TALLOC_CTX *mem_ctx) +struct torture_suite *torture_registry(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, "REGISTRY"); torture_suite_add_simple_test(suite, "str_regtype", -- cgit From 5be50a222facee943edae868e39ff11f7dd68965 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 13:58:05 +0200 Subject: Merge patchfile.h into registry.h (This used to be commit 7b434df67aefc667993f0ebd955af9c1c258f153) --- source4/lib/registry/config.mk | 2 +- source4/lib/registry/patchfile.c | 1 - source4/lib/registry/patchfile.h | 55 --------------------------------- source4/lib/registry/patchfile_dotreg.c | 1 - source4/lib/registry/patchfile_preg.c | 1 - source4/lib/registry/registry.h | 31 +++++++++++++++++-- 6 files changed, 30 insertions(+), 61 deletions(-) delete mode 100644 source4/lib/registry/patchfile.h (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 70ffce020a..1deac1dd46 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -39,7 +39,7 @@ PUBLIC_DEPENDENCIES = \ # End MODULE registry_ldb ################################################ -PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h patchfile.h) +PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h) [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index 687fd4b91b..15e3a158f2 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -20,7 +20,6 @@ */ #include "includes.h" -#include "lib/registry/patchfile.h" #include "lib/registry/registry.h" #include "system/filesys.h" #include "param/param.h" diff --git a/source4/lib/registry/patchfile.h b/source4/lib/registry/patchfile.h deleted file mode 100644 index d586aa4c31..0000000000 --- a/source4/lib/registry/patchfile.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Patchfile interface - Copyright (C) Jelmer Vernooij 2006 - Copyright (C) Wilco Baan Hofman 2006 - - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _PATCHFILE_H -#define _PATCHFILE_H - -#include "lib/registry/registry.h" - -struct reg_diff_callbacks { - WERROR (*add_key) (void *callback_data, const char *key_name); - WERROR (*set_value) (void *callback_data, const char *key_name, - const char *value_name, uint32_t value_type, - DATA_BLOB value); - WERROR (*del_value) (void *callback_data, const char *key_name, - const char *value_name); - WERROR (*del_key) (void *callback_data, const char *key_name); - WERROR (*del_all_values) (void *callback_data, const char *key_name); - WERROR (*done) (void *callback_data); -}; - -WERROR reg_diff_apply(struct registry_context *ctx, const char *filename); - -WERROR reg_generate_diff(struct registry_context *ctx1, - struct registry_context *ctx2, - const struct reg_diff_callbacks *callbacks, - void *callback_data); -WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, - struct smb_iconv_convenience *iconv_convenience, - struct reg_diff_callbacks **callbacks, - void **callback_data); -WERROR reg_generate_diff_key(struct registry_key *oldkey, - struct registry_key *newkey, - const char *path, - const struct reg_diff_callbacks *callbacks, - void *callback_data); - -#endif /* _PATCHFILE_H */ diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c index 5150c90291..59f4044713 100644 --- a/source4/lib/registry/patchfile_dotreg.c +++ b/source4/lib/registry/patchfile_dotreg.c @@ -23,7 +23,6 @@ /* FIXME Newer .REG files, created by Windows XP and above use unicode UTF-16 */ #include "includes.h" -#include "lib/registry/patchfile.h" #include "lib/registry/registry.h" #include "system/filesys.h" #include "param/param.h" diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index 8f02a0b5e3..0fa367bfcb 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -21,7 +21,6 @@ #include "includes.h" #include "lib/registry/registry.h" -#include "lib/registry/patchfile.h" #include "system/filesys.h" #include "param/param.h" diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 5e0b971a1d..b76f2c4bcc 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -66,8 +66,6 @@ struct registry_key struct registry_context *context; }; -#include "lib/registry/patchfile.h" - struct registry_value { const char *name; @@ -285,5 +283,34 @@ WERROR reg_get_security(TALLOC_CTX *mem_ctx, WERROR reg_set_security(struct registry_key *key, struct security_descriptor *security); +struct reg_diff_callbacks { + WERROR (*add_key) (void *callback_data, const char *key_name); + WERROR (*set_value) (void *callback_data, const char *key_name, + const char *value_name, uint32_t value_type, + DATA_BLOB value); + WERROR (*del_value) (void *callback_data, const char *key_name, + const char *value_name); + WERROR (*del_key) (void *callback_data, const char *key_name); + WERROR (*del_all_values) (void *callback_data, const char *key_name); + WERROR (*done) (void *callback_data); +}; + +WERROR reg_diff_apply(struct registry_context *ctx, const char *filename); + +WERROR reg_generate_diff(struct registry_context *ctx1, + struct registry_context *ctx2, + const struct reg_diff_callbacks *callbacks, + void *callback_data); +WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct smb_iconv_convenience *iconv_convenience, + struct reg_diff_callbacks **callbacks, + void **callback_data); +WERROR reg_generate_diff_key(struct registry_key *oldkey, + struct registry_key *newkey, + const char *path, + const struct reg_diff_callbacks *callbacks, + void *callback_data); + + #endif /* _REGISTRY_H */ -- cgit From ec7394e7d2f589905044cff3cb1899f0815991d6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 13:59:48 +0200 Subject: Merge hive.h into registry.h (This used to be commit 3ca14fdf74d2510049bbdbbd2a5be341412cda1b) --- source4/lib/registry/dir.c | 2 +- source4/lib/registry/hive.c | 2 +- source4/lib/registry/hive.h | 209 ----------------------------------- source4/lib/registry/regf.c | 2 +- source4/lib/registry/registry.h | 183 +++++++++++++++++++++++++++++- source4/lib/registry/registry.i | 1 - source4/lib/registry/registry_wrap.c | 2 +- 7 files changed, 186 insertions(+), 215 deletions(-) delete mode 100644 source4/lib/registry/hive.h (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/dir.c b/source4/lib/registry/dir.c index dc3717e886..449ee0f6ee 100644 --- a/source4/lib/registry/dir.c +++ b/source4/lib/registry/dir.c @@ -18,7 +18,7 @@ */ #include "includes.h" -#include "hive.h" +#include "registry.h" #include "system/dir.h" #include "system/filesys.h" diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index fc2d0fe869..2a9b1a59ce 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "hive.h" +#include "registry.h" #include "system/filesys.h" #include "param/param.h" diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h deleted file mode 100644 index 2410885718..0000000000 --- a/source4/lib/registry/hive.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Registry hive interface - Copyright (C) Jelmer Vernooij 2003-2007. - - 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __REGISTRY_HIVE_H__ -#define __REGISTRY_HIVE_H__ - -#include -#include "libcli/util/werror.h" -#include "librpc/gen_ndr/security.h" -#include "libcli/util/ntstatus.h" - -/** - * This file contains the hive API. This API is generally used for - * reading a specific file that contains just one hive. - * - * Good examples are .DAT (NTUSER.DAT) files. - * - * This API does not have any notification support (that - * should be provided by the registry implementation), nor - * does it understand what predefined keys are. - */ - -struct hive_key { - const struct hive_operations *ops; -}; - -struct hive_operations { - const char *name; - - /** - * Open a specific subkey - */ - WERROR (*enum_key) (TALLOC_CTX *mem_ctx, - const struct hive_key *key, uint32_t idx, - const char **name, - const char **classname, - NTTIME *last_mod_time); - - /** - * Open a subkey by name - */ - WERROR (*get_key_by_name) (TALLOC_CTX *mem_ctx, - const struct hive_key *key, const char *name, - struct hive_key **subkey); - - /** - * Add a new key. - */ - WERROR (*add_key) (TALLOC_CTX *ctx, - const struct hive_key *parent_key, const char *name, - const char *classname, - struct security_descriptor *desc, - struct hive_key **key); - /** - * Remove an existing key. - */ - WERROR (*del_key) (const struct hive_key *key, const char *name); - - /** - * Force write of a key to disk. - */ - WERROR (*flush_key) (struct hive_key *key); - - /** - * Retrieve a registry value with a specific index. - */ - WERROR (*enum_value) (TALLOC_CTX *mem_ctx, - struct hive_key *key, int idx, - const char **name, uint32_t *type, - DATA_BLOB *data); - - /** - * Retrieve a registry value with the specified name - */ - WERROR (*get_value_by_name) (TALLOC_CTX *mem_ctx, - struct hive_key *key, const char *name, - uint32_t *type, DATA_BLOB *data); - - /** - * Set a value on the specified registry key. - */ - WERROR (*set_value) (struct hive_key *key, const char *name, - uint32_t type, const DATA_BLOB data); - - /** - * Remove a value. - */ - WERROR (*delete_value) (struct hive_key *key, const char *name); - - /* Security Descriptors */ - - /** - * Change the security descriptor on a registry key. - * - * This should return WERR_NOT_SUPPORTED if the underlying - * format does not have a mechanism for storing - * security descriptors. - */ - WERROR (*set_sec_desc) (struct hive_key *key, - const struct security_descriptor *desc); - - /** - * Retrieve the security descriptor on a registry key. - * - * This should return WERR_NOT_SUPPORTED if the underlying - * format does not have a mechanism for storing - * security descriptors. - */ - WERROR (*get_sec_desc) (TALLOC_CTX *ctx, - const struct hive_key *key, - struct security_descriptor **desc); - - /** - * Retrieve general information about a key. - */ - WERROR (*get_key_info) (TALLOC_CTX *mem_ctx, - const struct hive_key *key, - const char **classname, - uint32_t *num_subkeys, - uint32_t *num_values, - NTTIME *last_change_time, - uint32_t *max_subkeynamelen, - uint32_t *max_valnamelen, - uint32_t *max_valbufsize); -}; - -struct cli_credentials; -struct auth_session_info; - -WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, - struct auth_session_info *session_info, - struct cli_credentials *credentials, - struct loadparm_context *lp_ctx, - struct hive_key **root); -WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key, - const char **classname, uint32_t *num_subkeys, - uint32_t *num_values, NTTIME *last_change_time, - uint32_t *max_subkeynamelen, - uint32_t *max_valnamelen, uint32_t *max_valbufsize); -WERROR hive_key_add_name(TALLOC_CTX *ctx, const struct hive_key *parent_key, - const char *name, const char *classname, - struct security_descriptor *desc, - struct hive_key **key); -WERROR hive_key_del(const struct hive_key *key, const char *name); -WERROR hive_get_key_by_name(TALLOC_CTX *mem_ctx, - const struct hive_key *key, const char *name, - struct hive_key **subkey); -WERROR hive_enum_key(TALLOC_CTX *mem_ctx, - const struct hive_key *key, uint32_t idx, - const char **name, - const char **classname, - NTTIME *last_mod_time); - -WERROR hive_key_set_value(struct hive_key *key, const char *name, - uint32_t type, const DATA_BLOB data); - -WERROR hive_get_value(TALLOC_CTX *mem_ctx, - struct hive_key *key, const char *name, - uint32_t *type, DATA_BLOB *data); -WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx, - struct hive_key *key, uint32_t idx, - const char **name, - uint32_t *type, DATA_BLOB *data); - -WERROR hive_key_del_value(struct hive_key *key, const char *name); - -WERROR hive_key_flush(struct hive_key *key); - - -/* Individual backends */ -WERROR reg_open_directory(TALLOC_CTX *parent_ctx, - const char *location, struct hive_key **key); -WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, - const char *location, struct smb_iconv_convenience *iconv_convenience, - struct hive_key **key); -WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, - struct auth_session_info *session_info, - struct cli_credentials *credentials, - struct loadparm_context *lp_ctx, - struct hive_key **k); - - -WERROR reg_create_directory(TALLOC_CTX *parent_ctx, - const char *location, struct hive_key **key); -WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, - struct smb_iconv_convenience *iconv_convenience, - const char *location, - int major_version, - struct hive_key **key); - - -#endif /* __REGISTRY_HIVE_H__ */ diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index a192f3be4d..46ccca922b 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -18,13 +18,13 @@ along with this program. If not, see . */ #include "includes.h" -#include "lib/registry/hive.h" #include "system/filesys.h" #include "system/time.h" #include "lib/registry/tdr_regf.h" #include "librpc/gen_ndr/ndr_security.h" #include "librpc/gen_ndr/winreg.h" #include "param/param.h" +#include "lib/registry/registry.h" static struct hive_operations reg_backend_regf; diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index b76f2c4bcc..ff03f71eb2 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -24,10 +24,191 @@ struct registry_context; #include +#include "libcli/util/werror.h" #include "librpc/gen_ndr/security.h" -#include "lib/registry/hive.h" #include "libcli/util/ntstatus.h" +/** + * The hive API. This API is generally used for + * reading a specific file that contains just one hive. + * + * Good examples are .DAT (NTUSER.DAT) files. + * + * This API does not have any notification support (that + * should be provided by the registry implementation), nor + * does it understand what predefined keys are. + */ + +struct hive_key { + const struct hive_operations *ops; +}; + +struct hive_operations { + const char *name; + + /** + * Open a specific subkey + */ + WERROR (*enum_key) (TALLOC_CTX *mem_ctx, + const struct hive_key *key, uint32_t idx, + const char **name, + const char **classname, + NTTIME *last_mod_time); + + /** + * Open a subkey by name + */ + WERROR (*get_key_by_name) (TALLOC_CTX *mem_ctx, + const struct hive_key *key, const char *name, + struct hive_key **subkey); + + /** + * Add a new key. + */ + WERROR (*add_key) (TALLOC_CTX *ctx, + const struct hive_key *parent_key, const char *name, + const char *classname, + struct security_descriptor *desc, + struct hive_key **key); + /** + * Remove an existing key. + */ + WERROR (*del_key) (const struct hive_key *key, const char *name); + + /** + * Force write of a key to disk. + */ + WERROR (*flush_key) (struct hive_key *key); + + /** + * Retrieve a registry value with a specific index. + */ + WERROR (*enum_value) (TALLOC_CTX *mem_ctx, + struct hive_key *key, int idx, + const char **name, uint32_t *type, + DATA_BLOB *data); + + /** + * Retrieve a registry value with the specified name + */ + WERROR (*get_value_by_name) (TALLOC_CTX *mem_ctx, + struct hive_key *key, const char *name, + uint32_t *type, DATA_BLOB *data); + + /** + * Set a value on the specified registry key. + */ + WERROR (*set_value) (struct hive_key *key, const char *name, + uint32_t type, const DATA_BLOB data); + + /** + * Remove a value. + */ + WERROR (*delete_value) (struct hive_key *key, const char *name); + + /* Security Descriptors */ + + /** + * Change the security descriptor on a registry key. + * + * This should return WERR_NOT_SUPPORTED if the underlying + * format does not have a mechanism for storing + * security descriptors. + */ + WERROR (*set_sec_desc) (struct hive_key *key, + const struct security_descriptor *desc); + + /** + * Retrieve the security descriptor on a registry key. + * + * This should return WERR_NOT_SUPPORTED if the underlying + * format does not have a mechanism for storing + * security descriptors. + */ + WERROR (*get_sec_desc) (TALLOC_CTX *ctx, + const struct hive_key *key, + struct security_descriptor **desc); + + /** + * Retrieve general information about a key. + */ + WERROR (*get_key_info) (TALLOC_CTX *mem_ctx, + const struct hive_key *key, + const char **classname, + uint32_t *num_subkeys, + uint32_t *num_values, + NTTIME *last_change_time, + uint32_t *max_subkeynamelen, + uint32_t *max_valnamelen, + uint32_t *max_valbufsize); +}; + +struct cli_credentials; +struct auth_session_info; + +WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, + struct auth_session_info *session_info, + struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, + struct hive_key **root); +WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key, + const char **classname, uint32_t *num_subkeys, + uint32_t *num_values, NTTIME *last_change_time, + uint32_t *max_subkeynamelen, + uint32_t *max_valnamelen, uint32_t *max_valbufsize); +WERROR hive_key_add_name(TALLOC_CTX *ctx, const struct hive_key *parent_key, + const char *name, const char *classname, + struct security_descriptor *desc, + struct hive_key **key); +WERROR hive_key_del(const struct hive_key *key, const char *name); +WERROR hive_get_key_by_name(TALLOC_CTX *mem_ctx, + const struct hive_key *key, const char *name, + struct hive_key **subkey); +WERROR hive_enum_key(TALLOC_CTX *mem_ctx, + const struct hive_key *key, uint32_t idx, + const char **name, + const char **classname, + NTTIME *last_mod_time); + +WERROR hive_key_set_value(struct hive_key *key, const char *name, + uint32_t type, const DATA_BLOB data); + +WERROR hive_get_value(TALLOC_CTX *mem_ctx, + struct hive_key *key, const char *name, + uint32_t *type, DATA_BLOB *data); +WERROR hive_get_value_by_index(TALLOC_CTX *mem_ctx, + struct hive_key *key, uint32_t idx, + const char **name, + uint32_t *type, DATA_BLOB *data); + +WERROR hive_key_del_value(struct hive_key *key, const char *name); + +WERROR hive_key_flush(struct hive_key *key); + + +/* Individual backends */ +WERROR reg_open_directory(TALLOC_CTX *parent_ctx, + const char *location, struct hive_key **key); +WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, + const char *location, struct smb_iconv_convenience *iconv_convenience, + struct hive_key **key); +WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, + struct auth_session_info *session_info, + struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, + struct hive_key **k); + + +WERROR reg_create_directory(TALLOC_CTX *parent_ctx, + const char *location, struct hive_key **key); +WERROR reg_create_regf_file(TALLOC_CTX *parent_ctx, + struct smb_iconv_convenience *iconv_convenience, + const char *location, + int major_version, + struct hive_key **key); + + + /* Handles for the predefined keys */ #define HKEY_CLASSES_ROOT 0x80000000 #define HKEY_CURRENT_USER 0x80000001 diff --git a/source4/lib/registry/registry.i b/source4/lib/registry/registry.i index 20ae671c75..8ab402d57d 100644 --- a/source4/lib/registry/registry.i +++ b/source4/lib/registry/registry.i @@ -26,7 +26,6 @@ #include "includes.h" #include "registry.h" #include "param/param.h" -#include "hive.h" typedef struct registry_context reg; typedef struct hive_key hive_key; diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index 51c255e9f7..ded3acbbe6 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -2529,7 +2529,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0}; #include "includes.h" #include "registry.h" #include "param/param.h" -#include "hive.h" +#include "registry.h" typedef struct registry_context reg; typedef struct hive_key hive_key; -- cgit From 4924446969b0f2a02b799fa9b2af14172310ebf0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 14:10:16 +0200 Subject: Trim down installed headers some more. (This used to be commit 71aa38842c270d52d39b805bf7ce29e25e062024) --- source4/lib/registry/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk index 1deac1dd46..77b4ece552 100644 --- a/source4/lib/registry/config.mk +++ b/source4/lib/registry/config.mk @@ -39,7 +39,7 @@ PUBLIC_DEPENDENCIES = \ # End MODULE registry_ldb ################################################ -PUBLIC_HEADERS += $(addprefix lib/registry/, registry.h hive.h) +PUBLIC_HEADERS += lib/registry/registry.h [SUBSYSTEM::registry_common] PUBLIC_DEPENDENCIES = registry -- cgit From 1cf8130e110c63a3bfc04ef8e21ca4343a4ab35c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 14:18:31 +0200 Subject: Move handle utility functions to public header, remove more public headers. (This used to be commit 92e71c19f4e1d3ca123a083942ec578d21f7012c) --- source4/lib/registry/registry_wrap.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/registry_wrap.c b/source4/lib/registry/registry_wrap.c index ded3acbbe6..da09ecbe08 100644 --- a/source4/lib/registry/registry_wrap.c +++ b/source4/lib/registry/registry_wrap.c @@ -2529,7 +2529,6 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0}; #include "includes.h" #include "registry.h" #include "param/param.h" -#include "registry.h" typedef struct registry_context reg; typedef struct hive_key hive_key; -- cgit From 4e5e7a7c688d8a065994cb16fb1da7581bab081a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Apr 2008 16:47:17 +0200 Subject: Reintroduce header previously autogenerated but ignored by git. Also fixed extra include in regpatch. (This used to be commit 0e371cf169e9a607fcbb3e65437ab9413935dd52) --- source4/lib/registry/tools/regpatch.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index 71837d1807..98443e6456 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -23,7 +23,6 @@ #include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" #include "lib/registry/tools/common.h" -#include "lib/registry/patchfile.h" #include "param/param.h" int main(int argc, char **argv) -- cgit From 8495d17c1a97489a75b777d79e69f9680267fd28 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Apr 2008 01:36:03 +0200 Subject: Fix installation of dcerpc_atsvc and registry as required by samba-gtk. (This used to be commit 64a6887ecddc1599bde5dcb06d0b74ffea1def0c) --- source4/lib/registry/registry.pc.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/registry.pc.in b/source4/lib/registry/registry.pc.in index 98943a0736..d981a45b2c 100644 --- a/source4/lib/registry/registry.pc.in +++ b/source4/lib/registry/registry.pc.in @@ -5,8 +5,8 @@ includedir=@includedir@ Name: registry Description: Windows-style registry library -Requires: ldb -Requires.private: +Requires: talloc +Requires.private: ldb Version: 0.0.1 Libs: -L${libdir} -lregistry Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1 -- cgit From adc09857420c4a9306148e8d15ff5faf633ba7a5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Apr 2008 02:28:31 +0200 Subject: Install libevents since it's required by samba-gtk. (This used to be commit 2073346828ffa1d9c35105eadd7afddd3a76a045) --- source4/lib/registry/registry.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index ff03f71eb2..a86294bf46 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -22,11 +22,15 @@ #define _REGISTRY_H struct registry_context; +struct loadparm_context; +struct smb_iconv_convenience; #include #include "libcli/util/werror.h" #include "librpc/gen_ndr/security.h" #include "libcli/util/ntstatus.h" +#include "util/time.h" +#include "util/data_blob.h" /** * The hive API. This API is generally used for -- cgit