The branch, master has been updated via 16d32aa2562 libsmb: Modernize two DEBUGs via 09b06a452e3 winbind: Fix a few Coverity complaints via 14d7c02a1c8 smbd: Modernize a few DEBUGs via a33cf4c3e7e lib: Fix whitespace via 0a0abbf2939 lib: Save lines by avoiding explicit ZERO_STRUCTP calls via 8a59c1c954c libsmb: Put useccache initialization into one place via 3bf131965dc lsa_server4: Fix comments via 41e98406c80 libsmb: Avoid an "else" via c0955c0feed smbd: Modernize DEBUGs via 10911c5a6fa libsmb: Avoid a "else" in cli_read_max_bufsize() via c55df956bfb lib: Modernize a few DEBUGs via 3d0371937f4 libsmb: Remove an unused variable via 21633bdbbd3 libsmb: Move 192 bytes from R/W .data to R/O (shared) .text via fb0524d26dd libsmb: Reduce indentation in SMBC_attr_server() via dde86a29c5c libsmb: Reduce indentation in SMBC_find_server() via b6f4a56f34e libsmb: Simplify cli_smb2_list_send() via f9e0d008d6e libsmb: Remove a redundant tevent_req_nterror() via 1a11f1dcc6a libsmb: Reduce indentation in SMBC_check_server() with a "goto done" via 38e026d68a8 libsmb: Reduce indentation in SMBC_check_server() with an early return via fd7ecf098d9 libsmb: Introduce a helper var in SMBC_check_server() via 1519fe8f699 libsmb: Introduce a helper var in SMBC_check_server() via 3a21d0ec631 libsmb: Fix a nomem return from cli_smb2_list_send() via 90de6c2d4d9 utils: Fix a comment via e05b7014e53 libsmb: Save errno across TALLOC_FREE in a few places via 69feb82144b libsmb: Simplify SMBC_creat_ctx() via 452dc137866 auth: Reduce indentation via 388be77b143 libsmb: Slightly simplify libsmb_xattr via e71b9dda99b libsmb: Simplify net_share_enum_rpc() with a direct struct initialization via 737f4583ca8 libsmb: Save a few lines of ZERO_STRUCTP with SMB_CALLOC_ARRAY via 38be1103a4c vfs: Fix some whitespace via 8d5f03956eb smbd: Replace talloc_zero() with a struct initialization via f6695a5bb9a libsmb: Reduce indentation in SMB_open_ctx() from fb485544f8a gitlab-ci: add ubuntu2404
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 16d32aa2562ee19d08e0986a5dcbea58a4583a3f Author: Volker Lendecke <v...@samba.org> Date: Mon Apr 7 10:47:23 2025 +0200 libsmb: Modernize two DEBUGs Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Volker Lendecke <v...@samba.org> Autobuild-Date(master): Thu May 15 15:06:36 UTC 2025 on atb-devel-224 commit 09b06a452e35b4f15480e31a20c665bb99ba9c12 Author: Volker Lendecke <v...@samba.org> Date: Wed Apr 2 09:34:57 2025 +0200 winbind: Fix a few Coverity complaints Coverity correctly complains that we pass time_t into a uint32_t. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 14d7c02a1c8b2deacc3cdf61e772fcbde8ace2fd Author: Volker Lendecke <v...@samba.org> Date: Mon Apr 7 15:28:14 2025 +0200 smbd: Modernize a few DEBUGs Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit a33cf4c3e7eb808cb5825d92ab59c00fef31be29 Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 8 11:46:38 2025 +0200 lib: Fix whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 0a0abbf2939bac2ffcf340aab35b9b1b98bcac96 Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 4 12:24:59 2025 +0200 lib: Save lines by avoiding explicit ZERO_STRUCTP calls SMB_CALLOC_ARRAY(..., 1) does this. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 8a59c1c954c5c2b33a8b25704583bd5f31081862 Author: Volker Lendecke <v...@samba.org> Date: Thu Apr 24 12:04:46 2025 +0200 libsmb: Put useccache initialization into one place Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 3bf131965dc381357ea8d437561f8c8a30b97686 Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 10:53:25 2025 +0200 lsa_server4: Fix comments Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 41e98406c808abbb1a24456a06f43f735cc32c1a Author: Volker Lendecke <v...@samba.org> Date: Thu May 8 18:00:34 2025 +0200 libsmb: Avoid an "else" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit c0955c0feed749075ed3380c8c9b1865d3fa6086 Author: Volker Lendecke <v...@samba.org> Date: Thu May 8 13:57:25 2025 +0200 smbd: Modernize DEBUGs Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 10911c5a6fafd583cc83d9021e6871cf835ca36d Author: Volker Lendecke <v...@samba.org> Date: Thu May 8 13:47:37 2025 +0200 libsmb: Avoid a "else" in cli_read_max_bufsize() Simpler to read for me. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit c55df956bfba1321e0919bd318036289a6ed296b Author: Volker Lendecke <v...@samba.org> Date: Wed May 7 15:45:53 2025 +0200 lib: Modernize a few DEBUGs Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 3d0371937f4d158feee75b5f49fc3776c8b5722b Author: Volker Lendecke <v...@samba.org> Date: Tue May 6 17:06:39 2025 +0200 libsmb: Remove an unused variable Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 21633bdbbd3bce3e39b11924e42c2d3eef47bc75 Author: Volker Lendecke <v...@samba.org> Date: Tue May 6 13:52:57 2025 +0200 libsmb: Move 192 bytes from R/W .data to R/O (shared) .text Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit fb0524d26dd504e4b411a709d321eb96a587fdff Author: Volker Lendecke <v...@samba.org> Date: Tue May 6 13:18:30 2025 +0200 libsmb: Reduce indentation in SMBC_attr_server() Use an early return Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit dde86a29c5c325899575f36f0105ed55e32ebb5d Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 15:55:13 2025 +0200 libsmb: Reduce indentation in SMBC_find_server() Use an early return Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit b6f4a56f34efd15727970bd22c504bb0254d40a0 Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 14:05:03 2025 +0200 libsmb: Simplify cli_smb2_list_send() Use make_smb2_posix_create_ctx() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit f9e0d008d6ebac9388c28a00df7963ff0418dc39 Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 14:02:39 2025 +0200 libsmb: Remove a redundant tevent_req_nterror() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 1a11f1dcc6a35c30e992f80d8a70bb0bc452ad90 Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 12:47:07 2025 +0200 libsmb: Reduce indentation in SMBC_check_server() with a "goto done" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 38e026d68a8d2bcd964032d1abc4bc12afabbce7 Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 12:43:58 2025 +0200 libsmb: Reduce indentation in SMBC_check_server() with an early return Best reviewed with "git show -b" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit fd7ecf098d9d875a74d8b8975a38cc919239b82d Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 12:41:51 2025 +0200 libsmb: Introduce a helper var in SMBC_check_server() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 1519fe8f6999f671bbcd604ac44106155c66f213 Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 12:40:35 2025 +0200 libsmb: Introduce a helper var in SMBC_check_server() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 3a21d0ec63136f5f22482d68afab0b04a5df0304 Author: Volker Lendecke <v...@samba.org> Date: Mon May 5 11:07:08 2025 +0200 libsmb: Fix a nomem return from cli_smb2_list_send() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 90de6c2d4d9a84c3a2d5c0703dc62882e0589e50 Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 29 14:03:41 2025 +0200 utils: Fix a comment Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit e05b7014e536317565ce99d50069f16414755547 Author: Volker Lendecke <v...@samba.org> Date: Mon Apr 28 14:48:16 2025 +0200 libsmb: Save errno across TALLOC_FREE in a few places Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 69feb82144b7d6f8bb19bee4b67662950025388b Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 25 17:12:30 2025 +0200 libsmb: Simplify SMBC_creat_ctx() The same is also checked in SMBC_open_ctx() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 452dc137866d0dac555870ec7718e2676ab33f08 Author: Volker Lendecke <v...@samba.org> Date: Thu Apr 3 17:14:42 2025 +0200 auth: Reduce indentation Best reviewed with "git sh -b" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 388be77b143cb74e886f8631b78520a45aa95ba1 Author: Volker Lendecke <v...@samba.org> Date: Thu Apr 3 11:41:24 2025 +0200 libsmb: Slightly simplify libsmb_xattr We have str[n]equal() for this Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit e71b9dda99b1f2e671d4c6e127c1400ff625d10d Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 25 16:07:20 2025 +0200 libsmb: Simplify net_share_enum_rpc() with a direct struct initialization Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 737f4583ca8db452d9ef294527c48487a55db915 Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 25 16:06:08 2025 +0200 libsmb: Save a few lines of ZERO_STRUCTP with SMB_CALLOC_ARRAY Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 38be1103a4cc90af7d3b8c631b51ed8f66a0c0e2 Author: Volker Lendecke <v...@samba.org> Date: Fri Apr 25 09:38:59 2025 +0200 vfs: Fix some whitespace Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 8d5f03956eb9e0ecc621a86acbc1e71389f0bdf8 Author: Volker Lendecke <v...@samba.org> Date: Tue Apr 8 09:49:17 2025 +0200 smbd: Replace talloc_zero() with a struct initialization Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit f6695a5bb9a6b57268d2c16e45e07de0dd911316 Author: Volker Lendecke <v...@samba.org> Date: Wed May 7 14:25:01 2025 +0200 libsmb: Reduce indentation in SMB_open_ctx() The "else" branch does not fall through to the opendir-retry. Best reviewed with "git sh -b". Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: auth/credentials/credentials_ntlm.c | 156 ++++++++-------- lib/tdb_wrap/tdb_wrap.h | 8 +- libcli/smb/smbXcli_base.c | 2 +- source3/auth/pampass.c | 4 +- source3/lib/interface.c | 4 +- source3/lib/util.c | 20 +- source3/libsmb/cli_smb2_fnum.c | 13 +- source3/libsmb/clidfs.c | 9 +- source3/libsmb/clireadwrite.c | 4 +- source3/libsmb/libsmb_context.c | 17 +- source3/libsmb/libsmb_dir.c | 198 ++++++++++---------- source3/libsmb/libsmb_file.c | 234 +++++++++++------------ source3/libsmb/libsmb_server.c | 327 ++++++++++++++++----------------- source3/libsmb/libsmb_stat.c | 26 ++- source3/libsmb/libsmb_xattr.c | 289 ++++++++++++++--------------- source3/modules/vfs_fake_acls.c | 14 +- source3/modules/vfs_readahead.c | 3 +- source3/modules/vfs_shadow_copy.c | 4 +- source3/printing/printing_db.c | 3 +- source3/registry/regfio.c | 3 +- source3/smbd/fd_handle.c | 4 +- source3/smbd/smb2_ioctl_filesys.c | 20 +- source3/smbd/smb2_trans2.c | 7 +- source3/utils/smbcacls.c | 2 +- source3/winbindd/winbindd_cache.c | 4 +- source3/winbindd/winbindd_cred_cache.c | 33 ++-- source3/winbindd/winbindd_dual.c | 2 +- source4/rpc_server/lsa/dcesrv_lsa.c | 4 +- 28 files changed, 692 insertions(+), 722 deletions(-) Changeset truncated at 500 lines: diff --git a/auth/credentials/credentials_ntlm.c b/auth/credentials/credentials_ntlm.c index a018be14c56..002ce4bd060 100644 --- a/auth/credentials/credentials_ntlm.c +++ b/auth/credentials/credentials_ntlm.c @@ -353,47 +353,47 @@ _PUBLIC_ bool cli_credentials_set_utf16_password(struct cli_credentials *cred, const DATA_BLOB *password_utf16, enum credentials_obtained obtained) { + struct samr_Password *nt_hash = NULL; + char *password_talloc = NULL; + size_t password_len = 0; + bool ok; + cred->password_will_be_nt_hash = false; if (password_utf16 == NULL) { return cli_credentials_set_password(cred, NULL, obtained); } - if (obtained >= cred->password_obtained) { - struct samr_Password *nt_hash = NULL; - char *password_talloc = NULL; - size_t password_len = 0; - bool ok; - - nt_hash = talloc(cred, struct samr_Password); - if (nt_hash == NULL) { - return false; - } + if (obtained < cred->password_obtained) { + return false; + } - ok = convert_string_talloc(cred, - CH_UTF16MUNGED, CH_UTF8, - password_utf16->data, - password_utf16->length, - &password_talloc, - &password_len); - if (!ok) { - TALLOC_FREE(nt_hash); - return false; - } + nt_hash = talloc(cred, struct samr_Password); + if (nt_hash == NULL) { + return false; + } - ok = cli_credentials_set_password(cred, password_talloc, obtained); - TALLOC_FREE(password_talloc); - if (!ok) { - TALLOC_FREE(nt_hash); - return false; - } + ok = convert_string_talloc(cred, + CH_UTF16MUNGED, CH_UTF8, + password_utf16->data, + password_utf16->length, + &password_talloc, + &password_len); + if (!ok) { + TALLOC_FREE(nt_hash); + return false; + } - mdfour(nt_hash->hash, password_utf16->data, password_utf16->length); - cred->nt_hash = nt_hash; - return true; + ok = cli_credentials_set_password(cred, password_talloc, obtained); + TALLOC_FREE(password_talloc); + if (!ok) { + TALLOC_FREE(nt_hash); + return false; } - return false; + mdfour(nt_hash->hash, password_utf16->data, password_utf16->length); + cred->nt_hash = nt_hash; + return true; } /* @@ -469,21 +469,21 @@ _PUBLIC_ bool cli_credentials_set_nt_hash(struct cli_credentials *cred, { cred->password_will_be_nt_hash = false; - if (obtained >= cred->password_obtained) { - cli_credentials_set_password(cred, NULL, obtained); - if (nt_hash) { - cred->nt_hash = talloc(cred, struct samr_Password); - if (cred->nt_hash == NULL) { - return false; - } - *cred->nt_hash = *nt_hash; - } else { - cred->nt_hash = NULL; - } - return true; + if (obtained < cred->password_obtained) { + return false; } - return false; + cli_credentials_set_password(cred, NULL, obtained); + if (nt_hash) { + cred->nt_hash = talloc(cred, struct samr_Password); + if (cred->nt_hash == NULL) { + return false; + } + *cred->nt_hash = *nt_hash; + } else { + cred->nt_hash = NULL; + } + return true; } _PUBLIC_ bool cli_credentials_set_old_nt_hash(struct cli_credentials *cred, @@ -510,51 +510,51 @@ _PUBLIC_ bool cli_credentials_set_ntlm_response(struct cli_credentials *cred, const DATA_BLOB *nt_session_key, enum credentials_obtained obtained) { - if (obtained >= cred->password_obtained) { - cli_credentials_set_password(cred, NULL, obtained); - - data_blob_clear_free(&cred->lm_response); - data_blob_clear_free(&cred->lm_session_key); - data_blob_clear_free(&cred->nt_response); - data_blob_clear_free(&cred->nt_session_key); - - if (lm_response != NULL && lm_response->length != 0) { - cred->lm_response = data_blob_talloc(cred, - lm_response->data, - lm_response->length); - if (cred->lm_response.data == NULL) { - return false; - } + if (obtained < cred->password_obtained) { + return false; + } + + cli_credentials_set_password(cred, NULL, obtained); + + data_blob_clear_free(&cred->lm_response); + data_blob_clear_free(&cred->lm_session_key); + data_blob_clear_free(&cred->nt_response); + data_blob_clear_free(&cred->nt_session_key); + + if (lm_response != NULL && lm_response->length != 0) { + cred->lm_response = data_blob_talloc(cred, + lm_response->data, + lm_response->length); + if (cred->lm_response.data == NULL) { + return false; } - if (lm_session_key != NULL && lm_session_key->length != 0) { - cred->lm_session_key = data_blob_talloc(cred, + } + if (lm_session_key != NULL && lm_session_key->length != 0) { + cred->lm_session_key = data_blob_talloc(cred, lm_session_key->data, lm_session_key->length); - if (cred->lm_session_key.data == NULL) { - return false; - } + if (cred->lm_session_key.data == NULL) { + return false; } + } - if (nt_response != NULL && nt_response->length != 0) { - cred->nt_response = data_blob_talloc(cred, - nt_response->data, - nt_response->length); - if (cred->nt_response.data == NULL) { - return false; - } + if (nt_response != NULL && nt_response->length != 0) { + cred->nt_response = data_blob_talloc(cred, + nt_response->data, + nt_response->length); + if (cred->nt_response.data == NULL) { + return false; } - if (nt_session_key != NULL && nt_session_key->length != 0) { - cred->nt_session_key = data_blob_talloc(cred, + } + if (nt_session_key != NULL && nt_session_key->length != 0) { + cred->nt_session_key = data_blob_talloc(cred, nt_session_key->data, nt_session_key->length); - if (cred->nt_session_key.data == NULL) { - return false; - } + if (cred->nt_session_key.data == NULL) { + return false; } - - return true; } - return false; + return true; } diff --git a/lib/tdb_wrap/tdb_wrap.h b/lib/tdb_wrap/tdb_wrap.h index de7e332bdb9..877d10a8e1c 100644 --- a/lib/tdb_wrap/tdb_wrap.h +++ b/lib/tdb_wrap/tdb_wrap.h @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. database wrap headers Copyright (C) Andrew Tridgell 2004 - + 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/>. */ diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c index eecd73d0678..d1e36a3fa1e 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -4236,7 +4236,7 @@ NTSTATUS smb2cli_req_get_sent_iov(struct tevent_req *req, static const struct { enum protocol_types proto; - const char *smb1_name; + const char smb1_name[24]; /* strlen("MICROSOFT NETWORKS 1.03") == 23 */ } smb1cli_prots[] = { {PROTOCOL_CORE, "PC NETWORK PROGRAM 1.0"}, {PROTOCOL_COREPLUS, "MICROSOFT NETWORKS 1.03"}, diff --git a/source3/auth/pampass.c b/source3/auth/pampass.c index 0be7f9f9d1f..03d2fe69286 100644 --- a/source3/auth/pampass.c +++ b/source3/auth/pampass.c @@ -236,15 +236,13 @@ static struct chat_struct *make_pw_chat(const char *p) TALLOC_CTX *frame = talloc_stackframe(); while (1) { - t = SMB_MALLOC_P(struct chat_struct); + t = SMB_CALLOC_ARRAY(struct chat_struct, 1); if (!t) { DEBUG(0,("make_pw_chat: malloc failed!\n")); TALLOC_FREE(frame); return NULL; } - ZERO_STRUCTP(t); - DLIST_ADD_END(list, t); if (!next_token_talloc(frame, &p, &prompt, NULL)) { diff --git a/source3/lib/interface.c b/source3/lib/interface.c index 5f351999e41..4fbc17cccb7 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -319,13 +319,11 @@ static void add_interface(const struct iface_struct *ifs) return; } - iface = SMB_MALLOC_P(struct interface); + iface = SMB_CALLOC_ARRAY(struct interface, 1); if (!iface) { return; } - ZERO_STRUCTPN(iface); - iface->name = SMB_STRDUP(ifs->name); if (!iface->name) { SAFE_FREE(iface); diff --git a/source3/lib/util.c b/source3/lib/util.c index 8f9b2ec424a..8f6b8634b21 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1604,10 +1604,10 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname, uint32_t create_options = FILE_NON_DIRECTORY_FILE; uint32_t private_flags = 0; - DEBUG(10,("map_open_params_to_ntcreate: fname = %s, deny_mode = 0x%x, " - "open_func = 0x%x\n", - smb_base_fname, (unsigned int)deny_mode, - (unsigned int)open_func )); + DBG_DEBUG("fname = %s, deny_mode = 0x%x, open_func = 0x%x\n", + smb_base_fname, + (unsigned int)deny_mode, + (unsigned int)open_func); /* Create the NT compatible access_mask. */ switch (GET_OPENX_MODE(deny_mode)) { @@ -1623,8 +1623,8 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname, access_mask = FILE_GENERIC_READ|FILE_GENERIC_WRITE; break; default: - DEBUG(10,("map_open_params_to_ntcreate: bad open mode = 0x%x\n", - (unsigned int)GET_OPENX_MODE(deny_mode))); + DBG_DEBUG("bad open mode = 0x%x\n", + (unsigned int)GET_OPENX_MODE(deny_mode)); return False; } @@ -1656,8 +1656,8 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname, create_disposition = FILE_CREATE; break; } - DEBUG(10,("map_open_params_to_ntcreate: bad " - "open_func 0x%x\n", (unsigned int)open_func)); + DBG_DEBUG("bad open_func 0x%x\n", + (unsigned int)open_func); return False; } @@ -1703,7 +1703,7 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname, return False; } - DEBUG(10,("map_open_params_to_ntcreate: file %s, access_mask = 0x%x, " + DBG_DEBUG("file %s, access_mask = 0x%x, " "share_mode = 0x%x, create_disposition = 0x%x, " "create_options = 0x%x private_flags = 0x%x\n", smb_base_fname, @@ -1711,7 +1711,7 @@ bool map_open_params_to_ntcreate(const char *smb_base_fname, (unsigned int)share_mode, (unsigned int)create_disposition, (unsigned int)create_options, - (unsigned int)private_flags)); + (unsigned int)private_flags); if (paccess_mask) { *paccess_mask = access_mask; diff --git a/source3/libsmb/cli_smb2_fnum.c b/source3/libsmb/cli_smb2_fnum.c index 155bc6ae353..dcd6aa50c58 100644 --- a/source3/libsmb/cli_smb2_fnum.c +++ b/source3/libsmb/cli_smb2_fnum.c @@ -1544,19 +1544,8 @@ struct tevent_req *cli_smb2_list_send( /* The mode MUST be 0 when opening an existing file/dir, and * will be ignored by the server. */ - uint8_t linear_mode[4] = { 0 }; - DATA_BLOB blob = { .data=linear_mode, - .length=sizeof(linear_mode) }; - - in_cblobs = talloc_zero(mem_ctx, struct smb2_create_blobs); - if (in_cblobs == NULL) { - return NULL; - } - - status = smb2_create_blob_add(in_cblobs, in_cblobs, - SMB2_CREATE_TAG_POSIX, blob); + status = make_smb2_posix_create_ctx(mem_ctx, &in_cblobs, 0); if (tevent_req_nterror(req, status)) { - tevent_req_nterror(req, status); return tevent_req_post(req, ev); } } diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 69d49c243f8..cafb1b421a6 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -150,7 +150,6 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, enum smb_encryption_setting encryption_state = cli_credentials_get_smb_encryption(creds); struct smb2_negotiate_contexts *in_contexts = NULL; - struct smb2_negotiate_contexts *out_contexts = NULL; if (encryption_state >= SMB_ENCRYPTION_DESIRED) { signing_state = SMB_SIGNING_REQUIRED; @@ -226,8 +225,8 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, lp_client_min_protocol(), lp_client_max_protocol(), in_contexts, - ctx, - &out_contexts); + NULL, + NULL); TALLOC_FREE(in_contexts); if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { @@ -236,7 +235,9 @@ static NTSTATUS do_connect(TALLOC_CTX *ctx, smbXcli_conn_remote_name(c->conn)); cli_shutdown(c); return status; - } else if (!NT_STATUS_IS_OK(status)) { + } + + if (!NT_STATUS_IS_OK(status)) { d_printf("Protocol negotiation to server %s (for a protocol between %s and %s) failed: %s\n", smbXcli_conn_remote_name(c->conn), lpcfg_get_smb_protocol(lp_client_min_protocol()), diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 16419052b74..0dfcd479cc0 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -53,7 +53,9 @@ static size_t cli_read_max_bufsize(struct cli_state *cli) } return useable_space; - } else if (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_READX) { + } + + if (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_READX) { /* * Note: CAP_LARGE_READX also works with signing */ diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index 97a4430fd6a..55847f6b970 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -149,16 +149,14 @@ smbc_new_context(void) * All newly added context fields should be placed in * SMBC_internal_data, not directly in SMBCCTX. */ - context = SMB_MALLOC_P(SMBCCTX); + context = SMB_CALLOC_ARRAY(SMBCCTX, 1); if (!context) { TALLOC_FREE(frame); errno = ENOMEM; return NULL; } - ZERO_STRUCTP(context); - - context->internal = SMB_MALLOC_P(struct SMBC_internal_data); + context->internal = SMB_CALLOC_ARRAY(struct SMBC_internal_data, 1); if (!context->internal) { TALLOC_FREE(frame); SAFE_FREE(context); @@ -166,9 +164,6 @@ smbc_new_context(void) return NULL; } - /* Initialize the context and establish reasonable defaults */ - ZERO_STRUCTP(context->internal); - context->internal->lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers()); if (context->internal->lp_ctx == NULL) { @@ -186,15 +181,15 @@ smbc_new_context(void) smbc_setOptionFullTimeNames(context, False); smbc_setOptionOpenShareMode(context, SMBC_SHAREMODE_DENY_NONE); smbc_setOptionSmbEncryptionLevel(context, SMBC_ENCRYPTLEVEL_DEFAULT); - smbc_setOptionUseCCache(context, True); + { + bool no_ccache = (getenv("LIBSMBCLIENT_NO_CCACHE") == NULL); + smbc_setOptionUseCCache(context, !no_ccache); + } smbc_setOptionCaseSensitive(context, False); smbc_setOptionBrowseMaxLmbCount(context, 3); /* # LMBs to query */ smbc_setOptionUrlEncodeReaddirEntries(context, False); smbc_setOptionOneSharePerServer(context, False); smbc_setOptionPosixExtensions(context, false); - if (getenv("LIBSMBCLIENT_NO_CCACHE") != NULL) { - smbc_setOptionUseCCache(context, false); - } smbc_setFunctionAuthData(context, SMBC_get_auth_data); smbc_setFunctionCheckServer(context, SMBC_check_server); diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index 1bcf5f1b475..1d2743df56b 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -111,30 +111,26 @@ add_dirent(SMBCFILE *dir, if (dir->dir_list == NULL) { - dir->dir_list = SMB_MALLOC_P(struct smbc_dir_list); + dir->dir_list = SMB_CALLOC_ARRAY(struct smbc_dir_list, 1); if (!dir->dir_list) { SAFE_FREE(dirent); dir->dir_error = ENOMEM; return -1; - } - ZERO_STRUCTP(dir->dir_list); dir->dir_end = dir->dir_next = dir->dir_list; } else { - dir->dir_end->next = SMB_MALLOC_P(struct smbc_dir_list); + dir->dir_end->next = SMB_CALLOC_ARRAY(struct smbc_dir_list, 1); if (!dir->dir_end->next) { -- Samba Shared Repository