The branch, master has been updated via a98f09a selftest: Load time_audit and full_audit modules for all tests via 4909b96 s3: vfs: time_audit: fix handling of token_blob in smb_time_audit_offload_read_recv() via 4c0b49b s3:winbind: Fix memory leak in nss_init() from 3e6ce5c s3:registry: Fix possible memory leak in _reg_perfcount_multi_sz_from_tdb()
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a98f09a09db2fc7be85f9171b586e65344a39e92 Author: Christof Schmitt <c...@samba.org> Date: Fri Aug 10 10:38:28 2018 -0700 selftest: Load time_audit and full_audit modules for all tests Previously the only test was to load these modules to trigger the smb_vfs_assert_all_fns check. As these modules just pass through the calls, they can be loaded for all tests to ensure that the codepaths are exercised. This would have found the problem in smb_time_audit_offload_read_recv. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13568 Signed-off-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Mon Aug 13 22:35:20 CEST 2018 on sn-devel-144 commit 4909b966050c921b0a6a32285fee55f5f14dc3ff Author: Ralph Wuerthner <ralph.wuerth...@de.ibm.com> Date: Wed Aug 8 17:42:18 2018 +0200 s3: vfs: time_audit: fix handling of token_blob in smb_time_audit_offload_read_recv() BUG: https://bugzilla.samba.org/show_bug.cgi?id=13568 Signed-off-by: Ralph Wuerthner <ralph.wuerth...@de.ibm.com> Reviewed-by: Christof Schmitt <c...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4c0b49b3f982a3a3013a3b6fef3c10b1ca7d2ab0 Author: Andreas Schneider <a...@samba.org> Date: Thu Aug 9 16:38:49 2018 +0200 s3:winbind: Fix memory leak in nss_init() Found by covscan. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13567 Pair-Programmed-With: Justin Stephenson <jstep...@redhat.com> Signed-off-by: Andreas Schneider <a...@samba.org> Signed-off-by: Justin Stephenson <jstep...@redhat.com> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: selftest/target/Samba3.pm | 12 ++++++------ source3/modules/vfs_time_audit.c | 12 +++--------- source3/winbindd/nss_info.c | 26 ++++++++++++++++++-------- 3 files changed, 27 insertions(+), 23 deletions(-) Changeset truncated at 500 lines: diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 447c1e8..d90c8f7 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -762,14 +762,10 @@ sub setup_simpleserver my $simpleserver_options = " lanman auth = yes ntlm auth = yes - vfs objects = xattr_tdb streams_depot time_audit full_audit + vfs objects = xattr_tdb streams_depot change notify = no smb encrypt = off - full_audit:syslog = no - full_audit:success = none - full_audit:failure = none - [vfs_aio_pthread] path = $prefix_abs/share read only = no @@ -1766,7 +1762,11 @@ sub provision($$$$$$$$$) dos filemode = yes strict rename = yes strict sync = yes - vfs objects = acl_xattr fake_acls xattr_tdb streams_depot + vfs objects = acl_xattr fake_acls xattr_tdb streams_depot time_audit full_audit + + full_audit:syslog = no + full_audit:success = none + full_audit:failure = none printing = vlp print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 64e1f5d..aefea33 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1988,13 +1988,12 @@ static NTSTATUS smb_time_audit_offload_read_recv( struct tevent_req *req, struct vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, - DATA_BLOB *_token_blob) + DATA_BLOB *token_blob) { struct time_audit_offload_read_state *state = tevent_req_data( req, struct time_audit_offload_read_state); struct timespec ts_recv; double timediff; - DATA_BLOB token_blob; NTSTATUS status; clock_gettime_mono(&ts_recv); @@ -2008,13 +2007,8 @@ static NTSTATUS smb_time_audit_offload_read_recv( return status; } - token_blob = data_blob_talloc(mem_ctx, - state->token_blob.data, - state->token_blob.length); - if (token_blob.data == NULL) { - tevent_req_received(req); - return NT_STATUS_NO_MEMORY; - } + token_blob->length = state->token_blob.length; + token_blob->data = talloc_move(mem_ctx, &state->token_blob.data); tevent_req_received(req); return NT_STATUS_OK; diff --git a/source3/winbindd/nss_info.c b/source3/winbindd/nss_info.c index 473b1a3..1a8325c 100644 --- a/source3/winbindd/nss_info.c +++ b/source3/winbindd/nss_info.c @@ -84,7 +84,10 @@ static struct nss_function_entry *nss_get_backend(const char *name ) /******************************************************************** *******************************************************************/ -static bool parse_nss_parm( const char *config, char **backend, char **domain ) +static bool parse_nss_parm(TALLOC_CTX *mem_ctx, + const char *config, + char **backend, + char **domain) { char *p; @@ -98,17 +101,17 @@ static bool parse_nss_parm( const char *config, char **backend, char **domain ) /* if no : then the string must be the backend name only */ if ( !p ) { - *backend = SMB_STRDUP( config ); + *backend = talloc_strdup(mem_ctx, config); return (*backend != NULL); } /* split the string and return the two parts */ if ( strlen(p+1) > 0 ) { - *domain = SMB_STRDUP( p+1 ); + *domain = talloc_strdup(mem_ctx, p + 1); } - *backend = SMB_STRNDUP(config, PTR_DIFF(p, config)); + *backend = talloc_strndup(mem_ctx, config, PTR_DIFF(p, config)); return (*backend != NULL); } @@ -158,8 +161,9 @@ static NTSTATUS nss_init(const char **nss_list) NTSTATUS status; static bool nss_initialized = false; int i; - char *backend, *domain; + char *backend = NULL, *domain = NULL; struct nss_function_entry *nss_backend; + TALLOC_CTX *frame; /* check for previous successful initializations */ @@ -167,6 +171,8 @@ static NTSTATUS nss_init(const char **nss_list) return NT_STATUS_OK; } + frame = talloc_stackframe(); + /* The "template" backend should always be registered as it is a static module */ @@ -179,8 +185,10 @@ static NTSTATUS nss_init(const char **nss_list) as necessary) */ for ( i=0; nss_list && nss_list[i]; i++ ) { + bool ok; - if ( !parse_nss_parm(nss_list[i], &backend, &domain) ) { + ok = parse_nss_parm(frame, nss_list[i], &backend, &domain); + if (!ok) { DEBUG(0,("nss_init: failed to parse \"%s\"!\n", nss_list[i])); continue; @@ -238,10 +246,11 @@ static NTSTATUS nss_init(const char **nss_list) /* cleanup */ - SAFE_FREE( backend ); - SAFE_FREE( domain ); + TALLOC_FREE(domain); + TALLOC_FREE(backend); } + if ( !nss_domain_list ) { DEBUG(3,("nss_init: no nss backends configured. " "Defaulting to \"template\".\n")); @@ -252,6 +261,7 @@ static NTSTATUS nss_init(const char **nss_list) nss_initialized = true; + TALLOC_FREE(frame); return NT_STATUS_OK; } -- Samba Shared Repository