The branch, master has been updated via 6dea4f2 lib/tdb2: make summary handle capabilities properly. via 5ba2e4f lib/tdb2: fix error string formatting. via ee0d1da lib/tdb2: Add gcc-style format attribute to tdb_logerr. from 2d35fd7 Fix bug #8811 - sd_has_inheritable_components segfaults on an SD that se_access_check accepts.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6dea4f24dc023a8234de01bbdcd012df29d3abf9 Author: Rusty Russell <ru...@rustcorp.com.au> Date: Wed Mar 14 13:51:26 2012 +1030 lib/tdb2: make summary handle capabilities properly. Another PPC issue (endian?) revealed that the summary code did not handle capabilities correctly: in fact, it went into an endless loop. Signed-off-by: Rusty Russell <ru...@rustcorp.com.au> Autobuild-User: Rusty Russell <ru...@rustcorp.com.au> Autobuild-Date: Wed Mar 14 06:51:43 CET 2012 on sn-devel-104 commit 5ba2e4fc391e3f894b9d939b9ae65f664e32bb0c Author: Rusty Russell <ru...@rustcorp.com.au> Date: Wed Mar 14 13:37:51 2012 +1030 lib/tdb2: fix error string formatting. This caused a crash on PPC64 when we failed the mmap (found by failtest, reported by Amitay) Signed-off-by: Rusty Russell <ru...@rustcorp.com.au> commit ee0d1daa279049a1b38b1ef4b3a1b29b1344b212 Author: Rusty Russell <ru...@rustcorp.com.au> Date: Wed Mar 14 13:08:58 2012 +1030 lib/tdb2: Add gcc-style format attribute to tdb_logerr. Signed-off-by: Rusty Russell <ru...@rustcorp.com.au> ----------------------------------------------------------------------- Summary of changes: lib/tdb2/io.c | 4 ++-- lib/tdb2/private.h | 9 +++++---- lib/tdb2/summary.c | 44 +++++++++++++------------------------------- lib/tdb2/tdb1_check.c | 3 ++- lib/tdb2/tdb1_io.c | 5 +++-- 5 files changed, 25 insertions(+), 40 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/tdb2/io.c b/lib/tdb2/io.c index b4a6f0b..5634922 100644 --- a/lib/tdb2/io.c +++ b/lib/tdb2/io.c @@ -134,8 +134,8 @@ static enum TDB_ERROR tdb_oob(struct tdb_context *tdb, return TDB_SUCCESS; tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR, - "tdb_oob len %llu beyond eof at %zu", - (long long)(off + len), st.st_size); + "tdb_oob len %llu beyond eof at %llu", + (long long)(off + len), (long long)st.st_size); return TDB_ERR_IO; } diff --git a/lib/tdb2/private.h b/lib/tdb2/private.h index 31790bc..04a433b 100644 --- a/lib/tdb2/private.h +++ b/lib/tdb2/private.h @@ -740,10 +740,11 @@ TDB_DATA tdb1_firstkey(struct tdb_context *tdb); TDB_DATA tdb1_nextkey(struct tdb_context *tdb, TDB_DATA key); /* tdb.c: */ -enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb, - enum TDB_ERROR ecode, - enum tdb_log_level level, - const char *fmt, ...); +enum TDB_ERROR COLD PRINTF_FMT(4, 5) + tdb_logerr(struct tdb_context *tdb, + enum TDB_ERROR ecode, + enum tdb_log_level level, + const char *fmt, ...); #ifdef TDB_TRACE void tdb_trace(struct tdb_context *tdb, const char *op); diff --git a/lib/tdb2/summary.c b/lib/tdb2/summary.c index 8ddd26e..4a1d688 100644 --- a/lib/tdb2/summary.c +++ b/lib/tdb2/summary.c @@ -73,7 +73,8 @@ static enum TDB_ERROR summarize(struct tdb_context *tdb, struct tally *data, struct tally *extra, struct tally *uncoal, - struct tally *chains) + struct tally *chains, + size_t *num_caps) { tdb_off_t off; tdb_len_t len; @@ -140,6 +141,11 @@ static enum TDB_ERROR summarize(struct tdb_context *tdb, + rec_extra_padding(&p->u); tally_add(chains, 1); tally_add(extra, rec_extra_padding(&p->u)); + } else if (rec_magic(&p->u) == TDB_CAP_MAGIC) { + len = sizeof(p->u) + + rec_data_length(&p->u) + + rec_extra_padding(&p->u); + (*num_caps)++; } else { len = dead_space(tdb, off); if (TDB_OFF_IS_ERR(len)) { @@ -153,30 +159,7 @@ static enum TDB_ERROR summarize(struct tdb_context *tdb, return TDB_SUCCESS; } -static size_t num_capabilities(struct tdb_context *tdb) -{ - tdb_off_t off, next; - const struct tdb_capability *cap; - size_t count = 0; - - off = tdb_read_off(tdb, offsetof(struct tdb_header, capabilities)); - if (TDB_OFF_IS_ERR(off)) - return count; - - /* Count capability list. */ - for (; off; off = next) { - cap = tdb_access_read(tdb, off, sizeof(*cap), true); - if (TDB_PTR_IS_ERR(cap)) { - break; - } - count++; - next = cap->next; - tdb_access_release(tdb, cap); - } - return count; -} - -static void add_capabilities(struct tdb_context *tdb, size_t num, char *summary) +static void add_capabilities(struct tdb_context *tdb, char *summary) { tdb_off_t off, next; const struct tdb_capability *cap; @@ -216,7 +199,7 @@ _PUBLIC_ enum TDB_ERROR tdb_summary(struct tdb_context *tdb, char **summary) { tdb_len_t len; - size_t num_caps; + size_t num_caps = 0; struct tally *ftables, *hashes, *freet, *keys, *data, *extra, *uncoal, *chains; char *hashesg, *freeg, *keysg, *datag, *extrag, *uncoalg; @@ -261,7 +244,7 @@ _PUBLIC_ enum TDB_ERROR tdb_summary(struct tdb_context *tdb, } ecode = summarize(tdb, hashes, ftables, freet, keys, data, extra, - uncoal, chains); + uncoal, chains, &num_caps); if (ecode != TDB_SUCCESS) { goto unlock; } @@ -275,8 +258,6 @@ _PUBLIC_ enum TDB_ERROR tdb_summary(struct tdb_context *tdb, uncoalg = tally_histogram(uncoal, HISTO_WIDTH, HISTO_HEIGHT); } - num_caps = num_capabilities(tdb); - /* 20 is max length of a %llu. */ len = strlen(SUMMARY_FORMAT) + 33*20 + 1 + (hashesg ? strlen(hashesg) : 0) @@ -285,7 +266,8 @@ _PUBLIC_ enum TDB_ERROR tdb_summary(struct tdb_context *tdb, + (datag ? strlen(datag) : 0) + (extrag ? strlen(extrag) : 0) + (uncoalg ? strlen(uncoalg) : 0) - + num_caps * (strlen(CAPABILITY_FORMAT) + 20*4); + + num_caps * (strlen(CAPABILITY_FORMAT) + 20 + + strlen(" (uncheckable,read-only)")); *summary = malloc(len); if (!*summary) { @@ -332,7 +314,7 @@ _PUBLIC_ enum TDB_ERROR tdb_summary(struct tdb_context *tdb, + sizeof(struct tdb_chain) * tally_num(chains)) * 100.0 / tdb->file->map_size); - add_capabilities(tdb, num_caps, *summary); + add_capabilities(tdb, *summary); unlock: free(hashesg); diff --git a/lib/tdb2/tdb1_check.c b/lib/tdb2/tdb1_check.c index a8e54b2..68f8f81 100644 --- a/lib/tdb2/tdb1_check.c +++ b/lib/tdb2/tdb1_check.c @@ -420,7 +420,8 @@ int tdb1_check(struct tdb_context *tdb, tdb_logerr(tdb, TDB_SUCCESS, TDB_LOG_WARNING, "Dead space at %d-%d (of %u)\n", - off, off + dead, tdb->file->map_size); + off, off + dead, + (unsigned)tdb->file->map_size); rec.rec_len = dead - sizeof(rec); break; case TDB1_RECOVERY_MAGIC: diff --git a/lib/tdb2/tdb1_io.c b/lib/tdb2/tdb1_io.c index f3d139d..e7d20b8 100644 --- a/lib/tdb2/tdb1_io.c +++ b/lib/tdb2/tdb1_io.c @@ -230,8 +230,9 @@ void tdb1_mmap(struct tdb_context *tdb) if (tdb->file->map_ptr == MAP_FAILED) { tdb->file->map_ptr = NULL; tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_WARNING, - "tdb1_mmap failed for size %d (%s)", - tdb->file->map_size, strerror(errno)); + "tdb1_mmap failed for size %llu (%s)", + (long long)tdb->file->map_size, + strerror(errno)); } } else { tdb->file->map_ptr = NULL; -- Samba Shared Repository