[SCM] Samba Shared Repository - branch v3-2-stable updated -
release-3-2-0pre3-110-g697159d
Karolin Seeger
kseeger at samba.org
Wed May 21 07:17:58 GMT 2008
The branch, v3-2-stable has been updated
via 697159d80a766d9a47b6c52ebb2544343e350c08 (commit)
via b8dce2ffe528c8bf149207ed3eb3dc4338a44161 (commit)
via c31e1a9765552ced56d031aac1be4221e0ec3412 (commit)
via f4a7b090115b8eaf27c7ed842b02f027f5b44b33 (commit)
via 75731a3117a03a10ca8e4f694424f0729165aa48 (commit)
via 32562ffeae30a15f04fa734bc0c453b55fdb8006 (commit)
from fd5a58980d4fc2d0f9a8ba81a5ae9490e306b2ba (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-stable
- Log -----------------------------------------------------------------
commit 697159d80a766d9a47b6c52ebb2544343e350c08
Author: Günther Deschner <gd at samba.org>
Date: Tue May 20 17:48:39 2008 +0200
Fix typo.
Guenther
(cherry picked from commit d3dd7ea5a77414c0d802668ab5bfbe3487b66926)
commit b8dce2ffe528c8bf149207ed3eb3dc4338a44161
Author: Volker Lendecke <vl at samba.org>
Date: Tue May 20 17:29:40 2008 +0200
Fix a valgrind error in _samr_LookupNames
(cherry picked from commit fb0a25d59ddd28ea1d5af33ec7d9f817fac3fb9d)
commit c31e1a9765552ced56d031aac1be4221e0ec3412
Author: Jeremy Allison <jra at samba.org>
Date: Tue May 20 14:18:58 2008 -0700
Convert in_transaction to a bool. Add the same fix Volker
used for tdb_traverse() to tdb_traverse_read().
Jeremy.
(cherry picked from commit a0e1d8ac4dd9121312fd66ecb2e2942513df5a4b)
commit f4a7b090115b8eaf27c7ed842b02f027f5b44b33
Author: Volker Lendecke <vl at samba.org>
Date: Tue May 20 21:54:36 2008 +0200
Fix nesting tdb_traverse in a transaction
Calling tdb_traverse inside a transaction led to the transaction lock being
held indefinitely. This was caused by the tdb_transaction_lock/unlock inside
tdb_traverse: The transaction code holds the global lock at offset
TRANSACTION_LOCK. The call to tdb_transaction_lock does nothing because the
transaction_lock is already being held. tdb_transaction_unlock inside tdb_wrap
resets tdb->have_transaction_lock but does not release the kernel-level fcntl
lock. transaction_commit later on does not release that fcntl lock either,
because tdb->have_transaction_lock was already reset by tdb_transaction().
This patch does fix that problem for me. An alternative would be to make
tdb->have_transaction_lock a counter that can cope with proper nesting, maybe
in other places as well.
Volker
(cherry picked from commit fd0b60a9e000f969cf99a8d670080cc7a52d97d8)
commit 75731a3117a03a10ca8e4f694424f0729165aa48
Author: Jeremy Allison <jra at samba.org>
Date: Tue May 20 12:10:01 2008 -0700
Fix bug #5477 - recvfile code was broken.
Jeremy.
(cherry picked from commit 47eb2e8fa858d9f12637eb9a10466271335f61aa)
commit 32562ffeae30a15f04fa734bc0c453b55fdb8006
Author: Volker Lendecke <vl at samba.org>
Date: Tue May 20 18:35:23 2008 +0200
Fix memcache_flush()
I have no idea what I've been smoking when I checked this in :-(
Karolin, this fixes the join bug 3.0.28->3.2.0rc1
Please merge!
Thanks,
Volker
(cherry picked from commit 006e45fba01e05c664359e8104d495609d9555f7)
-----------------------------------------------------------------------
Summary of changes:
source/lib/memcache.c | 39 +++++++++++++++++++++++++++++++++----
source/lib/recvfile.c | 10 +++++++++
source/lib/tdb/common/traverse.c | 22 +++++++++++++++-----
source/rpc_server/srv_samr_nt.c | 13 +++++++----
source/smbd/process.c | 12 +++-------
5 files changed, 72 insertions(+), 24 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/memcache.c b/source/lib/memcache.c
index 6dee61a..e1426bc 100644
--- a/source/lib/memcache.c
+++ b/source/lib/memcache.c
@@ -120,11 +120,11 @@ static int memcache_compare(struct memcache_element *e, enum memcache_number n,
{
DATA_BLOB this_key, this_value;
- if ((int)e->n < (int)n) return -1;
- if ((int)e->n > (int)n) return 1;
+ if ((int)e->n < (int)n) return 1;
+ if ((int)e->n > (int)n) return -1;
- if (e->keylength < key.length) return -1;
- if (e->keylength > key.length) return 1;
+ if (e->keylength < key.length) return 1;
+ if (e->keylength > key.length) return -1;
memcache_element_parse(e, &this_key, &this_value);
return memcmp(this_key.data, key.data, key.length);
@@ -357,10 +357,18 @@ void memcache_flush(struct memcache *cache, enum memcache_number n)
return;
}
+ /*
+ * First, find *any* element of number n
+ */
+
while (true) {
struct memcache_element *elem = memcache_node2elem(node);
struct rb_node *next;
+ if ((int)elem->n == (int)n) {
+ break;
+ }
+
if ((int)elem->n < (int)n) {
next = node->rb_right;
}
@@ -373,15 +381,36 @@ void memcache_flush(struct memcache *cache, enum memcache_number n)
node = next;
}
- node = rb_next(node);
if (node == NULL) {
return;
}
+ /*
+ * Then, find the leftmost element with number n
+ */
+
+ while (true) {
+ struct rb_node *prev = rb_prev(node);
+ struct memcache_element *elem;
+
+ if (prev == NULL) {
+ break;
+ }
+ elem = memcache_node2elem(prev);
+ if ((int)elem->n != (int)n) {
+ break;
+ }
+ node = prev;
+ }
+
while (node != NULL) {
struct memcache_element *e = memcache_node2elem(node);
struct rb_node *next = rb_next(node);
+ if (e->n != n) {
+ break;
+ }
+
memcache_delete_element(cache, e);
node = next;
}
diff --git a/source/lib/recvfile.c b/source/lib/recvfile.c
index f9788fd..07c1f68 100644
--- a/source/lib/recvfile.c
+++ b/source/lib/recvfile.c
@@ -58,6 +58,11 @@ static ssize_t default_sys_recvfile(int fromfd,
size_t total_written = 0;
char *buffer = NULL;
+ DEBUG(10,("default_sys_recvfile: from = %d, to = %d, "
+ "offset=%.0f, count = %lu\n",
+ fromfd, tofd, (double)offset,
+ (unsigned long)count));
+
if (count == 0) {
return 0;
}
@@ -141,6 +146,11 @@ ssize_t sys_recvfile(int fromfd,
{
size_t total_written = 0;
+ DEBUG(10,("sys_recvfile: from = %d, to = %d, "
+ "offset=%.0f, count = %lu\n",
+ fromfd, tofd, (double)offset,
+ (unsigned long)count));
+
if (count == 0) {
return 0;
}
diff --git a/source/lib/tdb/common/traverse.c b/source/lib/tdb/common/traverse.c
index 07b0c23..69c81e6 100644
--- a/source/lib/tdb/common/traverse.c
+++ b/source/lib/tdb/common/traverse.c
@@ -204,18 +204,23 @@ int tdb_traverse_read(struct tdb_context *tdb,
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
int ret;
+ bool in_transaction = (tdb->transaction != NULL);
/* we need to get a read lock on the transaction lock here to
cope with the lock ordering semantics of solaris10 */
- if (tdb_transaction_lock(tdb, F_RDLCK)) {
- return -1;
+ if (!in_transaction) {
+ if (tdb_transaction_lock(tdb, F_RDLCK)) {
+ return -1;
+ }
}
tdb->traverse_read++;
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
tdb->traverse_read--;
- tdb_transaction_unlock(tdb);
+ if (!in_transaction) {
+ tdb_transaction_unlock(tdb);
+ }
return ret;
}
@@ -232,20 +237,25 @@ int tdb_traverse(struct tdb_context *tdb,
{
struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
int ret;
+ bool in_transaction = (tdb->transaction != NULL);
if (tdb->read_only || tdb->traverse_read) {
return tdb_traverse_read(tdb, fn, private_data);
}
- if (tdb_transaction_lock(tdb, F_WRLCK)) {
- return -1;
+ if (!in_transaction) {
+ if (tdb_transaction_lock(tdb, F_WRLCK)) {
+ return -1;
+ }
}
tdb->traverse_write++;
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
tdb->traverse_write--;
- tdb_transaction_unlock(tdb);
+ if (!in_transaction) {
+ tdb_transaction_unlock(tdb);
+ }
return ret;
}
diff --git a/source/rpc_server/srv_samr_nt.c b/source/rpc_server/srv_samr_nt.c
index f28c771..a89e00f 100644
--- a/source/rpc_server/srv_samr_nt.c
+++ b/source/rpc_server/srv_samr_nt.c
@@ -1786,8 +1786,8 @@ NTSTATUS _samr_LookupNames(pipes_struct *p,
struct samr_LookupNames *r)
{
NTSTATUS status;
- uint32 rid[MAX_SAM_ENTRIES];
- enum lsa_SidType type[MAX_SAM_ENTRIES];
+ uint32 *rid;
+ enum lsa_SidType *type;
int i;
int num_rids = r->in.num_names;
DOM_SID pol_sid;
@@ -1796,9 +1796,6 @@ NTSTATUS _samr_LookupNames(pipes_struct *p,
DEBUG(5,("_samr_LookupNames: %d\n", __LINE__));
- ZERO_ARRAY(rid);
- ZERO_ARRAY(type);
-
if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &pol_sid, &acc_granted, NULL)) {
return NT_STATUS_OBJECT_TYPE_MISMATCH;
}
@@ -1815,6 +1812,12 @@ NTSTATUS _samr_LookupNames(pipes_struct *p,
DEBUG(5,("_samr_LookupNames: truncating entries to %d\n", num_rids));
}
+ rid = talloc_array(p->mem_ctx, uint32, num_rids);
+ NT_STATUS_HAVE_NO_MEMORY(rid);
+
+ type = talloc_array(p->mem_ctx, enum lsa_SidType, num_rids);
+ NT_STATUS_HAVE_NO_MEMORY(type);
+
DEBUG(5,("_samr_LookupNames: looking name on SID %s\n",
sid_string_dbg(&pol_sid)));
diff --git a/source/smbd/process.c b/source/smbd/process.c
index 5946989..2fc88ca 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -252,6 +252,8 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
timeout, toread);
if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("receive_smb_raw_talloc_partial_read: %s\n",
+ nt_errstr(status)));
return status;
}
}
@@ -282,14 +284,8 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, int fd,
smb_len_large(lenbuf) > min_recv_size && /* Could be a UNIX large writeX. */
!srv_is_signing_active()) {
- status = receive_smb_raw_talloc_partial_read(
- mem_ctx, lenbuf, fd, buffer, timeout, p_unread, &len);
-
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(10, ("receive_smb_raw: %s\n",
- nt_errstr(status)));
- return status;
- }
+ return receive_smb_raw_talloc_partial_read(
+ mem_ctx, lenbuf, fd, buffer, timeout, p_unread, plen);
}
if (!valid_packet_size(len)) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list