[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Thu May 12 04:53:02 MDT 2011
The branch, master has been updated
via cd1d75c libcli/auth/smbencrypt: in E_deshash, use talloc_stackframe instead of "#if _SAMBA_BUILD_ == 3" and talloc_tos()
via 26b6831 s3:registry: add a warning debug message when the sorted subkeys is created from key_exists()
via daf5f29 s3:registry: recreate the sorted subkeys cache when storing keys
via 1a6ac6a s3:registry: add create_sorted_subkeys() to delete and recreate the sorted subkeys key
via b1eac2d s3:registry: turn create_sorted_subkeys_internal to NTSTATUS return type
via f5f9355 s3:registry: rename create_sorted_subkeys() to create_sorted_subkeys_internal()
via 04f0a1c s3:registry: fix a typo in a debug message
via 2b40899 s3: Slightly simplify smbd_smb2_request_next_vector
from a8798d8 s4/drepl_fsmo: Add an CR so that message is visible in the logs
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cd1d75c7a4f84e16c6da2d56ddcd42e285453d21
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 11:57:10 2011 +0200
libcli/auth/smbencrypt: in E_deshash, use talloc_stackframe instead of "#if _SAMBA_BUILD_ == 3" and talloc_tos()
talloc_stackframe() is used in other shared components already,
and if the stack is a talloc_pool, then in most cases, it should
also not be more expensive than directly using talloc_tos().
Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
Autobuild-User: Volker Lendecke <vlendec at samba.org>
Autobuild-Date: Thu May 12 12:52:02 CEST 2011 on sn-devel-104
commit 26b683116459dad57888dcab6f6f05400e855894
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 16:19:41 2011 +0200
s3:registry: add a warning debug message when the sorted subkeys is created from key_exists()
commit daf5f29d4933c89bb8815e34206c976945683ed3
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 15:58:48 2011 +0200
s3:registry: recreate the sorted subkeys cache when storing keys
This is to avoid turning the next read operation into a write op.
commit 1a6ac6a9444c826fe68fd4c55dbef226c8d3b056
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 15:27:01 2011 +0200
s3:registry: add create_sorted_subkeys() to delete and recreate the sorted subkeys key
This is to be used from other places than the key_exists() code path.
commit b1eac2daf38703a2e206ec3b4d577889f6d3f5c0
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 14:53:48 2011 +0200
s3:registry: turn create_sorted_subkeys_internal to NTSTATUS return type
(from bool)
commit f5f9355ebe9f1d818846e70fe178bc4eacd14f0a
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 14:49:10 2011 +0200
s3:registry: rename create_sorted_subkeys() to create_sorted_subkeys_internal()
commit 04f0a1cb7b5f5216ad0a97a588dd545e3e56f7b8
Author: Michael Adam <obnox at samba.org>
Date: Wed May 11 14:17:21 2011 +0200
s3:registry: fix a typo in a debug message
commit 2b40899bd3aa3229c0b27a96198333072766cfaa
Author: Volker Lendecke <vl at samba.org>
Date: Fri May 6 11:26:56 2011 +0200
s3: Slightly simplify smbd_smb2_request_next_vector
Metze, Jeremy, please check!
-----------------------------------------------------------------------
Summary of changes:
libcli/auth/smbencrypt.c | 12 +++-----
source3/registry/reg_backend_db.c | 55 ++++++++++++++++++++++++-------------
source3/smbd/smb2_server.c | 8 +++--
3 files changed, 45 insertions(+), 30 deletions(-)
Changeset truncated at 500 lines:
diff --git a/libcli/auth/smbencrypt.c b/libcli/auth/smbencrypt.c
index 0cd8363..66fdbd2 100644
--- a/libcli/auth/smbencrypt.c
+++ b/libcli/auth/smbencrypt.c
@@ -118,7 +118,7 @@ bool E_deshash(const char *passwd, uint8_t p16[16])
{
bool ret;
uint8_t dospwd[14];
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *frame = talloc_stackframe();
size_t converted_size;
@@ -126,23 +126,19 @@ bool E_deshash(const char *passwd, uint8_t p16[16])
ZERO_STRUCT(dospwd);
-#if _SAMBA_BUILD_ == 3
- mem_ctx = talloc_tos();
-#else
- mem_ctx = NULL;
-#endif
- tmpbuf = strupper_talloc(mem_ctx, passwd);
+ tmpbuf = strupper_talloc(frame, passwd);
if (tmpbuf == NULL) {
/* Too many callers don't check this result, we need to fill in the buffer with something */
strlcpy((char *)dospwd, passwd ? passwd : "", sizeof(dospwd));
E_P16(dospwd, p16);
+ talloc_free(frame);
return false;
}
ZERO_STRUCT(dospwd);
ret = convert_string_error(CH_UNIX, CH_DOS, tmpbuf, strlen(tmpbuf), dospwd, sizeof(dospwd), &converted_size);
- talloc_free(tmpbuf);
+ talloc_free(frame);
/* Only the first 14 chars are considered, password need not
* be null terminated. We do this in the error and success
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index df0cb7f..11bbe7e 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -48,6 +48,8 @@ static int regdb_fetch_values_internal(struct db_context *db, const char* key,
static bool regdb_store_values_internal(struct db_context *db, const char *key,
struct regval_ctr *values);
+static NTSTATUS create_sorted_subkeys(const char *key);
+
/* List the deepest path into the registry. All part components will be created.*/
/* If you want to have a part of the path controlled by the tdb and part by
@@ -832,22 +834,9 @@ static WERROR regdb_store_keys_internal2(struct db_context *db,
W_ERROR_NOT_OK_GOTO_DONE(werr);
/*
- * Delete a sorted subkey cache for regdb_key_exists, will be
- * recreated automatically
+ * recreate the sorted subkey cache for regdb_key_exists()
*/
- keyname = talloc_asprintf(ctx, "%s\\%s", REG_SORTED_SUBKEYS_PREFIX,
- keyname);
- if (keyname == NULL) {
- werr = WERR_NOMEM;
- goto done;
- }
-
- werr = ntstatus_to_werror(dbwrap_delete_bystring(db, keyname));
-
- /* don't treat WERR_NOT_FOUND as an error here */
- if (W_ERROR_EQUAL(werr, WERR_NOT_FOUND)) {
- werr = WERR_OK;
- }
+ werr = ntstatus_to_werror(create_sorted_subkeys(keyname));
done:
TALLOC_FREE(ctx);
@@ -1408,7 +1397,8 @@ done:
return status;
}
-static bool create_sorted_subkeys(const char *key, const char *sorted_keyname)
+static NTSTATUS create_sorted_subkeys_internal(const char *key,
+ const char *sorted_keyname)
{
NTSTATUS status;
struct create_sorted_subkeys_context sorted_ctx;
@@ -1420,7 +1410,26 @@ static bool create_sorted_subkeys(const char *key, const char *sorted_keyname)
create_sorted_subkeys_action,
&sorted_ctx);
- return NT_STATUS_IS_OK(status);
+ return status;
+}
+
+static NTSTATUS create_sorted_subkeys(const char *key)
+{
+ char *sorted_subkeys_keyname;
+ NTSTATUS status;
+
+ sorted_subkeys_keyname = talloc_asprintf(talloc_tos(), "%s\\%s",
+ REG_SORTED_SUBKEYS_PREFIX,
+ key);
+ if (sorted_subkeys_keyname == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ status = create_sorted_subkeys_internal(key, sorted_subkeys_keyname);
+
+done:
+ return status;
}
struct scan_subkey_state {
@@ -1500,13 +1509,21 @@ static bool scan_parent_subkeys(struct db_context *db, const char *parent,
if (state.scanned) {
result = state.found;
} else {
+ NTSTATUS status;
+
res = db->transaction_start(db);
if (res != 0) {
- DEBUG(0, ("error starting transacion\n"));
+ DEBUG(0, ("error starting transaction\n"));
goto fail;
}
- if (!create_sorted_subkeys(path, key)) {
+ DEBUG(2, (__location__ " WARNING: recreating the sorted "
+ "subkeys cache for key '%s' from scan_parent_subkeys "
+ "this should not happen (too frequently)...\n",
+ path));
+
+ status = create_sorted_subkeys_internal(path, key);
+ if (!NT_STATUS_IS_OK(status)) {
res = db->transaction_cancel(db);
if (res != 0) {
smb_panic("Failed to cancel transaction.");
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index 1bb3cc2..7752fb0 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -2018,9 +2018,11 @@ static int smbd_smb2_request_next_vector(struct tstream_context *stream,
invalid = true;
}
- if ((body_size % 2) != 0) {
- body_size -= 1;
- }
+ /*
+ * Mask out the lowest bit, the "dynamic" part
+ * of body_size.
+ */
+ body_size &= ~1;
if (body_size > (full_size - SMB2_HDR_BODY)) {
/*
--
Samba Shared Repository
More information about the samba-cvs
mailing list