summaryrefslogtreecommitdiff
path: root/source4/lib/registry
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-03-21 01:30:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:58:59 -0500
commitd64ccc01769ce274c74d8458f9ef81cdcc8986f6 (patch)
tree27c1b92cf2c0d482fdab208f33b876314cacb13e /source4/lib/registry
parentb556df32a849eefa2f2f34868eee02f05451878d (diff)
downloadsamba-d64ccc01769ce274c74d8458f9ef81cdcc8986f6.tar.gz
samba-d64ccc01769ce274c74d8458f9ef81cdcc8986f6.tar.bz2
samba-d64ccc01769ce274c74d8458f9ef81cdcc8986f6.zip
r14599: Pass ACLs down the registry layer.
(This used to be commit 6cdefd8945eee5513a6993350ea71f12d4dbd6fa)
Diffstat (limited to 'source4/lib/registry')
-rw-r--r--source4/lib/registry/common/reg_interface.c4
-rw-r--r--source4/lib/registry/reg_backend_ldb.c4
-rw-r--r--source4/lib/registry/reg_backend_rpc.c2
-rw-r--r--source4/lib/registry/reg_samba.c6
-rw-r--r--source4/lib/registry/regf.idl1
-rw-r--r--source4/lib/registry/registry.h6
-rw-r--r--source4/lib/registry/tools/regdiff.c8
-rw-r--r--source4/lib/registry/tools/regpatch.c4
-rw-r--r--source4/lib/registry/tools/regshell.c6
-rw-r--r--source4/lib/registry/tools/regtree.c6
10 files changed, 29 insertions, 18 deletions
diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c
index 7af0616ce0..42535d835d 100644
--- a/source4/lib/registry/common/reg_interface.c
+++ b/source4/lib/registry/common/reg_interface.c
@@ -161,7 +161,7 @@ _PUBLIC_ WERROR reg_get_predefined_key(struct registry_context *ctx, uint32_t hk
}
/** Open a registry file/host/etc */
-_PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *backend, const char *location, const char *credentials, struct registry_key **root)
+_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)
{
struct registry_hive *rethive;
struct registry_key *retkey = NULL;
@@ -181,6 +181,8 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *backend, const
rethive = talloc(parent_ctx, struct registry_hive);
rethive->location = location?talloc_strdup(rethive, location):NULL;
+ rethive->session_info = talloc_reference(rethive, session_info);
+ rethive->credentials = talloc_reference(rethive, credentials);
rethive->functions = entry->hive_functions;
rethive->backend_data = NULL;
diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c
index 6c668d7b48..ec185cd65b 100644
--- a/source4/lib/registry/reg_backend_ldb.c
+++ b/source4/lib/registry/reg_backend_ldb.c
@@ -262,8 +262,8 @@ static WERROR ldb_open_hive(struct registry_hive *hive, struct registry_key **k)
struct ldb_context *wrap;
if (!hive->location) return WERR_INVALID_PARAM;
- /* TODO: Support remoting with credentials and ACLs with session tokens */
- wrap = ldb_wrap_connect(hive, hive->location, NULL, NULL, 0, NULL);
+
+ wrap = ldb_wrap_connect(hive, hive->location, hive->session_info, hive->credentials, 0, NULL);
if(!wrap) {
DEBUG(1, ("ldb_open_hive: unable to connect\n"));
diff --git a/source4/lib/registry/reg_backend_rpc.c b/source4/lib/registry/reg_backend_rpc.c
index c4d9c28d9d..eb98565554 100644
--- a/source4/lib/registry/reg_backend_rpc.c
+++ b/source4/lib/registry/reg_backend_rpc.c
@@ -356,7 +356,7 @@ static struct hive_operations reg_backend_rpc = {
.num_values = rpc_num_values,
};
-_PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx, 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)
{
NTSTATUS status;
diff --git a/source4/lib/registry/reg_samba.c b/source4/lib/registry/reg_samba.c
index 71f7160686..4a88d96042 100644
--- a/source4/lib/registry/reg_samba.c
+++ b/source4/lib/registry/reg_samba.c
@@ -61,16 +61,18 @@ static WERROR reg_samba_get_predef (struct registry_context *ctx, uint32_t hkey,
/* FIXME: HKEY_LOCAL_MACHINE\Security\SAM is an alias for HKEY_LOCAL_MACHINE\SAM */
- error = reg_open_hive(ctx, backend, location, NULL, k);
+ error = reg_open_hive(ctx, backend, location, ctx->session_info, ctx->credentials, k);
talloc_free(backend);
return error;
}
-_PUBLIC_ WERROR reg_open_local (struct registry_context **ctx)
+_PUBLIC_ WERROR reg_open_local (struct registry_context **ctx, struct auth_session_info *session_info, struct cli_credentials *credentials)
{
*ctx = talloc(NULL, struct registry_context);
+ (*ctx)->credentials = talloc_reference(*ctx, credentials);
+ (*ctx)->session_info = talloc_reference(*ctx, session_info);
(*ctx)->get_predefined_key = reg_samba_get_predef;
return WERR_OK;
diff --git a/source4/lib/registry/regf.idl b/source4/lib/registry/regf.idl
index dcb1df039b..8f5db8c236 100644
--- a/source4/lib/registry/regf.idl
+++ b/source4/lib/registry/regf.idl
@@ -17,6 +17,7 @@ interface regf
/*
* Registry version number
+ * 1.2.0.1 for WinNT 3.51
* 1.3.0.1 for WinNT 4
* 1.5.0.1 for WinXP
*/
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 */
diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c
index ae617bbe84..c7e6f87792 100644
--- a/source4/lib/registry/tools/regdiff.c
+++ b/source4/lib/registry/tools/regdiff.c
@@ -54,14 +54,14 @@ int main(int argc, char **argv)
error = WERR_OK;
switch(opt) {
case 'L':
- if (!h1 && !from_null) error = reg_open_local(&h1);
- else if (!h2) error = reg_open_local(&h2);
+ if (!h1 && !from_null) error = reg_open_local(&h1, NULL, cmdline_credentials);
+ else if (!h2) error = reg_open_local(&h2, NULL, cmdline_credentials);
break;
case 'R':
if (!h1 && !from_null)
- error = reg_open_remote(&h1, cmdline_credentials,
+ error = reg_open_remote(&h1, NULL, cmdline_credentials,
poptGetOptArg(pc), NULL);
- else if (!h2) error = reg_open_remote(&h2, cmdline_credentials,
+ else if (!h2) error = reg_open_remote(&h2, NULL, cmdline_credentials,
poptGetOptArg(pc), NULL);
break;
}
diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c
index 9392e66192..74601d73f9 100644
--- a/source4/lib/registry/tools/regpatch.c
+++ b/source4/lib/registry/tools/regpatch.c
@@ -50,9 +50,9 @@ int main(int argc, char **argv)
}
if (remote) {
- error = reg_open_remote (&h, cmdline_credentials, remote, NULL);
+ error = reg_open_remote (&h, NULL, cmdline_credentials, remote, NULL);
} else {
- error = reg_open_local (&h);
+ error = reg_open_local (&h, NULL, cmdline_credentials);
}
if (W_ERROR_IS_OK(error)) {
diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c
index 0812cad73f..19f544bccf 100644
--- a/source4/lib/registry/tools/regshell.c
+++ b/source4/lib/registry/tools/regshell.c
@@ -426,11 +426,11 @@ static char **reg_completion(const char *text, int start, int end)
}
if (remote) {
- error = reg_open_remote (&h, cmdline_credentials, remote, NULL);
+ error = reg_open_remote (&h, NULL, cmdline_credentials, remote, NULL);
} else if (backend) {
- error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, &curkey);
+ error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, cmdline_credentials, &curkey);
} else {
- error = reg_open_local(&h);
+ error = reg_open_local(&h, NULL, cmdline_credentials);
}
if(!W_ERROR_IS_OK(error)) {
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index a4fb69f073..fae2c6eacf 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -107,11 +107,11 @@ int main(int argc, char **argv)
}
if (remote) {
- error = reg_open_remote(&h, cmdline_credentials, remote, NULL);
+ error = reg_open_remote(&h, NULL, cmdline_credentials, remote, NULL);
} else if (backend) {
- error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, &root);
+ error = reg_open_hive(NULL, backend, poptGetArg(pc), NULL, cmdline_credentials, &root);
} else {
- error = reg_open_local (&h);
+ error = reg_open_local (&h, NULL, cmdline_credentials);
}
if(!W_ERROR_IS_OK(error)) {