From ff7342a4ad1cc1ac8571c86466c197b6a8fa6b41 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 4 Sep 2005 14:47:19 +0000 Subject: r10026: Move registry header file to lib/registry Add support for showing security descriptor in regshell Add support for saving files in NT4 registry backend (This used to be commit 47cecd4726e6568f1aafb404646d2664f630a9bb) --- source4/lib/registry/registry.h | 136 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 source4/lib/registry/registry.h (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h new file mode 100644 index 0000000000..f9e8a7698c --- /dev/null +++ b/source4/lib/registry/registry.h @@ -0,0 +1,136 @@ +/* + Unix SMB/CIFS implementation. + Registry interface + Copyright (C) Gerald Carter 2002. + Copyright (C) Jelmer Vernooij 2003-2004. + + 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 + (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_H /* _REGISTRY_H */ +#define _REGISTRY_H + +/* Handles for the predefined keys */ +#define HKEY_CLASSES_ROOT 0x80000000 +#define HKEY_CURRENT_USER 0x80000001 +#define HKEY_LOCAL_MACHINE 0x80000002 +#define HKEY_USERS 0x80000003 +#define HKEY_PERFORMANCE_DATA 0x80000004 +#define HKEY_CURRENT_CONFIG 0x80000005 +#define HKEY_DYN_DATA 0x80000006 +#define HKEY_PERFORMANCE_TEXT 0x80000050 +#define HKEY_PERFORMANCE_NLSTEXT 0x80000060 + +#define REG_DELETE -1 + +/* + * The general idea here is that every backend provides a 'hive'. Combining + * various hives gives you a complete registry like windows has + */ + +#define REGISTRY_INTERFACE_VERSION 1 + +/* structure to store the registry handles */ +struct registry_key { + char *name; /* Name of the key */ + const char *path; /* Full path to the key */ + char *class_name; /* Name of key class */ + NTTIME last_mod; /* Time last modified */ + struct registry_hive *hive; + void *backend_data; +}; + +struct registry_value { + char *name; + unsigned int data_type; + DATA_BLOB data; +}; + +/* FIXME */ +typedef void (*key_notification_function) (void); +typedef void (*value_notification_function) (void); + +/* + * Container for function pointers to enumeration routines + * for virtual registry view + * + * Backends can provide : + * - just one hive (example: nt4, w95) + * - several hives (example: rpc). + * + * Backends should always do case-insensitive compares + * (everything is case-insensitive but case-preserving, + * just like the FS) + */ + +struct hive_operations { + const char *name; + + /* Implement this one */ + WERROR (*open_hive) (struct registry_hive *, struct registry_key **); + WERROR (*save_hive) (struct registry_hive *, const char *location); + + /* Or this one */ + WERROR (*open_key) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **); + + WERROR (*num_subkeys) (struct registry_key *, uint32_t *count); + WERROR (*num_values) (struct registry_key *, uint32_t *count); + WERROR (*get_subkey_by_index) (TALLOC_CTX *, struct registry_key *, int idx, struct registry_key **); + + /* Can not contain more then one level */ + WERROR (*get_subkey_by_name) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **); + WERROR (*get_value_by_index) (TALLOC_CTX *, struct registry_key *, int idx, struct registry_value **); + + /* Can not contain more then one level */ + WERROR (*get_value_by_name) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_value **); + + /* Security control */ + WERROR (*key_get_sec_desc) (TALLOC_CTX *, struct registry_key *, struct security_descriptor **); + WERROR (*key_set_sec_desc) (struct registry_key *, struct security_descriptor *); + + /* Notification */ + WERROR (*request_key_change_notify) (struct registry_key *, key_notification_function); + WERROR (*request_value_change_notify) (struct registry_value *, value_notification_function); + + /* Key management */ + WERROR (*add_key)(TALLOC_CTX *, struct registry_key *, const char *name, uint32_t access_mask, struct security_descriptor *, struct registry_key **); + WERROR (*del_key)(struct registry_key *, const char *name); + WERROR (*flush_key) (struct registry_key *); + + /* Value management */ + WERROR (*set_value)(struct registry_key *, const char *name, uint32_t type, DATA_BLOB data); + WERROR (*del_value)(struct registry_key *, const char *valname); +}; + +struct registry_hive { + const struct hive_operations *functions; + struct registry_key *root; + void *backend_data; + const char *location; +}; + +/* Handle to a full registry + * contains zero or more hives */ +struct registry_context { + void *backend_data; + WERROR (*get_predefined_key) (struct registry_context *, uint32_t hkey, struct registry_key **); +}; + +struct reg_init_function_entry { + const struct hive_operations *hive_functions; + struct reg_init_function_entry *prev, *next; +}; + +#endif /* _REGISTRY_H */ -- cgit From a487b6c19c28100041ceb2b7a5798c236983509c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 4 Sep 2005 17:26:23 +0000 Subject: r10028: More registry fixes. Remove save_hive() function (there is a flush_key function already). Fixes for the allocation mechanism in the REGF backend (This used to be commit 499d03bc90382bcd33c8c3a1577a58d2c76e5129) --- source4/lib/registry/registry.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index f9e8a7698c..e843e1a0be 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -73,6 +73,9 @@ typedef void (*value_notification_function) (void); * Backends should always do case-insensitive compares * (everything is case-insensitive but case-preserving, * just like the FS) + * + * There is no save function as all operations are expected to + * be atomic. */ struct hive_operations { @@ -80,7 +83,6 @@ struct hive_operations { /* Implement this one */ WERROR (*open_hive) (struct registry_hive *, struct registry_key **); - WERROR (*save_hive) (struct registry_hive *, const char *location); /* Or this one */ WERROR (*open_key) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **); -- cgit From 5d2c2edc19d471cb2b757c53eeb007f4dd7f9348 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 13 Sep 2005 17:28:18 +0000 Subject: r10207: Add some const (This used to be commit b1ad340b4720e922ae1e332c2a74986b1656358b) --- source4/lib/registry/registry.h | 53 ++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index e843e1a0be..69f3606736 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -43,24 +43,26 @@ #define REGISTRY_INTERFACE_VERSION 1 /* structure to store the registry handles */ -struct registry_key { - char *name; /* Name of the key */ - const char *path; /* Full path to the key */ - char *class_name; /* Name of key class */ - NTTIME last_mod; /* Time last modified */ +struct registry_key +{ + char *name; + const char *path; + char *class_name; + NTTIME last_mod; struct registry_hive *hive; void *backend_data; }; -struct registry_value { +struct registry_value +{ char *name; unsigned int data_type; DATA_BLOB data; }; /* FIXME */ -typedef void (*key_notification_function) (void); -typedef void (*value_notification_function) (void); +typedef void (*reg_key_notification_function) (void); +typedef void (*reg_value_notification_function) (void); /* * Container for function pointers to enumeration routines @@ -85,38 +87,39 @@ struct hive_operations { WERROR (*open_hive) (struct registry_hive *, struct registry_key **); /* Or this one */ - WERROR (*open_key) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **); + WERROR (*open_key) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **); - WERROR (*num_subkeys) (struct registry_key *, uint32_t *count); - WERROR (*num_values) (struct registry_key *, uint32_t *count); - WERROR (*get_subkey_by_index) (TALLOC_CTX *, struct registry_key *, int idx, struct registry_key **); + WERROR (*num_subkeys) (const struct registry_key *, uint32_t *count); + WERROR (*num_values) (const struct registry_key *, uint32_t *count); + WERROR (*get_subkey_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_key **); /* Can not contain more then one level */ - WERROR (*get_subkey_by_name) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **); - WERROR (*get_value_by_index) (TALLOC_CTX *, struct registry_key *, int idx, struct registry_value **); + WERROR (*get_subkey_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **); + WERROR (*get_value_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_value **); /* Can not contain more then one level */ - WERROR (*get_value_by_name) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_value **); + WERROR (*get_value_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_value **); /* Security control */ - WERROR (*key_get_sec_desc) (TALLOC_CTX *, struct registry_key *, struct security_descriptor **); - WERROR (*key_set_sec_desc) (struct registry_key *, struct security_descriptor *); + WERROR (*key_get_sec_desc) (TALLOC_CTX *, const struct registry_key *, struct security_descriptor **); + WERROR (*key_set_sec_desc) (const struct registry_key *, const struct security_descriptor *); /* Notification */ - WERROR (*request_key_change_notify) (struct registry_key *, key_notification_function); - WERROR (*request_value_change_notify) (struct registry_value *, value_notification_function); + WERROR (*request_key_change_notify) (const struct registry_key *, reg_key_notification_function); + WERROR (*request_value_change_notify) (const struct registry_value *, reg_value_notification_function); /* Key management */ - WERROR (*add_key)(TALLOC_CTX *, struct registry_key *, const char *name, uint32_t access_mask, struct security_descriptor *, struct registry_key **); - WERROR (*del_key)(struct registry_key *, const char *name); - WERROR (*flush_key) (struct registry_key *); + WERROR (*add_key)(TALLOC_CTX *, const struct registry_key *, const char *name, uint32_t access_mask, struct security_descriptor *, struct registry_key **); + WERROR (*del_key)(const struct registry_key *, const char *name); + WERROR (*flush_key) (const struct registry_key *); /* Value management */ - WERROR (*set_value)(struct registry_key *, const char *name, uint32_t type, DATA_BLOB data); - WERROR (*del_value)(struct registry_key *, const char *valname); + WERROR (*set_value)(const struct registry_key *, const char *name, uint32_t type, const DATA_BLOB data); + WERROR (*del_value)(const struct registry_key *, const char *valname); }; -struct registry_hive { +struct registry_hive +{ const struct hive_operations *functions; struct registry_key *root; void *backend_data; -- cgit From 5e7a0fb5349422cfb782c0348f98505011d27391 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 29 Sep 2005 11:51:06 +0000 Subject: r10604: Put in the new registry "patchfile" code (similar to ldif for LDB); not finished yet. (This used to be commit b405b27ba4bf4ddbaff9ca58926d94d1b2fd09f6) --- source4/lib/registry/registry.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 69f3606736..ebfb2caf5c 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -138,4 +138,27 @@ struct reg_init_function_entry { struct reg_init_function_entry *prev, *next; }; +struct reg_diff_value +{ + char *name; + enum { REG_DIFF_DEL_VAL, REG_DIFF_SET_VAL } changetype; + uint32_t type; + DATA_BLOB data; +}; + +struct reg_diff_key +{ + char *name; + enum { REG_DIFF_CHANGE_KEY, REG_DIFF_DEL_KEY } changetype; + uint32_t numvalues; + struct reg_diff_value *values; +}; + +struct reg_diff +{ + char *format; + uint32_t numkeys; + struct reg_diff_key *keys; +}; + #endif /* _REGISTRY_H */ -- cgit From 7285e102f063122ca8ef1222cc6e9a5cde176b41 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 27 Dec 2005 21:11:09 +0000 Subject: r12523: Convert the registry subsystem to use a seperate prototype header (note that this doesn't use the distinction between private and public prototypes yet) (This used to be commit 60e11f575821c1762b25ad66441b6e69ad1167ef) --- source4/lib/registry/registry.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index ebfb2caf5c..7f57a9244d 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -161,4 +161,6 @@ struct reg_diff struct reg_diff_key *keys; }; +#include "registry_proto.h" + #endif /* _REGISTRY_H */ -- cgit From 35349a58df5b69446607fbd742a05f57f3515319 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 18 Mar 2006 15:42:57 +0000 Subject: r14542: Remove librpc, libndr and libnbt from includes.h (This used to be commit 51b4270513752d2eafbe77f9de598de16ef84a1f) --- source4/lib/registry/registry.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 7f57a9244d..efe22573c2 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -22,6 +22,9 @@ #ifndef _REGISTRY_H /* _REGISTRY_H */ #define _REGISTRY_H +#include "librpc/gen_ndr/security.h" +#include "auth/credentials/credentials.h" + /* Handles for the predefined keys */ #define HKEY_CLASSES_ROOT 0x80000000 #define HKEY_CURRENT_USER 0x80000001 -- cgit From c84cfc0ecc46ef05dc7997a128ba9486516cb112 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 19 Mar 2006 02:23:52 +0000 Subject: r14554: Write out header dependencies. This means all C files affected will be rebuilt when a header file is changed. It also means parallel builds work now. It will take a minute or so to generate all the dependency information, but there should be no need to rebuild that information later on, unless a file changes. This behaviour is only enabled when building in developer mode (--enable-developer) and requires a GNU make (or compatible). In all other cases, the file 'static_deps.mk' is included, which contains some basic hardcoded dependency information. (This used to be commit eb435386f015ce1d89eb6f7e7837622ebd9e1951) --- source4/lib/registry/registry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index efe22573c2..87a23db93d 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -164,6 +164,6 @@ struct reg_diff struct reg_diff_key *keys; }; -#include "registry_proto.h" +#include "lib/registry/registry_proto.h" #endif /* _REGISTRY_H */ -- cgit From d64ccc01769ce274c74d8458f9ef81cdcc8986f6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 21 Mar 2006 01:30:22 +0000 Subject: r14599: Pass ACLs down the registry layer. (This used to be commit 6cdefd8945eee5513a6993350ea71f12d4dbd6fa) --- source4/lib/registry/registry.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 87a23db93d..d6b4e5b08c 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -125,6 +125,8 @@ struct registry_hive { const struct hive_operations *functions; struct registry_key *root; + struct auth_session_info *session_info; + struct cli_credentials *credentials; void *backend_data; const char *location; }; @@ -133,6 +135,8 @@ struct registry_hive * contains zero or more hives */ struct registry_context { void *backend_data; + struct cli_credentials *credentials; + struct auth_session_info *session_info; WERROR (*get_predefined_key) (struct registry_context *, uint32_t hkey, struct registry_key **); }; @@ -164,6 +168,8 @@ struct reg_diff struct reg_diff_key *keys; }; +struct auth_session_info; + #include "lib/registry/registry_proto.h" #endif /* _REGISTRY_H */ -- cgit From 62bdececc6de25d1dfdc5c27b5600180d2c8f446 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 24 Apr 2006 16:16:43 +0000 Subject: r15214: Introduce subsystem-specific CFLAGS to keep the global CFLAGS short. (This used to be commit a495bc60ab1b233fe507b2b1aa0ad7378cf52677) --- source4/lib/registry/registry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index d6b4e5b08c..b556829880 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -36,7 +36,7 @@ #define HKEY_PERFORMANCE_TEXT 0x80000050 #define HKEY_PERFORMANCE_NLSTEXT 0x80000060 -#define REG_DELETE -1 +#define REG_DELETE -1 /* * The general idea here is that every backend provides a 'hive'. Combining -- cgit From 620d759f49f4b648d0fa4a84e67f1cecbbdd0f06 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 27 Apr 2006 19:50:13 +0000 Subject: r15298: Fix the build using a few hacks in the build system. Recursive dependencies are now forbidden (the build system will bail out if there are any). I've split up auth_sam.c into auth_sam.c and sam.c. Andrew, please rename sam.c / move its contents to whatever/wherever you think suits best. (This used to be commit 6646384aaf3e7fa2aa798c3e564b94b0617ec4d0) --- source4/lib/registry/registry.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index b556829880..385b0e7d6f 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -169,6 +169,7 @@ struct reg_diff }; struct auth_session_info; +struct event_context; #include "lib/registry/registry_proto.h" -- cgit From ad1cbc52cccf123c9f97edd4ff30df29e4677499 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 30 Apr 2006 16:09:00 +0000 Subject: r15361: Export table of predefined registry keys (This used to be commit 684ef2dae1145388308502942da15e59a8beb425) --- source4/lib/registry/registry.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 385b0e7d6f..80b412a314 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -36,6 +36,13 @@ #define HKEY_PERFORMANCE_TEXT 0x80000050 #define HKEY_PERFORMANCE_NLSTEXT 0x80000060 +struct reg_predefined_key { + uint32_t handle; + const char *name; +}; + +extern const struct reg_predefined_key reg_predefined_keys[]; + #define REG_DELETE -1 /* @@ -145,6 +152,8 @@ struct reg_init_function_entry { struct reg_init_function_entry *prev, *next; }; +/* Representing differences between registry files */ + struct reg_diff_value { char *name; -- cgit From e3a6c6be79326578a1e9c7cb8547234eab62235f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 8 Jun 2006 15:20:05 +0000 Subject: r16100: Patch from Michael Wood : s/then/than/ for correct grammar (This used to be commit 26a2fa97e4c819e630bc9b50e11c8d5328c7b8c8) --- source4/lib/registry/registry.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 80b412a314..6b3675b0ee 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -103,11 +103,11 @@ struct hive_operations { WERROR (*num_values) (const struct registry_key *, uint32_t *count); WERROR (*get_subkey_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_key **); - /* Can not contain more then one level */ + /* Can not contain more than one level */ WERROR (*get_subkey_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **); WERROR (*get_value_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_value **); - /* Can not contain more then one level */ + /* Can not contain more than one level */ WERROR (*get_value_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_value **); /* Security control */ -- cgit From 1cecad25224a13de3b561ae36b8e530b152c81be Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 22 Aug 2006 18:50:03 +0000 Subject: r17713: fix compiler warnings metze (This used to be commit 21142ad7a2d37489e295d725c8700be0bb921091) --- source4/lib/registry/registry.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 6b3675b0ee..e5cf7d9111 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -55,9 +55,9 @@ extern const struct reg_predefined_key reg_predefined_keys[]; /* structure to store the registry handles */ struct registry_key { - char *name; + const char *name; const char *path; - char *class_name; + const char *class_name; NTTIME last_mod; struct registry_hive *hive; void *backend_data; @@ -65,7 +65,7 @@ struct registry_key struct registry_value { - char *name; + const char *name; unsigned int data_type; DATA_BLOB data; }; @@ -156,7 +156,7 @@ struct reg_init_function_entry { struct reg_diff_value { - char *name; + const char *name; enum { REG_DIFF_DEL_VAL, REG_DIFF_SET_VAL } changetype; uint32_t type; DATA_BLOB data; @@ -164,7 +164,7 @@ struct reg_diff_value struct reg_diff_key { - char *name; + const char *name; enum { REG_DIFF_CHANGE_KEY, REG_DIFF_DEL_KEY } changetype; uint32_t numvalues; struct reg_diff_value *values; @@ -172,7 +172,7 @@ struct reg_diff_key struct reg_diff { - char *format; + const char *format; uint32_t numkeys; struct reg_diff_key *keys; }; -- cgit From 13dbee3ffea6065a826f010e50c9b4eb2c6ad109 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Nov 2006 00:48:36 +0000 Subject: r19598: Ahead of a merge to current lorikeet-heimdal: Break up auth/auth.h not to include the world. Add credentials_krb5.h with the kerberos dependent prototypes. Andrew Bartlett (This used to be commit 2b569c42e0fbb596ea82484d0e1cb22e193037b9) --- source4/lib/registry/registry.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index e5cf7d9111..4c1eb8f39e 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -23,7 +23,6 @@ #define _REGISTRY_H #include "librpc/gen_ndr/security.h" -#include "auth/credentials/credentials.h" /* Handles for the predefined keys */ #define HKEY_CLASSES_ROOT 0x80000000 @@ -128,6 +127,8 @@ struct hive_operations { WERROR (*del_value)(const struct registry_key *, const char *valname); }; +struct cli_credentials; + struct registry_hive { const struct hive_operations *functions; -- cgit From 97416e6b011a3c733d07f83073bf12796c7ecc6b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 12 Feb 2007 12:12:12 +0000 Subject: r21297: Remove the GTK+ tools and library from the main repository. They are now maintained separately in bzr at http://people.samba.org/bzr/jelmer/samba-gtk This also adds some more headers to the list that is installed and a couple of extra #include lines so these headers can be used externally without problems. (This used to be commit 07652f65ce7a5b19130f1a27cbf0e1e5fae13454) --- source4/lib/registry/registry.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 4c1eb8f39e..d67f1c2be8 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -22,6 +22,8 @@ #ifndef _REGISTRY_H /* _REGISTRY_H */ #define _REGISTRY_H +#include "core.h" +#include "talloc.h" #include "librpc/gen_ndr/security.h" /* Handles for the predefined keys */ -- cgit From f851eb8dc662c72242388a01dedbfc0f4ec0dfe1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 12 Feb 2007 13:04:09 +0000 Subject: r21299: Fix the build for those that don't have talloc.h installed. (This used to be commit e782035251fd3d51a7a4221d107519fb1ba70ba7) --- source4/lib/registry/registry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index d67f1c2be8..4bf422d027 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -23,7 +23,7 @@ #define _REGISTRY_H #include "core.h" -#include "talloc.h" +#include "talloc/talloc.h" #include "librpc/gen_ndr/security.h" /* Handles for the predefined keys */ -- cgit From c1c34c4179f887e42088192bacc984def213d451 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 13 Mar 2007 20:08:44 +0000 Subject: r21828: Hardcode prototypes, as they're a public API. (This used to be commit 02ae0b9cde8a18498bc72583d8cac9b0217da4ad) --- source4/lib/registry/registry.h | 49 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 4bf422d027..7475720fcf 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -183,6 +183,53 @@ struct reg_diff struct auth_session_info; struct event_context; -#include "lib/registry/registry_proto.h" +_PUBLIC_ WERROR reg_open_local (TALLOC_CTX *mem_ctx, + struct registry_context **ctx, + struct auth_session_info *session_info, + struct cli_credentials *credentials); + +_PUBLIC_ NTSTATUS registry_register(const void *_hive_ops); +_PUBLIC_ NTSTATUS registry_init(void); +_PUBLIC_ BOOL reg_has_backend(const char *backend); +_PUBLIC_ int reg_list_predefs(TALLOC_CTX *mem_ctx, char ***predefs, uint32_t **hkeys); +_PUBLIC_ const char *reg_get_predef_name(uint32_t hkey); +_PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, const char *name, struct registry_key **key); +_PUBLIC_ WERROR reg_get_predefined_key(struct registry_context *ctx, uint32_t hkey, struct registry_key **key); +_PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *backend, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, struct registry_key **root); +_PUBLIC_ WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, struct registry_key **result); +_PUBLIC_ WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, struct registry_value **val); +_PUBLIC_ WERROR reg_key_num_subkeys(const struct registry_key *key, uint32_t *count); +_PUBLIC_ WERROR reg_key_num_values(const struct registry_key *key, uint32_t *count); +_PUBLIC_ WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, struct registry_key **subkey); +WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, struct registry_key **subkey); +_PUBLIC_ WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, struct registry_value **val); +_PUBLIC_ WERROR reg_key_del(struct registry_key *parent, const char *name); +_PUBLIC_ WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, const struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *desc, struct registry_key **newkey); +_PUBLIC_ WERROR reg_val_set(struct registry_key *key, const char *value, uint32_t type, DATA_BLOB data); +_PUBLIC_ WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, struct security_descriptor **secdesc); +_PUBLIC_ WERROR reg_del_value(const struct registry_key *key, const char *valname); +_PUBLIC_ WERROR reg_key_flush(const struct registry_key *key); +_PUBLIC_ WERROR reg_key_subkeysizes(const struct registry_key *key, uint32_t *max_subkeylen, uint32_t *max_subkeysize); +_PUBLIC_ WERROR reg_key_valuesizes(const struct registry_key *key, uint32_t *max_valnamelen, uint32_t *max_valbufsize); + +/* Utility functions */ + +_PUBLIC_ const char *str_regtype(int type); +_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, DATA_BLOB *data); +_PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx, struct registry_value *val) ; +_PUBLIC_ BOOL reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); +char *reg_path_win2unix(char *path) ; +char *reg_path_unix2win(char *path) ; +WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, const char *name, struct registry_key **result); +WERROR reg_key_del_abs(struct registry_context *ctx, const char *path); +WERROR reg_key_add_abs(TALLOC_CTX *mem_ctx, struct registry_context *ctx, const char *path, uint32_t access_mask, struct security_descriptor *sec_desc, struct registry_key **result); + + +/* Patch files */ + +_PUBLIC_ struct reg_diff *reg_generate_diff(TALLOC_CTX *mem_ctx, struct registry_context *ctx1, struct registry_context *ctx2); +_PUBLIC_ WERROR reg_diff_save(const struct reg_diff *diff, const char *filename); +_PUBLIC_ struct reg_diff *reg_diff_load(TALLOC_CTX *ctx, const char *fn); +_PUBLIC_ BOOL reg_diff_apply (const struct reg_diff *diff, struct registry_context *ctx); #endif /* _REGISTRY_H */ -- cgit From 606c0fec4315bf10eb50b8ab656204b086446e3d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 13 Mar 2007 20:44:14 +0000 Subject: r21830: Fix header installation, remove proto header with a single prototype. (This used to be commit 47a17a741af625eb52f611b3d0f3ea0e207f2c3a) --- source4/lib/registry/registry.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 7475720fcf..509e66b5fd 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -188,6 +188,11 @@ _PUBLIC_ WERROR reg_open_local (TALLOC_CTX *mem_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); +_PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, + struct auth_session_info *session_info, + struct cli_credentials *credentials, + const char *location, struct event_context *ev); + _PUBLIC_ NTSTATUS registry_register(const void *_hive_ops); _PUBLIC_ NTSTATUS registry_init(void); _PUBLIC_ BOOL reg_has_backend(const char *backend); @@ -232,4 +237,6 @@ _PUBLIC_ WERROR reg_diff_save(const struct reg_diff *diff, const char *filename) _PUBLIC_ struct reg_diff *reg_diff_load(TALLOC_CTX *ctx, const char *fn); _PUBLIC_ BOOL reg_diff_apply (const struct reg_diff *diff, struct registry_context *ctx); +NTSTATUS registry_rpc_init(void); + #endif /* _REGISTRY_H */ -- cgit From 00d74b84e902e4d9ef4874637822d1ae5697275f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 14 Mar 2007 00:44:29 +0000 Subject: r21837: Make dcerpc_mgmt a separate library again, as the linker leaves it out when it's part of dcerpc. (This used to be commit dc4428553ec2749ef1ba24fbffeaabf0af6bf364) --- source4/lib/registry/registry.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 509e66b5fd..29aa226539 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -183,6 +183,10 @@ struct reg_diff struct auth_session_info; struct event_context; +#ifndef _PUBLIC_ +#define _PUBLIC_ +#endif + _PUBLIC_ WERROR reg_open_local (TALLOC_CTX *mem_ctx, struct registry_context **ctx, struct auth_session_info *session_info, -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/lib/registry/registry.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 29aa226539..09d61c6b4f 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.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, @@ -15,8 +15,7 @@ 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. + along with this program. If not, see . */ #ifndef _REGISTRY_H /* _REGISTRY_H */ -- cgit From b409d4120f9ae451f93a2322267c0f346531d9f3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Aug 2007 15:16:40 +0000 Subject: r24667: Finally merge the registry improvements that Wilco Baan Hofman and I have been working on for at least half a year now. Contains the following improvements: * proper layering (finally!) for the registry library. Distinction is now made between 'real' backends (local, remote, wine, etc) and the low-level hive backends (regf, creg, ldb, ...) that are only used by the local registry backend * tests for all important hive and registry operations * re-enable RPC-WINREG tests (still needs more work though, as some return values aren't checked yet) * write support for REGF files * dir backend now supports setting/reading values, creating keys * support for storing security descriptors * remove CREG backend as it was incomplete, didn't match the data model and wasn't used at all anyway * support for parsing ADM files as used by the policy editor (see lib/policy) * support for parsing PREG files (format used by .POL files) * new streaming interface for registry diffs (improves speed and memory usage for regdiff/regpatch significantly) ... and fixes a large number of bugs in the registry code (This used to be commit 7a1eec6358bc863dfc671c542b7185d3e39d7b5a) --- source4/lib/registry/registry.h | 309 ++++++++++++++++++++++------------------ 1 file changed, 171 insertions(+), 138 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 09d61c6b4f..acfe056616 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -2,7 +2,7 @@ Unix SMB/CIFS implementation. Registry interface Copyright (C) Gerald Carter 2002. - Copyright (C) Jelmer Vernooij 2003-2004. + 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 @@ -21,9 +21,12 @@ #ifndef _REGISTRY_H /* _REGISTRY_H */ #define _REGISTRY_H +struct registry_context; + #include "core.h" #include "talloc/talloc.h" #include "librpc/gen_ndr/security.h" +#include "lib/registry/hive.h" /* Handles for the predefined keys */ #define HKEY_CLASSES_ROOT 0x80000000 @@ -36,6 +39,9 @@ #define HKEY_PERFORMANCE_TEXT 0x80000050 #define HKEY_PERFORMANCE_NLSTEXT 0x80000060 +#define HKEY_FIRST HKEY_CLASSES_ROOT +#define HKEY_LAST HKEY_PERFORMANCE_NLSTEXT + struct reg_predefined_key { uint32_t handle; const char *name; @@ -52,17 +58,16 @@ extern const struct reg_predefined_key reg_predefined_keys[]; #define REGISTRY_INTERFACE_VERSION 1 +struct reg_key_operations; + /* structure to store the registry handles */ struct registry_key { - const char *name; - const char *path; - const char *class_name; - NTTIME last_mod; - struct registry_hive *hive; - void *backend_data; + struct registry_context *context; }; +#include "lib/registry/patchfile.h" + struct registry_value { const char *name; @@ -74,109 +79,87 @@ struct registry_value typedef void (*reg_key_notification_function) (void); typedef void (*reg_value_notification_function) (void); -/* - * Container for function pointers to enumeration routines - * for virtual registry view - * - * Backends can provide : - * - just one hive (example: nt4, w95) - * - several hives (example: rpc). - * - * Backends should always do case-insensitive compares - * (everything is case-insensitive but case-preserving, - * just like the FS) - * - * There is no save function as all operations are expected to - * be atomic. - */ - -struct hive_operations { - const char *name; - - /* Implement this one */ - WERROR (*open_hive) (struct registry_hive *, struct registry_key **); - - /* Or this one */ - WERROR (*open_key) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **); - - WERROR (*num_subkeys) (const struct registry_key *, uint32_t *count); - WERROR (*num_values) (const struct registry_key *, uint32_t *count); - WERROR (*get_subkey_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_key **); - - /* Can not contain more than one level */ - WERROR (*get_subkey_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **); - WERROR (*get_value_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_value **); - - /* Can not contain more than one level */ - WERROR (*get_value_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_value **); - - /* Security control */ - WERROR (*key_get_sec_desc) (TALLOC_CTX *, const struct registry_key *, struct security_descriptor **); - WERROR (*key_set_sec_desc) (const struct registry_key *, const struct security_descriptor *); - - /* Notification */ - WERROR (*request_key_change_notify) (const struct registry_key *, reg_key_notification_function); - WERROR (*request_value_change_notify) (const struct registry_value *, reg_value_notification_function); - - /* Key management */ - WERROR (*add_key)(TALLOC_CTX *, const struct registry_key *, const char *name, uint32_t access_mask, struct security_descriptor *, struct registry_key **); - WERROR (*del_key)(const struct registry_key *, const char *name); - WERROR (*flush_key) (const struct registry_key *); - - /* Value management */ - WERROR (*set_value)(const struct registry_key *, const char *name, uint32_t type, const DATA_BLOB data); - WERROR (*del_value)(const struct registry_key *, const char *valname); -}; - struct cli_credentials; +struct registry_context; -struct registry_hive -{ - const struct hive_operations *functions; - struct registry_key *root; - struct auth_session_info *session_info; - struct cli_credentials *credentials; - void *backend_data; - const char *location; -}; - -/* Handle to a full registry - * contains zero or more hives */ -struct registry_context { - void *backend_data; - struct cli_credentials *credentials; - struct auth_session_info *session_info; - WERROR (*get_predefined_key) (struct registry_context *, uint32_t hkey, struct registry_key **); -}; - -struct reg_init_function_entry { - const struct hive_operations *hive_functions; - struct reg_init_function_entry *prev, *next; -}; - -/* Representing differences between registry files */ - -struct reg_diff_value -{ +struct registry_operations { const char *name; - enum { REG_DIFF_DEL_VAL, REG_DIFF_SET_VAL } changetype; - uint32_t type; - DATA_BLOB data; -}; -struct reg_diff_key -{ - const char *name; - enum { REG_DIFF_CHANGE_KEY, REG_DIFF_DEL_KEY } changetype; - uint32_t numvalues; - struct reg_diff_value *values; -}; - -struct reg_diff -{ - const char *format; - uint32_t numkeys; - struct reg_diff_key *keys; + WERROR (*get_key_info) (TALLOC_CTX *mem_ctx, + const struct registry_key *key, + const char **classname, + uint32_t *numsubkeys, + uint32_t *numvalues, + NTTIME *last_change_time); + + WERROR (*flush_key) (struct registry_key *key); + + WERROR (*get_predefined_key) (const struct registry_context *ctx, + uint32_t key_id, + struct registry_key **key); + + WERROR (*open_key) (TALLOC_CTX *mem_ctx, + struct registry_key *parent, + const char *path, + struct registry_key **key); + + WERROR (*create_key) (TALLOC_CTX *mem_ctx, + struct registry_key *parent, + const char *name, + const char *key_class, + struct security_descriptor *security, + struct registry_key **key); + + WERROR (*delete_key) (struct registry_key *key, const char *name); + + WERROR (*delete_value) (struct registry_key *key, const char *name); + + WERROR (*enum_key) (TALLOC_CTX *mem_ctx, + const struct registry_key *key, uint32_t idx, + const char **name, + const char **keyclass, + NTTIME *last_changed_time); + + WERROR (*enum_value) (TALLOC_CTX *mem_ctx, + const struct registry_key *key, uint32_t idx, + const char **name, + uint32_t *type, + DATA_BLOB *data); + + WERROR (*get_security) (TALLOC_CTX *mem_ctx, + const struct registry_key *key, + struct security_descriptor **security); + + WERROR (*set_security) (struct registry_key *key, + const struct security_descriptor *security); + + WERROR (*load_key) (struct registry_key *key, + const char *key_name, + const char *path); + + WERROR (*unload_key) (struct registry_key *key, const char *name); + + WERROR (*notify_value_change) (struct registry_key *key, + reg_value_notification_function fn); + + WERROR (*get_value) (TALLOC_CTX *mem_ctx, + const struct registry_key *key, + const char *name, + uint32_t *type, + DATA_BLOB *data); + + WERROR (*set_value) (struct registry_key *key, + const char *name, + uint32_t type, + const DATA_BLOB data); +}; + +/** + * Handle to a full registry + * contains zero or more hives + */ +struct registry_context { + const struct registry_operations *ops; }; struct auth_session_info; @@ -186,60 +169,110 @@ struct event_context; #define _PUBLIC_ #endif +/** + * Open the locally defined registry. + */ _PUBLIC_ WERROR reg_open_local (TALLOC_CTX *mem_ctx, struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); +_PUBLIC_ WERROR reg_open_samba (TALLOC_CTX *mem_ctx, + struct registry_context **ctx, + struct auth_session_info *session_info, + struct cli_credentials *credentials); + +/** + * Open the registry on a remote machine. + */ _PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials, const char *location, struct event_context *ev); -_PUBLIC_ NTSTATUS registry_register(const void *_hive_ops); -_PUBLIC_ NTSTATUS registry_init(void); -_PUBLIC_ BOOL reg_has_backend(const char *backend); -_PUBLIC_ int reg_list_predefs(TALLOC_CTX *mem_ctx, char ***predefs, uint32_t **hkeys); +_PUBLIC_ WERROR reg_open_wine(struct registry_context **ctx, const char *path); + _PUBLIC_ const char *reg_get_predef_name(uint32_t hkey); -_PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, const char *name, struct registry_key **key); -_PUBLIC_ WERROR reg_get_predefined_key(struct registry_context *ctx, uint32_t hkey, struct registry_key **key); -_PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *backend, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, struct registry_key **root); -_PUBLIC_ WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, struct registry_key **result); -_PUBLIC_ WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, struct registry_value **val); -_PUBLIC_ WERROR reg_key_num_subkeys(const struct registry_key *key, uint32_t *count); -_PUBLIC_ WERROR reg_key_num_values(const struct registry_key *key, uint32_t *count); -_PUBLIC_ WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, struct registry_key **subkey); -WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, struct registry_key **subkey); -_PUBLIC_ WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, struct registry_value **val); +_PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, + const char *name, + struct registry_key **key); +_PUBLIC_ WERROR reg_get_predefined_key(const struct registry_context *ctx, + uint32_t hkey, + struct registry_key **key); + +_PUBLIC_ WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, + const char *name, struct registry_key **result); + +_PUBLIC_ WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, + const struct registry_key *key, uint32_t idx, + const char **name, + uint32_t *type, + DATA_BLOB *data); +_PUBLIC_ WERROR reg_key_get_info(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + const char **class_name, + uint32_t *num_subkeys, + uint32_t *num_values, + NTTIME *last_change_time); +_PUBLIC_ WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + int idx, + const char **name, + const char **classname, + NTTIME *last_mod_time); +WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + const char *name, + struct registry_key **subkey); +_PUBLIC_ WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + const char *name, + uint32_t *type, + DATA_BLOB *data); _PUBLIC_ WERROR reg_key_del(struct registry_key *parent, const char *name); -_PUBLIC_ WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, const struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *desc, struct registry_key **newkey); -_PUBLIC_ WERROR reg_val_set(struct registry_key *key, const char *value, uint32_t type, DATA_BLOB data); +_PUBLIC_ WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, + struct registry_key *parent, const char *name, + const char *classname, + struct security_descriptor *desc, + struct registry_key **newkey); +_PUBLIC_ WERROR reg_val_set(struct registry_key *key, const char *value, + uint32_t type, DATA_BLOB data); _PUBLIC_ WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, struct security_descriptor **secdesc); -_PUBLIC_ WERROR reg_del_value(const struct registry_key *key, const char *valname); -_PUBLIC_ WERROR reg_key_flush(const struct registry_key *key); -_PUBLIC_ WERROR reg_key_subkeysizes(const struct registry_key *key, uint32_t *max_subkeylen, uint32_t *max_subkeysize); -_PUBLIC_ WERROR reg_key_valuesizes(const struct registry_key *key, uint32_t *max_valnamelen, uint32_t *max_valbufsize); +_PUBLIC_ WERROR reg_del_value(struct registry_key *key, const char *valname); +_PUBLIC_ WERROR reg_key_flush(struct registry_key *key); +WERROR reg_create_key (TALLOC_CTX *mem_ctx, + struct registry_key *parent, -/* Utility functions */ + const char *name, + const char *key_class, + struct security_descriptor *security, + struct registry_key **key); + + + +/* Utility functions */ _PUBLIC_ const char *str_regtype(int type); -_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, DATA_BLOB *data); -_PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx, struct registry_value *val) ; +_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, + const DATA_BLOB data); +_PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, + uint32_t type, const DATA_BLOB data); _PUBLIC_ BOOL reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); -char *reg_path_win2unix(char *path) ; -char *reg_path_unix2win(char *path) ; WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, const char *name, struct registry_key **result); WERROR reg_key_del_abs(struct registry_context *ctx, const char *path); WERROR reg_key_add_abs(TALLOC_CTX *mem_ctx, struct registry_context *ctx, const char *path, uint32_t access_mask, struct security_descriptor *sec_desc, struct registry_key **result); +WERROR reg_load_key(struct registry_context *ctx, struct registry_key *key, + const char *name, const char *filename); +WERROR reg_mount_hive(struct registry_context *rctx, + struct hive_key *hive_key, + uint32_t key_id, + const char **elements); -/* Patch files */ - -_PUBLIC_ struct reg_diff *reg_generate_diff(TALLOC_CTX *mem_ctx, struct registry_context *ctx1, struct registry_context *ctx2); -_PUBLIC_ WERROR reg_diff_save(const struct reg_diff *diff, const char *filename); -_PUBLIC_ struct reg_diff *reg_diff_load(TALLOC_CTX *ctx, const char *fn); -_PUBLIC_ BOOL reg_diff_apply (const struct reg_diff *diff, struct registry_context *ctx); +struct registry_key *reg_import_hive_key(struct registry_context *ctx, + struct hive_key *hive, + uint32_t predef_key, + const char **elements); -NTSTATUS registry_rpc_init(void); #endif /* _REGISTRY_H */ -- cgit From 61ffa08f4c95e29d301de9fbabd6e71c2dbc1056 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 27 Aug 2007 18:10:19 +0000 Subject: r24712: No longer expose the 'BOOL' data type in any interfaces. (This used to be commit 1ce32673d960c8b05b6c1b1b99e1976a402417ae) --- source4/lib/registry/registry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index acfe056616..ded5e4cc48 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -257,7 +257,7 @@ _PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, const DATA_BLOB data); _PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, uint32_t type, const DATA_BLOB data); -_PUBLIC_ BOOL reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); +_PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, const char *name, struct registry_key **result); WERROR reg_key_del_abs(struct registry_context *ctx, const char *path); WERROR reg_key_add_abs(TALLOC_CTX *mem_ctx, struct registry_context *ctx, const char *path, uint32_t access_mask, struct security_descriptor *sec_desc, struct registry_key **result); -- cgit From fb6adecf06d2a9ebd252cde2dde490e7b538bb0a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 27 Aug 2007 21:17:29 +0000 Subject: r24723: Install the right headers for use by samba-gtk. (This used to be commit 762e893d9ce4cc73bb1763a9520634bf921c0503) --- source4/lib/registry/registry.h | 48 +++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index ded5e4cc48..9839786e01 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -165,19 +165,15 @@ struct registry_context { struct auth_session_info; struct event_context; -#ifndef _PUBLIC_ -#define _PUBLIC_ -#endif - /** * Open the locally defined registry. */ -_PUBLIC_ WERROR reg_open_local (TALLOC_CTX *mem_ctx, +WERROR reg_open_local (TALLOC_CTX *mem_ctx, struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); -_PUBLIC_ WERROR reg_open_samba (TALLOC_CTX *mem_ctx, +WERROR reg_open_samba (TALLOC_CTX *mem_ctx, struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); @@ -185,36 +181,36 @@ _PUBLIC_ WERROR reg_open_samba (TALLOC_CTX *mem_ctx, /** * Open the registry on a remote machine. */ -_PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, +WERROR reg_open_remote(struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials, const char *location, struct event_context *ev); -_PUBLIC_ WERROR reg_open_wine(struct registry_context **ctx, const char *path); +WERROR reg_open_wine(struct registry_context **ctx, const char *path); -_PUBLIC_ const char *reg_get_predef_name(uint32_t hkey); -_PUBLIC_ WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, +const char *reg_get_predef_name(uint32_t hkey); +WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, const char *name, struct registry_key **key); -_PUBLIC_ WERROR reg_get_predefined_key(const struct registry_context *ctx, +WERROR reg_get_predefined_key(const struct registry_context *ctx, uint32_t hkey, struct registry_key **key); -_PUBLIC_ WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, +WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, struct registry_key **result); -_PUBLIC_ WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, +WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, uint32_t idx, const char **name, uint32_t *type, DATA_BLOB *data); -_PUBLIC_ WERROR reg_key_get_info(TALLOC_CTX *mem_ctx, +WERROR reg_key_get_info(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char **class_name, uint32_t *num_subkeys, uint32_t *num_values, NTTIME *last_change_time); -_PUBLIC_ WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, +WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, const char **name, @@ -224,22 +220,22 @@ WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, struct registry_key **subkey); -_PUBLIC_ WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, +WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, uint32_t *type, DATA_BLOB *data); -_PUBLIC_ WERROR reg_key_del(struct registry_key *parent, const char *name); -_PUBLIC_ WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, +WERROR reg_key_del(struct registry_key *parent, const char *name); +WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, const char *classname, struct security_descriptor *desc, struct registry_key **newkey); -_PUBLIC_ WERROR reg_val_set(struct registry_key *key, const char *value, +WERROR reg_val_set(struct registry_key *key, const char *value, uint32_t type, DATA_BLOB data); -_PUBLIC_ WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, struct security_descriptor **secdesc); -_PUBLIC_ WERROR reg_del_value(struct registry_key *key, const char *valname); -_PUBLIC_ WERROR reg_key_flush(struct registry_key *key); +WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, struct security_descriptor **secdesc); +WERROR reg_del_value(struct registry_key *key, const char *valname); +WERROR reg_key_flush(struct registry_key *key); WERROR reg_create_key (TALLOC_CTX *mem_ctx, struct registry_key *parent, @@ -252,12 +248,12 @@ WERROR reg_create_key (TALLOC_CTX *mem_ctx, /* Utility functions */ -_PUBLIC_ const char *str_regtype(int type); -_PUBLIC_ char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, +const char *str_regtype(int type); +char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, const DATA_BLOB data); -_PUBLIC_ char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, +char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, uint32_t type, const DATA_BLOB data); -_PUBLIC_ bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); +bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, const char *name, struct registry_key **result); WERROR reg_key_del_abs(struct registry_context *ctx, const char *path); WERROR reg_key_add_abs(TALLOC_CTX *mem_ctx, struct registry_context *ctx, const char *path, uint32_t access_mask, struct security_descriptor *sec_desc, struct registry_key **result); -- cgit From 5d518417f8dc64ce9bbfedc3ddb988d69961bde4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 27 Aug 2007 22:01:58 +0000 Subject: r24726: Add tests for getting/setting security descriptors (still failing at the moment) (This used to be commit ecdfaf56c09e75dc3ca37a3599c89661ad3485ff) --- source4/lib/registry/registry.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 9839786e01..616bbb82dc 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -269,6 +269,12 @@ struct registry_key *reg_import_hive_key(struct registry_context *ctx, struct hive_key *hive, uint32_t predef_key, const char **elements); +WERROR reg_get_security(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + struct security_descriptor **security); + +WERROR reg_set_security(struct registry_key *key, + struct security_descriptor *security); #endif /* _REGISTRY_H */ -- cgit From 82037a75eae9deaf6ec80b5ecc3bb89aab6e6dd8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 30 Aug 2007 23:15:12 +0000 Subject: r24814: Fix headers, trim core.h even more. (This used to be commit 9647f860bdd5c0a74583e886182bd041a45e7655) --- source4/lib/registry/registry.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 616bbb82dc..1d92a9edab 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -23,8 +23,7 @@ struct registry_context; -#include "core.h" -#include "talloc/talloc.h" +#include #include "librpc/gen_ndr/security.h" #include "lib/registry/hive.h" -- cgit From ffbb7e40604b9cffeb0c226279b929497b03a964 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 16 Sep 2007 19:14:46 +0000 Subject: r25193: Update headers to easy use by external apps. (This used to be commit 20b70fbb7af6b6759c3b8c8aa56e10944b32bfdf) --- source4/lib/registry/registry.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 1d92a9edab..90dd094eb9 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -26,6 +26,7 @@ struct registry_context; #include #include "librpc/gen_ndr/security.h" #include "lib/registry/hive.h" +#include "libcli/util/nt_status.h" /* Handles for the predefined keys */ #define HKEY_CLASSES_ROOT 0x80000000 -- cgit From 9b009c900987517359485799be8be4167494b376 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 23 Sep 2007 21:35:03 +0000 Subject: r25301: Merge my includes.h cleanups. (This used to be commit 37425495f392a2d0122a93aa2c42758eab7dab5a) --- source4/lib/registry/registry.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 90dd094eb9..6dec84ad89 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -26,7 +26,7 @@ struct registry_context; #include #include "librpc/gen_ndr/security.h" #include "lib/registry/hive.h" -#include "libcli/util/nt_status.h" +#include "libcli/util/ntstatus.h" /* Handles for the predefined keys */ #define HKEY_CLASSES_ROOT 0x80000000 -- cgit From cc8f4eb3cd9b3bc4e3f3d61bfad240147e8a4e5e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Sat, 6 Oct 2007 00:17:44 +0000 Subject: r25544: Cleanup some more indents in lib/registry. Guenther (This used to be commit 0d9826dc54057db2cfebcb806e5442c4dcf60daa) --- source4/lib/registry/registry.h | 291 ++++++++++++++++++++-------------------- 1 file changed, 148 insertions(+), 143 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 6dec84ad89..c1159dde2e 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -1,25 +1,25 @@ -/* +/* Unix SMB/CIFS implementation. Registry interface Copyright (C) Gerald Carter 2002. 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, see . */ #ifndef _REGISTRY_H /* _REGISTRY_H */ -#define _REGISTRY_H +#define _REGISTRY_H struct registry_context; @@ -29,15 +29,15 @@ struct registry_context; #include "libcli/util/ntstatus.h" /* Handles for the predefined keys */ -#define HKEY_CLASSES_ROOT 0x80000000 -#define HKEY_CURRENT_USER 0x80000001 -#define HKEY_LOCAL_MACHINE 0x80000002 -#define HKEY_USERS 0x80000003 -#define HKEY_PERFORMANCE_DATA 0x80000004 -#define HKEY_CURRENT_CONFIG 0x80000005 -#define HKEY_DYN_DATA 0x80000006 -#define HKEY_PERFORMANCE_TEXT 0x80000050 -#define HKEY_PERFORMANCE_NLSTEXT 0x80000060 +#define HKEY_CLASSES_ROOT 0x80000000 +#define HKEY_CURRENT_USER 0x80000001 +#define HKEY_LOCAL_MACHINE 0x80000002 +#define HKEY_USERS 0x80000003 +#define HKEY_PERFORMANCE_DATA 0x80000004 +#define HKEY_CURRENT_CONFIG 0x80000005 +#define HKEY_DYN_DATA 0x80000006 +#define HKEY_PERFORMANCE_TEXT 0x80000050 +#define HKEY_PERFORMANCE_NLSTEXT 0x80000060 #define HKEY_FIRST HKEY_CLASSES_ROOT #define HKEY_LAST HKEY_PERFORMANCE_NLSTEXT @@ -61,18 +61,18 @@ extern const struct reg_predefined_key reg_predefined_keys[]; struct reg_key_operations; /* structure to store the registry handles */ -struct registry_key +struct registry_key { struct registry_context *context; }; #include "lib/registry/patchfile.h" -struct registry_value +struct registry_value { - const char *name; - unsigned int data_type; - DATA_BLOB data; + const char *name; + unsigned int data_type; + DATA_BLOB data; }; /* FIXME */ @@ -86,77 +86,77 @@ struct registry_operations { const char *name; WERROR (*get_key_info) (TALLOC_CTX *mem_ctx, - const struct registry_key *key, - const char **classname, - uint32_t *numsubkeys, - uint32_t *numvalues, - NTTIME *last_change_time); + const struct registry_key *key, + const char **classname, + uint32_t *numsubkeys, + uint32_t *numvalues, + NTTIME *last_change_time); WERROR (*flush_key) (struct registry_key *key); - WERROR (*get_predefined_key) (const struct registry_context *ctx, - uint32_t key_id, - struct registry_key **key); + WERROR (*get_predefined_key) (const struct registry_context *ctx, + uint32_t key_id, + struct registry_key **key); WERROR (*open_key) (TALLOC_CTX *mem_ctx, - struct registry_key *parent, - const char *path, - struct registry_key **key); + struct registry_key *parent, + const char *path, + struct registry_key **key); - WERROR (*create_key) (TALLOC_CTX *mem_ctx, - struct registry_key *parent, - const char *name, - const char *key_class, - struct security_descriptor *security, - struct registry_key **key); + WERROR (*create_key) (TALLOC_CTX *mem_ctx, + struct registry_key *parent, + const char *name, + const char *key_class, + struct security_descriptor *security, + struct registry_key **key); WERROR (*delete_key) (struct registry_key *key, const char *name); WERROR (*delete_value) (struct registry_key *key, const char *name); WERROR (*enum_key) (TALLOC_CTX *mem_ctx, - const struct registry_key *key, uint32_t idx, - const char **name, - const char **keyclass, - NTTIME *last_changed_time); + const struct registry_key *key, uint32_t idx, + const char **name, + const char **keyclass, + NTTIME *last_changed_time); WERROR (*enum_value) (TALLOC_CTX *mem_ctx, - const struct registry_key *key, uint32_t idx, - const char **name, - uint32_t *type, - DATA_BLOB *data); + const struct registry_key *key, uint32_t idx, + const char **name, + uint32_t *type, + DATA_BLOB *data); WERROR (*get_security) (TALLOC_CTX *mem_ctx, - const struct registry_key *key, - struct security_descriptor **security); + const struct registry_key *key, + struct security_descriptor **security); WERROR (*set_security) (struct registry_key *key, - const struct security_descriptor *security); + const struct security_descriptor *security); WERROR (*load_key) (struct registry_key *key, - const char *key_name, - const char *path); + const char *key_name, + const char *path); WERROR (*unload_key) (struct registry_key *key, const char *name); WERROR (*notify_value_change) (struct registry_key *key, - reg_value_notification_function fn); + reg_value_notification_function fn); WERROR (*get_value) (TALLOC_CTX *mem_ctx, - const struct registry_key *key, - const char *name, - uint32_t *type, - DATA_BLOB *data); + const struct registry_key *key, + const char *name, + uint32_t *type, + DATA_BLOB *data); WERROR (*set_value) (struct registry_key *key, - const char *name, - uint32_t type, - const DATA_BLOB data); -}; + const char *name, + uint32_t type, + const DATA_BLOB data); +}; /** * Handle to a full registry - * contains zero or more hives + * contains zero or more hives */ struct registry_context { const struct registry_operations *ops; @@ -168,113 +168,118 @@ struct event_context; /** * Open the locally defined registry. */ -WERROR reg_open_local (TALLOC_CTX *mem_ctx, - struct registry_context **ctx, - struct auth_session_info *session_info, - struct cli_credentials *credentials); +WERROR reg_open_local(TALLOC_CTX *mem_ctx, + struct registry_context **ctx, + struct auth_session_info *session_info, + struct cli_credentials *credentials); -WERROR reg_open_samba (TALLOC_CTX *mem_ctx, - struct registry_context **ctx, - struct auth_session_info *session_info, - struct cli_credentials *credentials); +WERROR reg_open_samba(TALLOC_CTX *mem_ctx, + struct registry_context **ctx, + struct auth_session_info *session_info, + struct cli_credentials *credentials); /** * Open the registry on a remote machine. */ -WERROR reg_open_remote(struct registry_context **ctx, - struct auth_session_info *session_info, - struct cli_credentials *credentials, - const char *location, struct event_context *ev); +WERROR reg_open_remote(struct registry_context **ctx, + struct auth_session_info *session_info, + struct cli_credentials *credentials, + const char *location, struct event_context *ev); WERROR reg_open_wine(struct registry_context **ctx, const char *path); const char *reg_get_predef_name(uint32_t hkey); -WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, - const char *name, - struct registry_key **key); -WERROR reg_get_predefined_key(const struct registry_context *ctx, - uint32_t hkey, - struct registry_key **key); - -WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, - const char *name, struct registry_key **result); - -WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, - const struct registry_key *key, uint32_t idx, - const char **name, - uint32_t *type, - DATA_BLOB *data); +WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, + const char *name, + struct registry_key **key); +WERROR reg_get_predefined_key(const struct registry_context *ctx, + uint32_t hkey, + struct registry_key **key); + +WERROR reg_open_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, + const char *name, struct registry_key **result); + +WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, + const struct registry_key *key, uint32_t idx, + const char **name, + uint32_t *type, + DATA_BLOB *data); WERROR reg_key_get_info(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - const char **class_name, - uint32_t *num_subkeys, - uint32_t *num_values, - NTTIME *last_change_time); -WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - int idx, - const char **name, - const char **classname, - NTTIME *last_mod_time); -WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - const char *name, - struct registry_key **subkey); -WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - const char *name, - uint32_t *type, - DATA_BLOB *data); + const struct registry_key *key, + const char **class_name, + uint32_t *num_subkeys, + uint32_t *num_values, + NTTIME *last_change_time); +WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + int idx, + const char **name, + const char **classname, + NTTIME *last_mod_time); +WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + const char *name, + struct registry_key **subkey); +WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + const char *name, + uint32_t *type, + DATA_BLOB *data); WERROR reg_key_del(struct registry_key *parent, const char *name); -WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, - struct registry_key *parent, const char *name, - const char *classname, - struct security_descriptor *desc, - struct registry_key **newkey); -WERROR reg_val_set(struct registry_key *key, const char *value, - uint32_t type, DATA_BLOB data); -WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, struct security_descriptor **secdesc); +WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, + struct registry_key *parent, const char *name, + const char *classname, + struct security_descriptor *desc, + struct registry_key **newkey); +WERROR reg_val_set(struct registry_key *key, const char *value, + uint32_t type, DATA_BLOB data); +WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, + struct security_descriptor **secdesc); WERROR reg_del_value(struct registry_key *key, const char *valname); WERROR reg_key_flush(struct registry_key *key); -WERROR reg_create_key (TALLOC_CTX *mem_ctx, - struct registry_key *parent, - - const char *name, - const char *key_class, - struct security_descriptor *security, - struct registry_key **key); +WERROR reg_create_key(TALLOC_CTX *mem_ctx, + struct registry_key *parent, + const char *name, + const char *key_class, + struct security_descriptor *security, + struct registry_key **key); /* Utility functions */ const char *str_regtype(int type); -char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, - const DATA_BLOB data); +char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, + const DATA_BLOB data); char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, - uint32_t type, const DATA_BLOB data); -bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); -WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, const char *name, struct registry_key **result); + uint32_t type, const DATA_BLOB data); +bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, + const char *data_str, uint32_t *type, DATA_BLOB *data); +WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, + const char *name, struct registry_key **result); WERROR reg_key_del_abs(struct registry_context *ctx, const char *path); -WERROR reg_key_add_abs(TALLOC_CTX *mem_ctx, struct registry_context *ctx, const char *path, uint32_t access_mask, struct security_descriptor *sec_desc, struct registry_key **result); -WERROR reg_load_key(struct registry_context *ctx, struct registry_key *key, - const char *name, const char *filename); - -WERROR reg_mount_hive(struct registry_context *rctx, - struct hive_key *hive_key, - uint32_t key_id, - const char **elements); +WERROR reg_key_add_abs(TALLOC_CTX *mem_ctx, struct registry_context *ctx, + const char *path, uint32_t access_mask, + struct security_descriptor *sec_desc, + struct registry_key **result); +WERROR reg_load_key(struct registry_context *ctx, struct registry_key *key, + const char *name, const char *filename); + +WERROR reg_mount_hive(struct registry_context *rctx, + struct hive_key *hive_key, + uint32_t key_id, + const char **elements); struct registry_key *reg_import_hive_key(struct registry_context *ctx, - struct hive_key *hive, - uint32_t predef_key, - const char **elements); -WERROR reg_get_security(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - struct security_descriptor **security); - -WERROR reg_set_security(struct registry_key *key, - struct security_descriptor *security); + struct hive_key *hive, + uint32_t predef_key, + const char **elements); +WERROR reg_get_security(TALLOC_CTX *mem_ctx, + const struct registry_key *key, + struct security_descriptor **security); + +WERROR reg_set_security(struct registry_key *key, + struct security_descriptor *security); #endif /* _REGISTRY_H */ -- cgit From 6c999cd12344f2bb8b1d2941210b4c205b3e0aad Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Dec 2007 22:32:11 +0100 Subject: r26236: Remove more uses of global_loadparm or specify loadparm_context explicitly. (This used to be commit 5b29ef7c03d9ae76b0ca909e9f03a58e1bad3521) --- source4/lib/registry/registry.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index c1159dde2e..c53e3dfbe5 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -164,6 +164,7 @@ struct registry_context { struct auth_session_info; struct event_context; +struct loadparm_context; /** * Open the locally defined registry. @@ -175,6 +176,7 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx, WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); -- cgit From 4c4323009fa83f00ed319de59a3aad48fcd65994 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Dec 2007 02:37:04 +0100 Subject: r26327: Explicit loadparm_context for RPC client functions. (This used to be commit eeb2251d22b3d6e0379444a73af69d1014692b07) --- source4/lib/registry/registry.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index c53e3dfbe5..edd6c6713f 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -186,6 +186,7 @@ WERROR reg_open_samba(TALLOC_CTX *mem_ctx, WERROR reg_open_remote(struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct loadparm_context *lp_ctx, const char *location, struct event_context *ev); WERROR reg_open_wine(struct registry_context **ctx, const char *path); -- cgit From 45015eda2421253f858f0a4500a57c2855f9686c Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Fri, 14 Dec 2007 10:38:26 +0100 Subject: r26451: Janitorial: fix warnings in lib/registry/ This does not fix the discarded qualifier warnings in tests, as the test data is currently passed as const. Jelmer wants to provide a test function that passes non-const test data, thus allowing for a cleaner way to fix those warnings. (This used to be commit 46dfa63d4f7381c5c6ce3f4b8b0bd9aa9e16950c) --- source4/lib/registry/registry.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index edd6c6713f..a02acbea1e 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -94,7 +94,7 @@ struct registry_operations { WERROR (*flush_key) (struct registry_key *key); - WERROR (*get_predefined_key) (const struct registry_context *ctx, + WERROR (*get_predefined_key) (struct registry_context *ctx, uint32_t key_id, struct registry_key **key); @@ -195,7 +195,7 @@ const char *reg_get_predef_name(uint32_t hkey); WERROR reg_get_predefined_key_by_name(struct registry_context *ctx, const char *name, struct registry_key **key); -WERROR reg_get_predefined_key(const struct registry_context *ctx, +WERROR reg_get_predefined_key(struct registry_context *ctx, uint32_t hkey, struct registry_key **key); -- cgit From 249cc734cebfef31320ec10b05dbfaaaa39682ca Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 22 Dec 2007 05:03:02 -0600 Subject: r26565: Fix python registry bindings. 'PROVISION_PYTHON=yes make test' works now. (This used to be commit 485d1fa3d17fe6cc7a0ecd80e8bac42d173bbb19) --- source4/lib/registry/registry.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index a02acbea1e..7999719909 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -247,9 +247,6 @@ WERROR reg_create_key(TALLOC_CTX *mem_ctx, struct security_descriptor *security, struct registry_key **key); - - - /* Utility functions */ const char *str_regtype(int type); char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, -- cgit From 7f8276b06d5000d12c0d64167853a033b924af32 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 7 Jan 2008 14:11:25 -0600 Subject: r26688: Fix listing remote predefined keys and subkeys. This fixes bug 3431. (This used to be commit 846876ad32dc86fe7c367db084e76c670c61b389) --- source4/lib/registry/registry.h | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 7999719909..8273333b24 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -80,7 +80,6 @@ typedef void (*reg_key_notification_function) (void); typedef void (*reg_value_notification_function) (void); struct cli_credentials; -struct registry_context; struct registry_operations { const char *name; -- cgit From 47f6bbf8cf5bdd03c72c59d00e3e1eab8895590e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 7 Jan 2008 14:11:29 -0600 Subject: r26689: registry: Return max_subkeynamelen, max_valnamelen and max_valbufsize in getkeyinfo(). (This used to be commit b06896d2378e536f5044dbe500a5232a89d6d0b5) --- source4/lib/registry/registry.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 8273333b24..fac9180378 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -89,7 +89,10 @@ struct registry_operations { const char **classname, uint32_t *numsubkeys, uint32_t *numvalues, - NTTIME *last_change_time); + NTTIME *last_change_time, + uint32_t *max_subkeynamelen, + uint32_t *max_valnamelen, + uint32_t *max_valbufsize); WERROR (*flush_key) (struct registry_key *key); @@ -211,7 +214,10 @@ WERROR reg_key_get_info(TALLOC_CTX *mem_ctx, const char **class_name, uint32_t *num_subkeys, uint32_t *num_values, - NTTIME *last_change_time); + NTTIME *last_change_time, + uint32_t *max_subkeynamelen, + uint32_t *max_valnamelen, + uint32_t *max_valbufsize); WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, -- cgit From 48307b54f95395fbd201d92d738b482f80cd15ef Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 16:01:19 +0100 Subject: Remove more uses of global_loadparm. (This used to be commit 3430cc60972b94d0d238bc39f473feed96949c5d) --- source4/lib/registry/registry.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index fac9180378..5e0b971a1d 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -254,11 +254,10 @@ WERROR reg_create_key(TALLOC_CTX *mem_ctx, /* Utility functions */ const char *str_regtype(int type); -char *reg_val_data_string(TALLOC_CTX *mem_ctx, uint32_t type, - const DATA_BLOB data); -char *reg_val_description(TALLOC_CTX *mem_ctx, const char *name, +char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t type, const DATA_BLOB data); +char *reg_val_description(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *name, uint32_t type, const DATA_BLOB data); -bool reg_string_to_val(TALLOC_CTX *mem_ctx, const char *type_str, +bool reg_string_to_val(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const char *type_str, const char *data_str, uint32_t *type, DATA_BLOB *data); WERROR reg_open_key_abs(TALLOC_CTX *mem_ctx, struct registry_context *handle, const char *name, struct registry_key **result); -- 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/registry.h | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'source4/lib/registry/registry.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/registry.h | 183 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 182 insertions(+), 1 deletion(-) (limited to 'source4/lib/registry/registry.h') 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 -- 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/registry.h') 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 From 12147fca2b3acd37eb20db82996714320cd4e9b2 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Mon, 14 Apr 2008 22:52:51 +0200 Subject: Add support for security descriptors. Also patched the regf backend to support this. Did not touch the ldb, dir and rpc backends yet. (This used to be commit c4626f21a898da27a051f2c67f8fd73f55d4fc7d) --- source4/lib/registry/registry.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index a86294bf46..1348d1121f 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -184,6 +184,12 @@ 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_get_sec_desc(TALLOC_CTX *mem_ctx, + struct hive_key *key, + struct security_descriptor **security); + +WERROR hive_set_sec_desc(struct hive_key *key, + const struct security_descriptor *security); WERROR hive_key_del_value(struct hive_key *key, const char *name); @@ -311,11 +317,11 @@ struct registry_operations { uint32_t *type, DATA_BLOB *data); - WERROR (*get_security) (TALLOC_CTX *mem_ctx, + WERROR (*get_sec_desc) (TALLOC_CTX *mem_ctx, const struct registry_key *key, struct security_descriptor **security); - WERROR (*set_security) (struct registry_key *key, + WERROR (*set_sec_desc) (struct registry_key *key, const struct security_descriptor *security); WERROR (*load_key) (struct registry_key *key, @@ -461,12 +467,8 @@ struct registry_key *reg_import_hive_key(struct registry_context *ctx, struct hive_key *hive, uint32_t predef_key, const char **elements); -WERROR reg_get_security(TALLOC_CTX *mem_ctx, - const struct registry_key *key, - struct security_descriptor **security); - -WERROR reg_set_security(struct registry_key *key, - struct security_descriptor *security); +WERROR reg_set_sec_desc(struct registry_key *key, + const struct security_descriptor *security); struct reg_diff_callbacks { WERROR (*add_key) (void *callback_data, const char *key_name); @@ -490,6 +492,9 @@ 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_preg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct reg_diff_callbacks **callbacks, + void **callback_data); WERROR reg_generate_diff_key(struct registry_key *oldkey, struct registry_key *newkey, const char *path, -- cgit From 0b8d2b3cb779463a1e24039300ac2669862f9b64 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Tue, 15 Apr 2008 11:52:33 +0200 Subject: Fixed the patchfile tests and tidy up the patchfile backends. (This used to be commit 6e9b1e35a269af2eda79356c1525f5413656d648) --- source4/lib/registry/registry.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 1348d1121f..573379aff5 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -500,6 +500,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, const char *path, const struct reg_diff_callbacks *callbacks, void *callback_data); +WERROR reg_diff_load(const char *filename, + struct smb_iconv_convenience *iconv_convenience, + const struct reg_diff_callbacks *callbacks, + void *callback_data); -- cgit From 5e687d79533684949deb9bd9bc86f88eab4ae310 Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Tue, 15 Apr 2008 19:57:29 +0200 Subject: Fix PReg write support. Add tests for patch files (.REG and PReg). (This used to be commit 497977c36c621a4820be51cbcb7b78eac1e292b7) --- source4/lib/registry/registry.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index 573379aff5..6a98a60633 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -493,6 +493,7 @@ WERROR reg_dotreg_diff_save(TALLOC_CTX *ctx, const char *filename, struct reg_diff_callbacks **callbacks, void **callback_data); WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, + struct smb_iconv_convenience *ic, struct reg_diff_callbacks **callbacks, void **callback_data); WERROR reg_generate_diff_key(struct registry_key *oldkey, -- cgit From 2ef07ad551d398c39a595494aaa083a932ef79aa Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 01:32:54 +0200 Subject: Remove unused arguments from reg_open_local(). (This used to be commit fee7ea7080ec40182efc6ffe57b267444eb9389a) --- source4/lib/registry/registry.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index a86294bf46..d4c4a89c20 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -355,9 +355,7 @@ struct loadparm_context; * Open the locally defined registry. */ WERROR reg_open_local(TALLOC_CTX *mem_ctx, - struct registry_context **ctx, - struct auth_session_info *session_info, - struct cli_credentials *credentials); + struct registry_context **ctx); WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, -- cgit From 21fc7673780aa1d7c0caab7b17ff9171238913ba Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 12:23:44 +0200 Subject: Specify event_context to ldb_wrap_connect explicitly. (This used to be commit b4e1ae07a284c044704322446c94351c2decff91) --- source4/lib/registry/registry.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib/registry/registry.h') diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index d4c4a89c20..9c0f66b6d6 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -149,10 +149,12 @@ struct hive_operations { struct cli_credentials; struct auth_session_info; +struct event_context; WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **root); WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key, @@ -199,6 +201,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location, struct auth_session_info *session_info, struct cli_credentials *credentials, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct hive_key **k); @@ -359,6 +362,7 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx, WERROR reg_open_samba(TALLOC_CTX *mem_ctx, struct registry_context **ctx, + struct event_context *ev_ctx, struct loadparm_context *lp_ctx, struct auth_session_info *session_info, struct cli_credentials *credentials); -- cgit