The branch, master has been updated via 6d3cfb4b1c6 s4:torture: Initialize param arrays via f52e7fd3c02 s4:torture: Remove trailing spaces from gentest.c via b11cf72c1be s3:winbind: Fix integer type of len via aae8cab3f9b s3:smbd: Make sure struct security_ace is initialized via 321ee914a4b s3:libsmb: Check if we have a valid file descriptor via 57001527ae6 s4:torture: Initialize pointers via 1d38f6ee925 s4:torture: Initialize struct smb2_handle via b6d66e55adc s4:torture: Initialize struct netr_LogonSamLogonEx via d755bc43d8f s3:rpc_client: Initialize struct security_ace via 9ec0f8bd602 s4:torture: Make sure struct smb2_handle is initialized via 14786193632 s3:smbd: Make sure struct security_ace is initialized via df8d19e53b6 s3:smbd: Remove trailing spaces in posix_acls.c via 5eb58b16ca7 examples: Make sure the array is probably initialized via 384d948b8d8 winexe: Make sure specificError is initialized from 0ebabaedbc0 smbd: Fix cached dos attributes
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6d3cfb4b1c60bca966c21ee772f3b1ba5ac76371 Author: Andreas Schneider <a...@samba.org> Date: Fri Jun 21 13:36:23 2024 +0200 s4:torture: Initialize param arrays "Error: UNINIT (CWE-457): samba-4.20.0rc2/source4/torture/gentest.c:2690: var_decl: Declaring variable ""parm"" without initializer. samba-4.20.0rc2/source4/torture/gentest.c:2711: uninit_use: Using uninitialized value ""parm[0]"". Field ""parm[0].out"" is uninitialized. 2709| } 2710| 2711|-> GEN_COPY_PARM; 2712| GEN_SET_FNUM_SMB2(in.file.handle); 2713| GEN_CALL_SMB2(smb2_lock(tree, &parm[i]));" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> Autobuild-User(master): Martin Schwenke <mart...@samba.org> Autobuild-Date(master): Mon Jul 1 00:23:08 UTC 2024 on atb-devel-224 commit f52e7fd3c02592baebca8d493e37ba0a7bc6dd9d Author: Andreas Schneider <a...@samba.org> Date: Fri Jun 21 13:37:46 2024 +0200 s4:torture: Remove trailing spaces from gentest.c Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit b11cf72c1be13b83fb9a3e8c852ba73ac3f7e9e2 Author: Andreas Schneider <a...@samba.org> Date: Fri Jun 21 10:57:32 2024 +0200 s3:winbind: Fix integer type of len "Error: INTEGER_OVERFLOW (CWE-190): samba-4.20.0rc2/source3/winbindd/winbindd_cache.c:849: cast_overflow: Truncation due to cast operation on ""len"" from 32 to 8 bits. samba-4.20.0rc2/source3/winbindd/winbindd_cache.c:851: overflow_sink: ""len"", which might have overflowed, is passed to ""memcpy(centry->data + centry->ofs, s, len)"". [Note: The source code implementation of the function has been overridden by a builtin model.] 849| centry_put_uint8(centry, len); 850| centry_expand(centry, len); 851|-> memcpy(centry->data + centry->ofs, s, len); 852| centry->ofs += len; 853| }" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit aae8cab3f9be0189d6f76bf1a53a1d747b8ba2ff Author: Andreas Schneider <a...@samba.org> Date: Fri Jun 21 10:49:53 2024 +0200 s3:smbd: Make sure struct security_ace is initialized "Error: UNINIT (CWE-457): samba-4.20.0rc2/source3/smbd/posix_acls.c:4706: var_decl: Declaring variable ""aces"" without initializer. samba-4.20.0rc2/source3/smbd/posix_acls.c:4748: uninit_use_in_call: Using uninitialized value ""*aces"". Field ""aces->object"" is uninitialized when calling ""make_sec_acl"". 4746| idx++; 4747| 4748|-> new_dacl = make_sec_acl(ctx, 4749| NT4_ACL_REVISION, 4750| idx," Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 321ee914a4b5232c2ff451352e2f5b5d0bf9a96c Author: Andreas Schneider <a...@samba.org> Date: Fri Jun 21 10:48:01 2024 +0200 s3:libsmb: Check if we have a valid file descriptor "Error: REVERSE_NEGATIVE (CWE-191): samba-4.20.0rc2/source3/libsmb/pylibsmb.c:215: negative_sink_in_call: Passing ""t->shutdown_pipe[1]"" to a parameter that cannot be negative. samba-4.20.0rc2/source3/libsmb/pylibsmb.c:230: check_after_sink: You might be using variable ""t->shutdown_pipe[1]"" before verifying that it is >= 0. 228| t->shutdown_pipe[0] = -1; 229| } 230|-> if (t->shutdown_pipe[1] != -1) { 231| close(t->shutdown_pipe[1]); 232| t->shutdown_pipe[1] = -1;" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 57001527ae6209ec907d37e8b96a2e545cfe632e Author: Andreas Schneider <a...@samba.org> Date: Fri Jun 21 10:45:23 2024 +0200 s4:torture: Initialize pointers "Error: UNINIT (CWE-457): samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1518: var_decl: Declaring variable ""tree2"" without initializer. samba-4.20.0rc2/source4/torture/smb2/durable_open.c:1584: uninit_use_in_call: Using uninitialized value ""tree2"" when calling ""smb2_util_close"". 1582| if (tree != NULL) { 1583| if (h != NULL) { 1584|-> smb2_util_close(tree2, *h); 1585| } 1586|" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 1d38f6ee9255598e6dc7c26c7a730321ec5a5804 Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 14:48:29 2024 +0200 s4:torture: Initialize struct smb2_handle "Error: UNINIT (CWE-457): samba-4.20.0rc2/source4/torture/smb2/lease.c:452: var_decl: Declaring variable ""h"" without initializer. samba-4.20.0rc2/source4/torture/smb2/lease.c:516: uninit_use_in_call: Using uninitialized value ""h"" when calling ""smb2_util_close"". 514| 515| done: 516|-> smb2_util_close(tree, h); 517| smb2_util_close(tree, hnew); 518| smb2_util_close(tree, h2);" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit b6d66e55adce1b8cbbeb0493617db463c62c42bc Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 14:44:33 2024 +0200 s4:torture: Initialize struct netr_LogonSamLogonEx "Error: UNINIT (CWE-457): samba-4.20.0rc2/source4/torture/rpc/schannel.c:250: var_decl: Declaring variable ""r"" without initializer. samba-4.20.0rc2/source4/torture/rpc/schannel.c:357: uninit_use_in_call: Using uninitialized value ""r.in.validation_level"" when calling ""torture_comment"". 355| ""LogonSamLogonEx failed""); 356| } else { 357|-> torture_comment(tctx, 358| ""Skip auth_level[%u] Testing LogonSamLogonEx with name %s using %s and validation_level: %d\n"", 359| auth_level, ninfo.identity_info.account_name.string, crypto_alg," Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit d755bc43d8f1fc95da55b2e6efedf19c61f99c61 Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 14:42:54 2024 +0200 s3:rpc_client: Initialize struct security_ace "Error: UNINIT (CWE-457): samba-4.20.0rc2/source3/rpc_client/init_spoolss.c:348: var_decl: Declaring variable ""ace"" without initializer. samba-4.20.0rc2/source3/rpc_client/init_spoolss.c:415: uninit_use_in_call: Using uninitialized value ""*ace"". Field ""ace->object"" is uninitialized when calling ""make_sec_acl"". 413| NT5 machine. */ 414| 415|-> if ((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, i, ace)) != NULL) { 416| psd = make_sec_desc(mem_ctx, 417| SD_REVISION," Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 9ec0f8bd60267e3c616906c7679ae95907b77435 Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 09:24:12 2024 +0200 s4:torture: Make sure struct smb2_handle is initialized "Error: UNINIT (CWE-457): samba-4.20.0rc2/source4/torture/smb2/lease.c:1223: var_decl: Declaring variable ""h2"" without initializer. samba-4.20.0rc2/source4/torture/smb2/lease.c:1328: uninit_use_in_call: Using uninitialized value ""h2"" when calling ""smb2_util_close"". 1326| done: 1327| smb2_util_close(tree, h); 1328|-> smb2_util_close(tree, h2); 1329| 1330| smb2_util_unlink(tree, fname);" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 147861936320d98877d088a9bd36cb2243c98abe Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 09:14:45 2024 +0200 s3:smbd: Make sure struct security_ace is initialized "Error: UNINIT (CWE-457): samba-4.20.0rc2/source3/smbd/posix_acls.c:4778: var_decl: Declaring variable ""aces"" without initializer. samba-4.20.0rc2/source3/smbd/posix_acls.c:4799: uninit_use_in_call: Using uninitialized value ""*aces"". Field ""aces->object"" is uninitialized when calling ""make_sec_acl"". 4797| idx++; 4798| 4799|-> new_dacl = make_sec_acl(ctx, 4800| NT4_ACL_REVISION, 4801| idx," Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit df8d19e53b69e19698737c7ea405c7f66f9ce2fd Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 09:14:20 2024 +0200 s3:smbd: Remove trailing spaces in posix_acls.c Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 5eb58b16ca7d34f8aac2cac8285405b3c3c72277 Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 09:12:22 2024 +0200 examples: Make sure the array is probably initialized "Error: UNINIT (CWE-457): samba-4.20.0rc2/examples/libsmbclient/testacl2.c:27: var_decl: Declaring variable ""value"" without initializer. samba-4.20.0rc2/examples/libsmbclient/testacl2.c:48: uninit_use_in_call: Using uninitialized value ""*value"" as argument to ""%s"" when calling ""printf"". [Note: The source code implementation of the function has been overridden by a builtin model.] 46| } 47| 48|-> printf(""Attributes for [%s] are:\n%s\n"", argv[1], value); 49| 50| flags = 0;" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> commit 384d948b8d8052a9d91f9c2a181cc33786742562 Author: Andreas Schneider <a...@samba.org> Date: Thu Jun 20 09:08:48 2024 +0200 winexe: Make sure specificError is initialized "Error: UNINIT (CWE-457): samba-4.20.0rc2/examples/winexe/winexesvc.c:684: var_decl: Declaring variable ""specificError"" without initializer. samba-4.20.0rc2/examples/winexe/winexesvc.c:711: uninit_use: Using uninitialized value ""specificError"". 709| winexesvcStatus.dwWaitHint = 0; 710| winexesvcStatus.dwWin32ExitCode = status; 711|-> winexesvcStatus.dwServiceSpecificExitCode = specificError; 712| 713| SetServiceStatus(winexesvcStatusHandle, &winexesvcStatus);" Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Martin Schwenke <mschwe...@ddn.com> ----------------------------------------------------------------------- Summary of changes: examples/libsmbclient/testacl2.c | 2 +- examples/winexe/winexesvc.c | 2 +- source3/libsmb/pylibsmb.c | 14 +- source3/rpc_client/init_spoolss.c | 2 +- source3/smbd/posix_acls.c | 16 +-- source3/winbindd/winbindd_cache.c | 5 +- source4/torture/gentest.c | 273 ++++++++++++++++++------------------ source4/torture/rpc/schannel.c | 6 +- source4/torture/smb2/durable_open.c | 8 +- source4/torture/smb2/lease.c | 17 ++- 10 files changed, 182 insertions(+), 163 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/testacl2.c b/examples/libsmbclient/testacl2.c index ee48b7b3059..ae9a76b5118 100644 --- a/examples/libsmbclient/testacl2.c +++ b/examples/libsmbclient/testacl2.c @@ -24,7 +24,7 @@ int main(int argc, const char *argv[]) static char *the_acl = NULL; int ret; const char *debugstr; - char value[1024]; + char value[1024] = {0}; SMBCCTX *context; if (smbc_init(get_auth_data_fn, debug) != 0) diff --git a/examples/winexe/winexesvc.c b/examples/winexe/winexesvc.c index 3d2ebcce149..980f4d1ab6d 100644 --- a/examples/winexe/winexesvc.c +++ b/examples/winexe/winexesvc.c @@ -681,7 +681,7 @@ static DWORD winexesvcInitialization(DWORD argc, LPTSTR * argv, DWORD * specific static void WINAPI winexesvcStart(DWORD argc, LPTSTR * argv) { DWORD status; - DWORD specificError; + DWORD specificError = NO_ERROR; winexesvcStatus.dwServiceType = SERVICE_WIN32; winexesvcStatus.dwCurrentState = SERVICE_START_PENDING; diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index 091cfee76bd..8dbef93834b 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -208,12 +208,14 @@ static int py_cli_thread_destructor(struct py_cli_thread *t) ssize_t written; int ret; - do { - /* - * This will wake the poll thread from the poll(2) - */ - written = write(t->shutdown_pipe[1], &c, 1); - } while ((written == -1) && (errno == EINTR)); + if (t->shutdown_pipe[1] != -1) { + do { + /* + * This will wake the poll thread from the poll(2) + */ + written = write(t->shutdown_pipe[1], &c, 1); + } while ((written == -1) && (errno == EINTR)); + } /* * Allow the poll thread to do its own cleanup under the GIL diff --git a/source3/rpc_client/init_spoolss.c b/source3/rpc_client/init_spoolss.c index c341b82b6ee..a17505f592d 100644 --- a/source3/rpc_client/init_spoolss.c +++ b/source3/rpc_client/init_spoolss.c @@ -345,7 +345,7 @@ WERROR spoolss_create_default_devmode(TALLOC_CTX *mem_ctx, WERROR spoolss_create_default_secdesc(TALLOC_CTX *mem_ctx, struct spoolss_security_descriptor **secdesc) { - struct security_ace ace[7]; /* max number of ace entries */ + struct security_ace ace[7] = {0}; /* max number of ace entries */ int i = 0; uint32_t sa; struct security_acl *psa = NULL; diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index d275bdb908b..38373e96aca 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -2091,7 +2091,7 @@ static bool create_canon_ace_lists(files_struct *fsp, entry as a mask on all following allow entries. Finally, delete the Everyone DENY entry (we have applied it to everything possible). - In addition, in this pass we remove any DENY entries that have + In addition, in this pass we remove any DENY entries that have no permissions (ie. they are a DENY nothing). --------------------------------------------------------------------------- Second pass - only deal with deny user entries. @@ -2227,7 +2227,7 @@ static void process_deny_list(connection_struct *conn, canon_ace **pp_ace_list ) for (allow_ace_p = curr_ace->next; allow_ace_p; allow_ace_p = allow_ace_p->next) { - /* + /* * Only mask off allow entries. */ @@ -2456,7 +2456,7 @@ static bool unpack_canon_ace(files_struct *fsp, process_deny_list(fsp->conn, &dir_ace); /* - * A well formed POSIX file or default ACL has at least 3 entries, a + * A well formed POSIX file or default ACL has at least 3 entries, a * SMB_ACL_USER_OBJ, SMB_ACL_GROUP_OBJ, SMB_ACL_OTHER_OBJ * and optionally a mask entry. Ensure this is the case. */ @@ -2973,7 +2973,7 @@ static bool set_canon_ace_list(files_struct *fsp, } /**************************************************************************** - + ****************************************************************************/ SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl) @@ -3398,7 +3398,7 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info, Try to chown a file. We will be able to chown it under the following conditions. 1) If we have root privileges, then it will just work. - 2) If we have SeRestorePrivilege we can change the user + group to any other user. + 2) If we have SeRestorePrivilege we can change the user + group to any other user. 3) If we have SeTakeOwnershipPrivilege we can change the user to the current user. 4) If we have write permission to the file and dos_filemodes is set then allow chown to the currently authenticated user. @@ -3967,7 +3967,7 @@ static int chmod_acl_internals(SMB_ACL_T posix_acl, mode_t mode) /* * If this is a simple 3 element ACL or no elements then it's a standard - * UNIX permission set. Just use chmod... + * UNIX permission set. Just use chmod... */ if ((num_entries == 3) || (num_entries == 0)) @@ -4703,7 +4703,7 @@ static NTSTATUS make_default_acl_windows(TALLOC_CTX *ctx, { struct dom_sid owner_sid, group_sid; size_t size = 0; - struct security_ace aces[4]; + struct security_ace aces[4] = {0}; uint32_t access_mask = 0; mode_t mode = psbuf->st_ex_mode; struct security_acl *new_dacl = NULL; @@ -4775,7 +4775,7 @@ static NTSTATUS make_default_acl_everyone(TALLOC_CTX *ctx, { struct dom_sid owner_sid, group_sid; size_t size = 0; - struct security_ace aces[1]; + struct security_ace aces[1] = {0}; mode_t mode = psbuf->st_ex_mode; struct security_acl *new_dacl = NULL; int idx = 0; diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 833862ab99e..0e426876582 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -834,7 +834,7 @@ static void centry_put_uint8(struct cache_entry *centry, uint8_t v) */ static void centry_put_string(struct cache_entry *centry, const char *s) { - int len; + size_t len; if (!s) { /* null strings are marked as len 0xFFFF */ @@ -845,7 +845,8 @@ static void centry_put_string(struct cache_entry *centry, const char *s) len = strlen(s); /* can't handle more than 254 char strings. Truncating is probably best */ if (len > 254) { - DBG_DEBUG("centry_put_string: truncating len (%d) to: 254\n", len); + DBG_DEBUG("centry_put_string: truncating len (%zu) to: 254\n", + len); len = 254; } centry_put_uint8(centry, len); diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 22b94ccc944..d1dbb203c6f 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. generic testing tool - version with both SMB and SMB2 support Copyright (C) Andrew Tridgell 2003-2008 - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @@ -150,7 +150,7 @@ static bool ignore_pattern(const char *str) return false; } -/***************************************************** +/***************************************************** connect to the servers *******************************************************/ static bool connect_servers_fast(void) @@ -182,7 +182,7 @@ static bool connect_servers_fast(void) -/***************************************************** +/***************************************************** connect to the servers *******************************************************/ static bool connect_servers(struct tevent_context *ev, @@ -221,15 +221,15 @@ static bool connect_servers(struct tevent_context *ev, lpcfg_smbcli_session_options(lp_ctx, &smb_session_options); printf("Connecting to \\\\%s\\%s as %s - instance %d\n", - servers[i].server_name, servers[i].share_name, + servers[i].server_name, servers[i].share_name, cli_credentials_get_username(servers[i].credentials), j); - cli_credentials_set_workstation(servers[i].credentials, + cli_credentials_set_workstation(servers[i].credentials, "gentest", CRED_SPECIFIED); if (options.smb2) { - status = smb2_connect(NULL, servers[i].server_name, + status = smb2_connect(NULL, servers[i].server_name, lpcfg_smb_ports(lp_ctx), servers[i].share_name, lpcfg_resolve_context(lp_ctx), @@ -241,8 +241,8 @@ static bool connect_servers(struct tevent_context *ev, ); } else { status = smbcli_tree_full_connection(NULL, - &servers[i].smb_tree[j], - servers[i].server_name, + &servers[i].smb_tree[j], + servers[i].server_name, lpcfg_smb_ports(lp_ctx), servers[i].share_name, "A:", lpcfg_socket_options(lp_ctx), @@ -262,12 +262,12 @@ static bool connect_servers(struct tevent_context *ev, if (options.smb2) { servers[i].smb2_tree[j]->session->transport->oplock.handler = oplock_handler_smb2; servers[i].smb2_tree[j]->session->transport->oplock.private_data = (void *)(uintptr_t)((i<<8)|j); - smb2_transport_idle_handler(servers[i].smb2_tree[j]->session->transport, + smb2_transport_idle_handler(servers[i].smb2_tree[j]->session->transport, idle_func_smb2, 50000, NULL); } else { - smbcli_oplock_handler(servers[i].smb_tree[j]->session->transport, oplock_handler_smb, + smbcli_oplock_handler(servers[i].smb_tree[j]->session->transport, oplock_handler_smb, (void *)(uintptr_t)((i<<8)|j)); - smbcli_transport_idle_handler(servers[i].smb_tree[j]->session->transport, idle_func_smb, + smbcli_transport_idle_handler(servers[i].smb_tree[j]->session->transport, idle_func_smb, 50000, (void *)(uintptr_t)((i<<8)|j)); } } @@ -324,7 +324,7 @@ static unsigned int fnum_to_handle_smb2(int server, int instance, struct smb2_ha return i; } } - printf("Invalid server handle in fnum_to_handle on server %d instance %d\n", + printf("Invalid server handle in fnum_to_handle on server %d instance %d\n", server, instance); return BAD_HANDLE; } @@ -342,7 +342,7 @@ static unsigned int fnum_to_handle_smb(int server, int instance, uint16_t server return i; } } - printf("Invalid server handle in fnum_to_handle on server %d instance %d\n", + printf("Invalid server handle in fnum_to_handle on server %d instance %d\n", server, instance); return BAD_HANDLE; } @@ -361,7 +361,7 @@ static void gen_add_handle_smb2(int instance, const char *name, struct smb2_hand h = random() % options.max_open_handles; for (i=0;i<NSERVERS;i++) { NTSTATUS status; - status = smb2_util_close(servers[i].smb2_tree[open_handles[h].instance], + status = smb2_util_close(servers[i].smb2_tree[open_handles[h].instance], open_handles[h].smb2_handle[i]); if (NT_STATUS_IS_ERR(status)) { printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n", @@ -379,7 +379,7 @@ static void gen_add_handle_smb2(int instance, const char *name, struct smb2_hand } num_open_handles++; - printf("OPEN num_open_handles=%d h=%d (%s)\n", + printf("OPEN num_open_handles=%d h=%d (%s)\n", num_open_handles, h, name); } @@ -397,7 +397,7 @@ static void gen_add_handle_smb(int instance, const char *name, uint16_t handles[ h = random() % options.max_open_handles; for (i=0;i<NSERVERS;i++) { NTSTATUS status; - status = smbcli_close(servers[i].smb_tree[open_handles[h].instance], + status = smbcli_close(servers[i].smb_tree[open_handles[h].instance], open_handles[h].smb_handle[i]); if (NT_STATUS_IS_ERR(status)) { printf("INTERNAL ERROR: Close failed when recovering handle! - %s\n", @@ -415,7 +415,7 @@ static void gen_add_handle_smb(int instance, const char *name, uint16_t handles[ } num_open_handles++; - printf("OPEN num_open_handles=%d h=%d (%s)\n", + printf("OPEN num_open_handles=%d h=%d (%s)\n", num_open_handles, h, name); } @@ -429,10 +429,10 @@ static void gen_remove_handle_smb2(int instance, struct smb2_handle handles[NSER for (h=0;h<options.max_open_handles;h++) { if (instance == open_handles[h].instance && smb2_handle_equal(&open_handles[h].smb2_handle[0], &handles[0])) { - open_handles[h].active = false; + open_handles[h].active = false; num_open_handles--; - printf("CLOSE num_open_handles=%d h=%d (%s)\n", - num_open_handles, h, + printf("CLOSE num_open_handles=%d h=%d (%s)\n", + num_open_handles, h, open_handles[h].name); return; } @@ -450,10 +450,10 @@ static void gen_remove_handle_smb(int instance, uint16_t handles[NSERVERS]) for (h=0;h<options.max_open_handles;h++) { if (instance == open_handles[h].instance && open_handles[h].smb_handle[0] == handles[0]) { - open_handles[h].active = false; + open_handles[h].active = false; num_open_handles--; - printf("CLOSE num_open_handles=%d h=%d (%s)\n", - num_open_handles, h, + printf("CLOSE num_open_handles=%d h=%d (%s)\n", + num_open_handles, h, open_handles[h].name); return; } @@ -500,7 +500,7 @@ static uint16_t gen_fnum(int instance) while (num_open_handles > 0 && count++ < 10*options.max_open_handles) { h = random() % options.max_open_handles; - if (open_handles[h].active && + if (open_handles[h].active && open_handles[h].instance == instance) { return h; } @@ -565,28 +565,28 @@ static int gen_io_count(void) */ static const char *gen_fname(void) { - const char *names[] = {"gentest\\gentest.dat", - "gentest\\foo", - "gentest\\foo2.sym", - "gentest\\foo3.dll", - "gentest\\foo4", - "gentest\\foo4:teststream1", - "gentest\\foo4:teststream2", - "gentest\\foo5.exe", - "gentest\\foo5.exe:teststream3", - "gentest\\foo5.exe:teststream4", - "gentest\\foo6.com", - "gentest\\blah", - "gentest\\blah\\blergh.txt", - "gentest\\blah\\blergh2", - "gentest\\blah\\blergh3.txt", - "gentest\\blah\\blergh4", - "gentest\\blah\\blergh5.txt", - "gentest\\blah\\blergh5", - "gentest\\blah\\.", - "gentest\\blah\\..", - "gentest\\a_very_long_name.bin", - "gentest\\x.y", + const char *names[] = {"gentest\\gentest.dat", + "gentest\\foo", + "gentest\\foo2.sym", + "gentest\\foo3.dll", + "gentest\\foo4", + "gentest\\foo4:teststream1", + "gentest\\foo4:teststream2", + "gentest\\foo5.exe", + "gentest\\foo5.exe:teststream3", + "gentest\\foo5.exe:teststream4", + "gentest\\foo6.com", + "gentest\\blah", + "gentest\\blah\\blergh.txt", + "gentest\\blah\\blergh2", + "gentest\\blah\\blergh3.txt", + "gentest\\blah\\blergh4", + "gentest\\blah\\blergh5.txt", + "gentest\\blah\\blergh5", + "gentest\\blah\\.", + "gentest\\blah\\..", + "gentest\\a_very_long_name.bin", + "gentest\\x.y", "gentest\\blah"}; int i; @@ -598,7 +598,7 @@ static const char *gen_fname(void) } /* - generate a filename with a higher chance of choosing an already + generate a filename with a higher chance of choosing an already open file */ static const char *gen_fname_open(int instance) @@ -617,11 +617,11 @@ static const char *gen_fname_open(int instance) static const char *gen_pattern(void) { int i; - const char *names[] = {"gentest\\*.dat", - "gentest\\*", - "gentest\\*.*", - "gentest\\blah\\*.*", - "gentest\\blah\\*", + const char *names[] = {"gentest\\*.dat", + "gentest\\*", + "gentest\\*.*", + "gentest\\blah\\*.*", + "gentest\\blah\\*", "gentest\\?"}; if (gen_chance(50)) return gen_fname(); @@ -720,7 +720,7 @@ static uint16_t gen_rename_flags(void) } /* - generate a pid + generate a pid */ static uint16_t gen_pid(void) { @@ -736,8 +736,8 @@ static uint16_t gen_lock_flags_smb2(void) if (!options.valid && gen_chance(5)) return gen_bits_mask(0xFFFF); if (gen_chance(20)) return gen_bits_mask(0x1F); if (gen_chance(50)) return SMB2_LOCK_FLAG_UNLOCK; - return gen_bits_mask(SMB2_LOCK_FLAG_SHARED | - SMB2_LOCK_FLAG_EXCLUSIVE | + return gen_bits_mask(SMB2_LOCK_FLAG_SHARED | + SMB2_LOCK_FLAG_EXCLUSIVE | SMB2_LOCK_FLAG_FAIL_IMMEDIATELY); } @@ -904,17 +904,17 @@ static unsigned int gen_alloc_size(void) static struct ea_struct gen_ea_struct(void) { struct ea_struct ea; - const char *names[] = {"EAONE", - "", - "FOO!", - " WITH SPACES ", - ".", + const char *names[] = {"EAONE", + "", + "FOO!", + " WITH SPACES ", + ".", "AVERYLONGATTRIBUTENAME"}; - const char *values[] = {"VALUE1", - "", - "NOT MUCH FOO", - " LEADING SPACES ", - ":", + const char *values[] = {"VALUE1", + "", + "NOT MUCH FOO", + " LEADING SPACES ", + ":", "ASOMEWHATLONGERATTRIBUTEVALUE"}; int i; @@ -1087,7 +1087,7 @@ static void oplock_handler_ack_callback_smb2(struct smb2_request *req) } } -static bool send_oplock_ack_smb2(struct smb2_tree *tree, struct smb2_handle handle, +static bool send_oplock_ack_smb2(struct smb2_tree *tree, struct smb2_handle handle, uint8_t level) { struct smb2_break br; @@ -1109,7 +1109,7 @@ static bool send_oplock_ack_smb2(struct smb2_tree *tree, struct smb2_handle hand /* the oplock handler will either ack the break or close the file */ -static bool oplock_handler_smb2(struct smb2_transport *transport, const struct smb2_handle *handle, +static bool oplock_handler_smb2(struct smb2_transport *transport, const struct smb2_handle *handle, uint8_t level, void *private_data) { struct smb2_close io; @@ -1209,8 +1209,8 @@ static bool compare_status(NTSTATUS status1, NTSTATUS status2) /* also support ignore patterns of the form NT_STATUS_XX:NT_STATUS_YY meaning that the first server returns NT_STATUS_XX and the 2nd returns NT_STATUS_YY */ - s = talloc_asprintf(current_op.mem_ctx, "%s:%s", - nt_errstr(status1), + s = talloc_asprintf(current_op.mem_ctx, "%s:%s", + nt_errstr(status1), nt_errstr(status2)); if (ignore_pattern(s)) { -- Samba Shared Repository