[SCM] Samba Shared Repository - branch master updated
Michael Adam
obnox at samba.org
Fri Jun 29 09:07:02 MDT 2012
The branch, master has been updated
via ec737d9 s3:cclean avoid segfault in case of ctdb missbehaviour
via fef4195 s3:cclean: fix memory allocation
via 9e53a02 packaging(RHEL-CTDB): package cclean tool
via 250ebe7 packaging(RHEL-CTDB): make makespec.sh aware of new location of version.h
via 01863df s3_dbrwap_ctdb: improve a comment in db_ctdb_can_use_local_record()
via b46977e s3:dbwrap_ctdb: fix a comment in db_ctdb_fetch()
via 92808a6 s3:dbwrap_ctdb: expand the comment for the db_ctdb_can_use_local_copy() function
via 0a5f363 s3:dbwrap_ctdb: rename db_ctdb_own_record() -> db_ctdb_can_use_local_copy()
via d6abf79 s3:dbrwap_ctdb: remove commented out legacy code
via 9d11277 s3:dbwrap_ctdb: fix fetch/fetch_locked when samba is built against old ctdb
via 19941a9 lib/ccan: readd execinfo dependency to failtest
via cbf44e8 libcli/smb: add SMB2_CAP_DIRECTORY_LEASING to SMB2_CAP_ALL
via 3c3ed70 lib/util: fix fd leak in anonymous_shared_allocate() if MAP_ANON is not available
via 1a622fe s3:smb2_server: remove max_charge check in smbd_smb2_request_verify_creditcharge()
from f4a1893 s3:build: tell linker to use corefoundation on all darwin releases
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ec737d96048f3cd34cb2de7f939d93586c4a930f
Author: Gregor Beck <gbeck at sernet.de>
Date: Fri Jun 29 11:42:34 2012 +0200
s3:cclean avoid segfault in case of ctdb missbehaviour
Signed-off-by: Michael Adam <obnox at samba.org>
Autobuild-User(master): Michael Adam <obnox at samba.org>
Autobuild-Date(master): Fri Jun 29 17:06:05 CEST 2012 on sn-devel-104
commit fef41956b9308482a2496827851d47f54dc4873b
Author: Gregor Beck <gbeck at sernet.de>
Date: Fri Jun 29 11:36:54 2012 +0200
s3:cclean: fix memory allocation
Signed-off-by: Michael Adam <obnox at samba.org>
commit 9e53a0209b3c8e4523f39ac92ba86ac42376e204
Author: Gregor Beck <gbeck at sernet.de>
Date: Wed Jun 27 15:07:15 2012 +0200
packaging(RHEL-CTDB): package cclean tool
Signed-off-by: Michael Adam <obnox at samba.org>
commit 250ebe755064eaf534c0ebfd28fcf9052e30a523
Author: Gregor Beck <gbeck at sernet.de>
Date: Wed Jun 27 14:11:23 2012 +0200
packaging(RHEL-CTDB): make makespec.sh aware of new location of version.h
Signed-off-by: Michael Adam <obnox at samba.org>
commit 01863df25dda5a643dd3ed58b8c8150c61416384
Author: Michael Adam <obnox at samba.org>
Date: Fri Jun 29 10:55:32 2012 +0200
s3_dbrwap_ctdb: improve a comment in db_ctdb_can_use_local_record()
Pair-Programmed-With: Gregor Beck <gbeck at sernet.de>
commit b46977e4f64b040dd760ae74b0ca3cbed0df1395
Author: Michael Adam <obnox at samba.org>
Date: Fri Jun 29 10:52:33 2012 +0200
s3:dbwrap_ctdb: fix a comment in db_ctdb_fetch()
Pair-Programmed-With: Gregor Beck <gbeck at sernet.de>
commit 92808a6005debb8810f83a3527cdb0d01559169d
Author: Michael Adam <obnox at samba.org>
Date: Fri Jun 29 10:51:37 2012 +0200
s3:dbwrap_ctdb: expand the comment for the db_ctdb_can_use_local_copy() function
Pair-Programmed-With: Gregor Beck <gbeck at sernet.de>
commit 0a5f36333303812f772a5b7ac84808bd634a4e4a
Author: Michael Adam <obnox at samba.org>
Date: Fri Jun 29 10:47:56 2012 +0200
s3:dbwrap_ctdb: rename db_ctdb_own_record() -> db_ctdb_can_use_local_copy()
This matches the function's intention much closer, since it
also tests whether we have a valid local read only copy.
Pair-Programmed-With: Gregor Beck <gbeck at sernet.de>
commit d6abf79247c4a60a6cdc221904e6fcacf5e1ac9a
Author: Michael Adam <obnox at samba.org>
Date: Fri Jun 29 10:43:11 2012 +0200
s3:dbrwap_ctdb: remove commented out legacy code
commit 9d11277337113bad885240f2fc53c692c1be99bf
Author: Michael Adam <obnox at samba.org>
Date: Fri Jun 29 10:39:07 2012 +0200
s3:dbwrap_ctdb: fix fetch/fetch_locked when samba is built against old ctdb
The introduction of read only copies has broken the algorithm for
deteting whether we can use the local record copy for fetch_locked
and fetch: For fetch locked the new code always uses the local copy
if there is one...
This patch re-establish the original algorithm for the build against
a ctdb without read only record copies.
Reported-by: Gregor Beck <gbeck at sernet.de>
commit 19941a90548de20ca0deda0b7b16135e7989b77f
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Jun 29 15:06:02 2012 +0200
lib/ccan: readd execinfo dependency to failtest
metze
Signed-off-by: Michael Adam <obnox at samba.org>
commit cbf44e8d2f946139c55b87fc389f0619781c68f3
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Jun 26 14:47:58 2012 +0200
libcli/smb: add SMB2_CAP_DIRECTORY_LEASING to SMB2_CAP_ALL
metze
Signed-off-by: Michael Adam <obnox at samba.org>
commit 3c3ed706908022ef26b5889971c4ec5040697f95
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Jun 26 13:48:36 2012 +0200
lib/util: fix fd leak in anonymous_shared_allocate() if MAP_ANON is not available
metze
commit 1a622fe641ffebd93a2ae1ee6ff5e8c4177668aa
Author: Stefan Metzmacher <metze at samba.org>
Date: Fri Jun 29 13:16:11 2012 +0200
s3:smb2_server: remove max_charge check in smbd_smb2_request_verify_creditcharge()
The client can send any credit charge value, it's ok to send more than needed.
metze
Signed-off-by: Michael Adam <obnox at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/ccan/wscript | 5 ++++-
lib/util/util.c | 15 ++++++++++++++-
libcli/smb/smb2_constants.h | 1 +
packaging/RHEL-CTDB/makespec.sh | 2 +-
packaging/RHEL-CTDB/samba.spec.tmpl | 1 +
source3/lib/dbwrap/dbwrap_ctdb.c | 31 ++++++++++++++++---------------
source3/smbd/smb2_server.c | 16 ----------------
source3/utils/cclean.c | 15 ++++++++++-----
8 files changed, 47 insertions(+), 39 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/ccan/wscript b/lib/ccan/wscript
index 565a657..c9bb49b 100644
--- a/lib/ccan/wscript
+++ b/lib/ccan/wscript
@@ -155,4 +155,7 @@ def build(bld):
ccan_module(bld, 'tcon')
ccan_module(bld, 'tlist', 'ccan-list ccan-tcon')
ccan_module(bld, 'failtest',
- "ccan-err ccan-hash ccan-htable ccan-list ccan-read_write_all ccan-str ccan-time")
+ '''
+ ccan-err ccan-hash ccan-htable ccan-list
+ ccan-read_write_all ccan-str ccan-time execinfo
+ ''')
diff --git a/lib/util/util.c b/lib/util/util.c
index 20466b4..100d3d8 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -1109,8 +1109,21 @@ void *anonymous_shared_allocate(size_t orig_bufsz)
buf = mmap(NULL, bufsz, PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED,
-1 /* fd */, 0 /* offset */);
#else
+{
+ int saved_errno;
+ int fd;
+
+ fd = open("/dev/zero", O_RDWR);
+ if (fd == -1) {
+ return NULL;
+ }
+
buf = mmap(NULL, bufsz, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED,
- open("/dev/zero", O_RDWR), 0 /* offset */);
+ fd, 0 /* offset */);
+ saved_errno = errno;
+ close(fd);
+ errno = saved_errno;
+}
#endif
if (buf == MAP_FAILED) {
diff --git a/libcli/smb/smb2_constants.h b/libcli/smb/smb2_constants.h
index f4e8b02..9b60345 100644
--- a/libcli/smb/smb2_constants.h
+++ b/libcli/smb/smb2_constants.h
@@ -102,6 +102,7 @@
SMB2_CAP_LARGE_MTU | \
SMB2_CAP_MULTI_CHANNEL | \
SMB2_CAP_PERSISTENT_HANDLES | \
+ SMB2_CAP_DIRECTORY_LEASING | \
SMB2_CAP_ENCRYPTION)
diff --git a/packaging/RHEL-CTDB/makespec.sh b/packaging/RHEL-CTDB/makespec.sh
index 946ce8e..1207450 100755
--- a/packaging/RHEL-CTDB/makespec.sh
+++ b/packaging/RHEL-CTDB/makespec.sh
@@ -7,7 +7,7 @@
DIRNAME=$(dirname $0)
TOPDIR=${DIRNAME}/../..
SRCDIR=${TOPDIR}/source3
-VERSION_H=${SRCDIR}/include/version.h
+VERSION_H=${SRCDIR}/include/autoconf/version.h
SPECFILE=${DIRNAME}/samba.spec
##
diff --git a/packaging/RHEL-CTDB/samba.spec.tmpl b/packaging/RHEL-CTDB/samba.spec.tmpl
index a9111d2..7d68d27 100644
--- a/packaging/RHEL-CTDB/samba.spec.tmpl
+++ b/packaging/RHEL-CTDB/samba.spec.tmpl
@@ -399,6 +399,7 @@ exit 0
%{_bindir}/tdbdump
%{_bindir}/tdbrestore
%{_bindir}/eventlogadm
+%{_bindir}/cclean
%{_libarchdir}/samba/auth/script.so
%{_libarchdir}/samba/vfs/acl_tdb.so
diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 1062cb0..5605b47 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1003,12 +1003,13 @@ static int db_ctdb_record_destr(struct db_record* data)
return 0;
}
-/* Do I own this record? */
-static bool db_ctdb_own_record(TDB_DATA ctdb_data, bool read_only)
+/**
+ * Check whether we have a valid local copy of the given record,
+ * either for reading or for writing.
+ */
+static bool db_ctdb_can_use_local_copy(TDB_DATA ctdb_data, bool read_only)
{
-#ifdef HAVE_CTDB_WANT_READONLY_DECL
struct ctdb_ltdb_header *hdr;
-#endif
if (ctdb_data.dptr == NULL)
return false;
@@ -1016,17 +1017,20 @@ static bool db_ctdb_own_record(TDB_DATA ctdb_data, bool read_only)
if (ctdb_data.dsize < sizeof(struct ctdb_ltdb_header))
return false;
-#ifdef HAVE_CTDB_WANT_READONLY_DECL
hdr = (struct ctdb_ltdb_header *)ctdb_data.dptr;
+
+#ifdef HAVE_CTDB_WANT_READONLY_DECL
if (hdr->dmaster != get_my_vnn()) {
/* If we're not dmaster, it must be r/o copy. */
return read_only && (hdr->flags & CTDB_REC_RO_HAVE_READONLY);
}
- /* If we want write access, noone can have r/o copies. */
+ /*
+ * If we want write access, no one may have r/o copies.
+ */
return read_only || !(hdr->flags & CTDB_REC_RO_HAVE_DELEGATIONS);
#else
- return !read_only;
+ return (hdr->dmaster == get_my_vnn());
#endif
}
@@ -1099,11 +1103,7 @@ again:
* take the shortcut and just return it.
*/
- if (!db_ctdb_own_record(ctdb_data, false)
-#if 0
- || (random() % 2 != 0)
-#endif
-) {
+ if (!db_ctdb_can_use_local_copy(ctdb_data, false)) {
SAFE_FREE(ctdb_data.dptr);
tdb_chainunlock(ctx->wtdb->tdb, key);
talloc_set_destructor(result, NULL);
@@ -1227,9 +1227,10 @@ static NTSTATUS db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
* take the shortcut and just return it.
* we bypass the dmaster check for persistent databases
*/
- if (db_ctdb_own_record(ctdb_data, true)) {
- /* we are the dmaster - avoid the ctdb protocol op */
-
+ if (db_ctdb_can_use_local_copy(ctdb_data, true)) {
+ /*
+ * We have a valid local copy - avoid the ctdb protocol op
+ */
data->dsize = ctdb_data.dsize - sizeof(struct ctdb_ltdb_header);
data->dptr = (uint8_t *)talloc_memdup(
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index c9c6431..0abd4fc 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -1437,7 +1437,6 @@ NTSTATUS smbd_smb2_request_verify_creditcharge(struct smbd_smb2_request *req,
{
uint16_t needed_charge;
uint16_t credit_charge = 1;
- uint16_t max_charge = 1;
const uint8_t *inhdr;
int i = req->current_idx;
@@ -1446,14 +1445,6 @@ NTSTATUS smbd_smb2_request_verify_creditcharge(struct smbd_smb2_request *req,
if (req->sconn->smb2.supports_multicredit) {
credit_charge = SVAL(inhdr, SMB2_HDR_CREDIT_CHARGE);
credit_charge = MAX(credit_charge, 1);
-
- /*
- * TODO: should we limit this here
- * to a transport specific value?
- *
- * TODO: we need tests for this?
- */
- max_charge = UINT16_MAX;
}
needed_charge = (data_length - 1)/ 65536 + 1;
@@ -1468,13 +1459,6 @@ NTSTATUS smbd_smb2_request_verify_creditcharge(struct smbd_smb2_request *req,
return NT_STATUS_INVALID_PARAMETER;
}
- if (credit_charge > max_charge) {
- DEBUG(2, ("CreditCharge too high, given %d, "
- "needed %d, allowed %d\n",
- credit_charge, needed_charge, max_charge));
- return NT_STATUS_INVALID_PARAMETER;
- }
-
return NT_STATUS_OK;
}
diff --git a/source3/utils/cclean.c b/source3/utils/cclean.c
index b035d33..487c107 100644
--- a/source3/utils/cclean.c
+++ b/source3/utils/cclean.c
@@ -53,9 +53,14 @@ static void print_record(const char *msg,
const struct connections_data *d)
{
char *idstr = serverid_str(k->pid);
- d_printf("%s: connection %d (%s) to \"%s\" from %u:%u@%s[%s] %s\n", msg,
- k->cnum, idstr, d->servicename, (unsigned)d->uid,
- (unsigned)d->gid, d->machine, d->addr, time_to_asc(d->start));
+ d_printf("%s: connection %d (%s) ", msg, k->cnum, idstr);
+ if (d == NULL) {
+ d_printf("<no data>\n");
+ } else {
+ d_printf("to \"%s\" from %u:%u@%s[%s] %s\n", d->servicename,
+ (unsigned)d->uid, (unsigned)d->gid, d->machine,
+ d->addr, time_to_asc(d->start));
+ }
talloc_free(idstr);
}
@@ -66,7 +71,7 @@ static int read_connections_fn(const struct connections_key *key,
struct cclean_ctx *ctx = (struct cclean_ctx *)cclean_ctx;
unsigned length = talloc_array_length(ctx->cnums);
if (length <= ctx->num) {
- int n = 2*length;
+ int n = MAX(2*length, 16);
void *tmp;
tmp = talloc_realloc(ctx, ctx->ids, struct server_id, n);
@@ -95,7 +100,7 @@ static int read_connections_fn(const struct connections_key *key,
ctx->ids[ctx->num] = key->pid;
ctx->cnums[ctx->num] = key->cnum;
ctx->names[ctx->num] = talloc_strndup(ctx, key->name, FSTRING_LEN);
- if (ctx->names[ctx->num]) {
+ if (ctx->names[ctx->num] == NULL) {
goto talloc_failed;
}
ctx->num++;
--
Samba Shared Repository
More information about the samba-cvs
mailing list