The branch, master has been updated via 345ef6b smbd: Remove an unnecessary else branch via 22e1fb3 vfs: Add some {} via 796c77d lib: Use dom_sid_equal where appropriate via 2146f39 ctdb: Use talloc_report_str in ctdb via a44a7c7 lib: Add the pointer itself to talloc_report_str via 2fbce8a gensec: Fix CID 242642 Unchecked return value from 62d08ea replace: Fix bug 11455
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 345ef6b2adf20601e804cd67440f0540ea632a19 Author: Volker Lendecke <v...@samba.org> Date: Wed Aug 12 18:32:54 2015 +0200 smbd: Remove an unnecessary else branch "goto out;" is sufficient before Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Thu Aug 20 15:52:20 CEST 2015 on sn-devel-104 commit 22e1fb34669d91dacb1a08227896560aefbb19bb Author: Volker Lendecke <v...@samba.org> Date: Wed Aug 12 17:48:41 2015 +0200 vfs: Add some {} The "mode = " from a very casual view looked as if it was part of the if-condition Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> commit 796c77d43dd1df8ff5df14397e787411d8407797 Author: Volker Lendecke <v...@samba.org> Date: Fri Aug 14 11:40:51 2015 +0200 lib: Use dom_sid_equal where appropriate Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> commit 2146f39111add90b2f12aa9c29a2f9c1e12f25a5 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 16 13:19:15 2015 +0200 ctdb: Use talloc_report_str in ctdb This fixes CID 1125620 Insecure temporary file Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> commit a44a7c759888bf8d8b38ef26222d65b5a95c8e45 Author: Volker Lendecke <v...@samba.org> Date: Mon Aug 17 11:55:26 2015 +0200 lib: Add the pointer itself to talloc_report_str A ctdb test found this discrepancy to talloc_report_full :-) Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> commit 2fbce8ad0a90398b3499085f6e3dbf8e9aae24e5 Author: Volker Lendecke <v...@samba.org> Date: Sun Aug 16 13:03:13 2015 +0200 gensec: Fix CID 242642 Unchecked return value Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Ira Cooper <i...@samba.org> ----------------------------------------------------------------------- Summary of changes: auth/gensec/spnego.c | 7 ++++++- ctdb/server/ctdb_control.c | 40 +++++++++++++++------------------------- ctdb/wscript | 4 ++-- lib/util/talloc_report.c | 4 ++-- lib/util/wscript_build | 14 +++++++------- libcli/security/util_sid.c | 3 ++- source3/modules/vfs_default.c | 3 ++- source3/smbd/dir.c | 3 +-- 8 files changed, 37 insertions(+), 41 deletions(-) Changeset truncated at 500 lines: diff --git a/auth/gensec/spnego.c b/auth/gensec/spnego.c index 85c70e1..c111b85 100644 --- a/auth/gensec/spnego.c +++ b/auth/gensec/spnego.c @@ -1184,6 +1184,7 @@ static NTSTATUS gensec_spnego_update_out(struct gensec_security *gensec_security { struct spnego_state *spnego_state = (struct spnego_state *)gensec_security->private_data; DATA_BLOB out = data_blob_null; + bool ok; *_out = data_blob_null; @@ -1222,7 +1223,11 @@ static NTSTATUS gensec_spnego_update_out(struct gensec_security *gensec_security /* * truncate the buffer */ - data_blob_realloc(spnego_state, &out, spnego_state->out_max_length); + ok = data_blob_realloc(spnego_state, &out, + spnego_state->out_max_length); + if (!ok) { + return NT_STATUS_NO_MEMORY; + } talloc_steal(out_mem_ctx, out.data); *_out = out; diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index 59b7d09..ee69270 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -24,6 +24,7 @@ #include "../include/ctdb_private.h" #include "lib/util/dlinklist.h" #include "lib/tdb_wrap/tdb_wrap.h" +#include "lib/util/talloc_report.h" struct ctdb_control_state { @@ -40,34 +41,23 @@ struct ctdb_control_state { */ int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata) { - /* dump to a file, then send the file as a blob */ - FILE *f; - long fsize; - f = tmpfile(); - if (f == NULL) { - DEBUG(DEBUG_ERR,(__location__ " Unable to open tmpfile - %s\n", strerror(errno))); - return -1; - } - talloc_report_full(NULL, f); - fsize = ftell(f); - if (fsize == -1) { - DEBUG(DEBUG_ERR, (__location__ " Unable to get file size - %s\n", - strerror(errno))); - fclose(f); + char *report; + size_t reportlen; + + report = talloc_report_str(outdata, NULL); + if (report == NULL) { + DEBUG(DEBUG_ERR, + (__location__ " talloc_report_str failed\n")); return -1; } - rewind(f); - outdata->dptr = talloc_size(outdata, fsize); - if (outdata->dptr == NULL) { - fclose(f); - CTDB_NO_MEMORY(ctdb, outdata->dptr); - } - outdata->dsize = fread(outdata->dptr, 1, fsize, f); - fclose(f); - if (outdata->dsize != fsize) { - DEBUG(DEBUG_ERR,(__location__ " Unable to read tmpfile\n")); - return -1; + reportlen = talloc_get_size(report); + + if (reportlen > 0) { + reportlen -= 1; /* strip trailing zero */ } + + outdata->dptr = (uint8_t *)report; + outdata->dsize = reportlen; return 0; } diff --git a/ctdb/wscript b/ctdb/wscript index 06f86a3..8aa0374 100755 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -348,7 +348,7 @@ def build(bld): include/ctdb_private.h include/ctdb_protocol.h include/ctdb_typesafe_cb.h''', - deps='replace popt talloc tevent tdb') + deps='replace popt talloc tevent tdb talloc_report') bld.SAMBA_BINARY('ctdbd', source='', @@ -547,7 +547,7 @@ def build(bld): bld.SAMBA_BINARY('ctdb_takeover_tests', source='tests/src/ctdb_takeover_tests.c', deps='''replace popt tdb tevent talloc ctdb-system - samba-util tdb-wrap''' + + samba-util tdb-wrap talloc_report''' + ib_deps, includes='include include/internal', install_path='${CTDB_TEST_LIBDIR}') diff --git a/lib/util/talloc_report.c b/lib/util/talloc_report.c index 8d7d548..9b98347 100644 --- a/lib/util/talloc_report.c +++ b/lib/util/talloc_report.c @@ -146,11 +146,11 @@ static void talloc_report_str_helper(const void *ptr, int depth, int max_depth, state->s = talloc_asprintf_append_largebuf( state->s, &state->str_len, - "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d)\n", + "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n", depth*4, "", name, (unsigned long)talloc_total_size(ptr), (unsigned long)talloc_total_blocks(ptr), - talloc_reference_count(ptr)); + talloc_reference_count(ptr), ptr); } char *talloc_report_str(TALLOC_CTX *mem_ctx, TALLOC_CTX *root) diff --git a/lib/util/wscript_build b/lib/util/wscript_build index 9663bb0..e5c1a97 100755 --- a/lib/util/wscript_build +++ b/lib/util/wscript_build @@ -54,6 +54,13 @@ bld.SAMBA_LIBRARY('socket-blocking', local_include=False, private_library=True) +bld.SAMBA_LIBRARY('talloc_report', + source='talloc_report.c', + local_include=False, + public_deps='talloc', + private_library=True + ) + bld.SAMBA_SUBSYSTEM('samba-util-core', source='''xfile.c data_blob.c util_file.c time.c signal.c util.c idtree.c fault.c @@ -119,13 +126,6 @@ if not bld.env.SAMBA_UTIL_CORE_ONLY: private_library=True ) - bld.SAMBA_LIBRARY('talloc_report', - source='talloc_report.c', - local_include=False, - public_deps='talloc', - private_library=True - ) - bld.SAMBA_LIBRARY('tevent-util', source='tevent_unix.c tevent_ntstatus.c tevent_werror.c', local_include=False, diff --git a/libcli/security/util_sid.c b/libcli/security/util_sid.c index 5127109..7d72d64 100644 --- a/libcli/security/util_sid.c +++ b/libcli/security/util_sid.c @@ -327,8 +327,9 @@ NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const struct dom_sid *sid, uint32_t i; for (i=0; i<(*num_sids); i++) { - if (dom_sid_compare(sid, &(*sids)[i]) == 0) + if (dom_sid_equal(sid, &(*sids)[i])) { return NT_STATUS_OK; + } } return add_sid_to_array(mem_ctx, sid, sids, num_sids); diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 10d0f3b..ac1052e 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -471,8 +471,9 @@ static int vfswrap_mkdir(vfs_handle_struct *handle, const char *path, mode_t mod if (lp_inherit_acls(SNUM(handle->conn)) && parent_dirname(talloc_tos(), path, &parent, NULL) - && (has_dacl = directory_has_default_acl(handle->conn, parent))) + && (has_dacl = directory_has_default_acl(handle->conn, parent))) { mode = (0777 & lp_directory_mask(SNUM(handle->conn))); + } TALLOC_FREE(parent); diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index c700cb7..eebf9b1 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1465,9 +1465,8 @@ bool is_visible_file(connection_struct *conn, const char *dir_path, if (SMB_VFS_STAT(conn, smb_fname_base) != 0) { ret = true; goto out; - } else { - *pst = smb_fname_base->st; } + *pst = smb_fname_base->st; } /* Honour _hide unreadable_ option */ -- Samba Shared Repository