[SCM] Samba Shared Repository - branch master updated
Matthias Dieter Wallnöfer
mdw at samba.org
Mon Mar 29 13:43:25 MDT 2010
The branch, master has been updated
via c38e962... s4:registry/tests/generic.c - fix the DWORD_* types test to work also against big endian platforms
via 50d2613... s4:.gitignore - update it for the new heimdal release
via 8d0b67b... s4:registry/ldb.c - Break with "NULL" as an error case when the data doesn't fit in the "reg_ldb_pack_value" function
via e25e60b... s4:registry/ldb.c - Always check the "name" attribute for != NULL
via 90d2902... s4:registry - move the UTF16 length calculation for "reg_key_get_info" into the RPC server code
from 8efea42... s4:registry/util.c - fix indentation
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c38e96278a8ec1ccdff33e14a751bfcb8c3d63bf
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Mon Mar 29 21:27:18 2010 +0200
s4:registry/tests/generic.c - fix the DWORD_* types test to work also against big endian platforms
commit 50d26133dcc2b7866bb877fa80af2fc6dca144dc
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Mon Mar 29 21:16:44 2010 +0200
s4:.gitignore - update it for the new heimdal release
commit 8d0b67b644d636ebab98add81b78093841342cac
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Mon Mar 29 21:09:23 2010 +0200
s4:registry/ldb.c - Break with "NULL" as an error case when the data doesn't fit in the "reg_ldb_pack_value" function
commit e25e60ba2f4802a43a0a990c4f34fb23359dab28
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Mon Mar 29 20:53:38 2010 +0200
s4:registry/ldb.c - Always check the "name" attribute for != NULL
If it's NULL return invalid parameter as Windows does. The name is "" if it
refers to the default value.
commit 90d2902c73715c7777ad67b2a33f32a79f72764c
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date: Mon Mar 29 20:36:32 2010 +0200
s4:registry - move the UTF16 length calculation for "reg_key_get_info" into the RPC server code
It does fit better there.
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
source4/lib/registry/ldb.c | 39 ++++++++++++++++++++++---------
source4/lib/registry/tests/generic.c | 12 +++++-----
source4/rpc_server/winreg/rpc_winreg.c | 9 +++++++
4 files changed, 43 insertions(+), 18 deletions(-)
Changeset truncated at 500 lines:
diff --git a/.gitignore b/.gitignore
index e847035..15f9e15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -156,6 +156,7 @@ source4/heimdal/kdc/kdc-private.h
source4/heimdal/kdc/kdc-protos.h
source4/heimdal/lib/asn1/asn1_*
source4/heimdal/lib/asn1/*_asn1-priv.h*
+source4/heimdal/lib/asn1/der-private.h
source4/heimdal/lib/asn1/der-protos.h
source4/heimdal/lib/asn1/krb5_asn1_files
source4/heimdal/lib/asn1/krb5_asn1.h
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index b897641..2310bab 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -186,7 +186,8 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
ret = ldb_msg_add_string(msg, "data", conv_str);
} else {
/* workaround for non-standard data */
- ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
+ talloc_free(msg);
+ return NULL;
}
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
@@ -207,7 +208,9 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
ret = ldb_msg_add_string(msg, "data", conv_str);
} else {
/* workaround for non-standard data */
- ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
+ talloc_free(msg);
+ return NULL;
+
}
} else {
ret = ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL);
@@ -508,6 +511,10 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
struct ldb_key_data *kd = talloc_get_type(h, struct ldb_key_data);
struct ldb_context *c = kd->ldb;
+ if (name == NULL) {
+ return WERR_INVALID_PARAM;
+ }
+
ldap_path = reg_path_to_ldb(mem_ctx, h, name, NULL);
W_ERROR_HAVE_NO_MEMORY(ldap_path);
@@ -588,6 +595,10 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent,
struct ldb_key_data *newkd;
int ret;
+ if (name == NULL) {
+ return WERR_INVALID_PARAM;
+ }
+
msg = ldb_msg_new(mem_ctx);
W_ERROR_HAVE_NO_MEMORY(msg);
@@ -634,7 +645,11 @@ static WERROR ldb_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
struct ldb_message *msg;
struct ldb_dn *childdn;
- if ((child == NULL) || (child[0] == '\0')) {
+ if (child == NULL) {
+ return WERR_INVALID_PARAM;
+ }
+
+ if (child[0] == '\0') {
/* default value */
msg = talloc_zero(mem_ctx, struct ldb_message);
W_ERROR_HAVE_NO_MEMORY(msg);
@@ -690,6 +705,10 @@ static WERROR ldb_del_key(TALLOC_CTX *mem_ctx, const struct hive_key *key,
WERROR werr;
struct hive_key *hk;
+ if (name == NULL) {
+ return WERR_INVALID_PARAM;
+ }
+
/* Verify key exists by opening it */
werr = ldb_open_key(mem_ctx, key, name, &hk);
if (!W_ERROR_IS_OK(werr)) {
@@ -793,13 +812,17 @@ static WERROR ldb_set_value(struct hive_key *parent,
int ret;
TALLOC_CTX *mem_ctx = talloc_init("ldb_set_value");
+ if (name == NULL) {
+ return WERR_INVALID_PARAM;
+ }
+
msg = reg_ldb_pack_value(kd->ldb, mem_ctx, name, type, data);
W_ERROR_HAVE_NO_MEMORY(msg);
msg->dn = ldb_dn_copy(msg, kd->dn);
W_ERROR_HAVE_NO_MEMORY(msg->dn);
- if ((name != NULL) && (name[0] != '\0')) {
+ if (name[0] != '\0') {
/* For a default value, we add/overwrite the attributes to/of the hive.
For a normal value, we create a new child. */
if (!ldb_dn_add_child_fmt(msg->dn, "value=%s",
@@ -916,9 +939,6 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
el = ldb_msg_find_element(kd->subkeys[i], "key");
*max_subkeynamelen = MAX(*max_subkeynamelen, el->values[0].length);
}
-
- /* for UTF16 encoding */
- *max_subkeynamelen *= 2;
}
if (max_valnamelen != NULL || max_valbufsize != NULL) {
@@ -948,11 +968,6 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx,
talloc_free(data.data);
}
}
-
- if (max_valnamelen != NULL) {
- /* for UTF16 encoding */
- *max_valnamelen *= 2;
- }
}
talloc_free(default_value.data);
diff --git a/source4/lib/registry/tests/generic.c b/source4/lib/registry/tests/generic.c
index 206fad0..75b6c7f 100644
--- a/source4/lib/registry/tests/generic.c
+++ b/source4/lib/registry/tests/generic.c
@@ -62,8 +62,8 @@ static bool test_str_regtype(struct torture_context *ctx)
static bool test_reg_val_data_string_dword(struct torture_context *ctx)
{
- uint32_t d = 0x20;
- DATA_BLOB db = { (uint8_t *)&d, sizeof(d) };
+ uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 };
+ DATA_BLOB db = { d, 4 };
torture_assert_str_equal(ctx, "0x00000020",
reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD, db),
"dword failed");
@@ -72,8 +72,8 @@ static bool test_reg_val_data_string_dword(struct torture_context *ctx)
static bool test_reg_val_data_string_dword_big_endian(struct torture_context *ctx)
{
- uint32_t d = 0x20;
- DATA_BLOB db = { (uint8_t *)&d, sizeof(d) };
+ uint8_t d[] = { 0x20, 0x00, 0x00, 0x00 };
+ DATA_BLOB db = { d, 4 };
torture_assert_str_equal(ctx, "0x00000020",
reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_DWORD_BIG_ENDIAN, db),
"dword failed");
@@ -82,8 +82,8 @@ static bool test_reg_val_data_string_dword_big_endian(struct torture_context *ct
static bool test_reg_val_data_string_qword(struct torture_context *ctx)
{
- uint64_t d = 0x20;
- DATA_BLOB db = { (uint8_t *)&d, sizeof(d) };
+ uint8_t d[] = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ DATA_BLOB db = { d, 8 };
torture_assert_str_equal(ctx, "0x0000000000000020",
reg_val_data_string(ctx, lp_iconv_convenience(ctx->lp_ctx), REG_QWORD, db),
"qword failed");
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c
index 1b4044f..002eb68 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -464,6 +464,15 @@ static WERROR dcesrv_winreg_QueryInfoKey(struct dcesrv_call_state *dce_call,
r->out.last_changed_time, r->out.max_subkeylen,
r->out.max_valnamelen, r->out.max_valbufsize);
+ if (r->out.max_subkeylen != NULL) {
+ /* for UTF16 encoding */
+ *r->out.max_subkeylen *= 2;
+ }
+ if (r->out.max_valnamelen != NULL) {
+ /* for UTF16 encoding */
+ *r->out.max_valnamelen *= 2;
+ }
+
if (classname != NULL) {
r->out.classname->name = classname;
r->out.classname->name_len = 2*strlen_m_term(classname);
--
Samba Shared Repository
More information about the samba-cvs
mailing list