The branch, master has been updated
via d9b02758d2e test: Fix a typo
via 96c88431e06 tests: Fix a comment
via 3859156fd84 smbd: Simplify smb_q_posix_symlink()
via eb8968534dd libnet3: Fix Coverity ID 1034874 Resource leak
via 644a44656c2 ntvfs: Fix Coverity ID 240792 Uninitialized scalar
variable
via ceb6112b6f8 ntvfs: Fix Coverity ID 240791 Uninitialized scalar
variable
via dcf69bc06c1 ntlm_auth: Fix Coverity ID 240750 Resource leak
via 9900bb45550 ntlm_auth: Fix Coverity ID 240749 Resource leak
via f6efb5a653c ntlm_auth: Fix Coverity ID 240748 Resource leak
via 2e111267acb ntlm_auth: Fix Coverity ID 240747 Resource leak
via 3e6f2e6cbc0 ntlm_auth: Fix Coverity ID 240743 Resource leak
via 7f29caf599d libcli: Simplify debug_conditional_ace()
via 5aa0cb0ea49 smbpasswd4: Simplify smbpasswd_sethexpwd()
via ffc676dd875 smbd: Early talloc_free in an error case
via 63f380058f4 libsmb: Save some .data bytes with a const array
via 79d3b504ce2 tests: Use unix_mode_to_wire() in smb3unix tests
via d4c13988c96 smbd: Simplify smbd_do_qfilepathinfo()
from f86d1a35917 smbd: avoid a panic in close_directory()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d9b02758d2e7f5f5bd4515071ba275062b0d7215
Author: Volker Lendecke <[email protected]>
Date: Thu Dec 28 13:39:40 2023 +0100
test: Fix a typo
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
Autobuild-User(master): Ralph Böhme <[email protected]>
Autobuild-Date(master): Tue Nov 19 19:24:16 UTC 2024 on atb-devel-224
commit 96c88431e0648ce0d29bb2809f2fcfd1704dae6a
Author: Volker Lendecke <[email protected]>
Date: Fri Dec 22 13:54:34 2023 +0100
tests: Fix a comment
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 3859156fd842c55ba2a8eb8d730174a9e66fb6b7
Author: Volker Lendecke <[email protected]>
Date: Wed Nov 13 15:57:41 2024 +0100
smbd: Simplify smb_q_posix_symlink()
Use the lcomp from filename_convert_dirfsp_rel()
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit eb8968534dd53fa911f33ed500618787b23c6e14
Author: Volker Lendecke <[email protected]>
Date: Fri Nov 15 11:17:42 2024 +0100
libnet3: Fix Coverity ID 1034874 Resource leak
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 644a44656c23f7a280f128e845271794b33d9f58
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 21:07:30 2024 +0100
ntvfs: Fix Coverity ID 240792 Uninitialized scalar variable
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit ceb6112b6f8b2b5f91393695a024326d93929b7a
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 21:06:09 2024 +0100
ntvfs: Fix Coverity ID 240791 Uninitialized scalar variable
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit dcf69bc06c1dcd94159621339b6987d4fb2a42e7
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 21:04:02 2024 +0100
ntlm_auth: Fix Coverity ID 240750 Resource leak
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 9900bb45550ece6010626cc502cf89a98a4e8f28
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 21:03:02 2024 +0100
ntlm_auth: Fix Coverity ID 240749 Resource leak
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit f6efb5a653cefe5053e54f708ab1e65b18cbec81
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 21:02:09 2024 +0100
ntlm_auth: Fix Coverity ID 240748 Resource leak
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 2e111267acbba8afc9aafda288fce90034d95e98
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 21:00:07 2024 +0100
ntlm_auth: Fix Coverity ID 240747 Resource leak
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 3e6f2e6cbc0f9553c06e1697cd1c5ee025d09c11
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 20:47:53 2024 +0100
ntlm_auth: Fix Coverity ID 240743 Resource leak
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 7f29caf599d2c657641c2e775c0dcb9db5f69919
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 20:52:03 2024 +0100
libcli: Simplify debug_conditional_ace()
Move a variable declaration to its only user
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 5aa0cb0ea490a426dd9e8a581ee408d7f3a35340
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 14 20:48:14 2024 +0100
smbpasswd4: Simplify smbpasswd_sethexpwd()
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit ffc676dd8754ba62bafb3cea83cd4946e6617710
Author: Volker Lendecke <[email protected]>
Date: Fri Oct 4 13:39:18 2024 +0200
smbd: Early talloc_free in an error case
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 63f380058f419febb92c15319e3e40cf094ae0b9
Author: Volker Lendecke <[email protected]>
Date: Mon Nov 18 12:20:19 2024 +0100
libsmb: Save some .data bytes with a const array
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit 79d3b504ce2cb85cdc368be13d0f42e79c18750a
Author: Volker Lendecke <[email protected]>
Date: Sat Sep 21 03:38:24 2024 +0200
tests: Use unix_mode_to_wire() in smb3unix tests
Also add the file type. Not really relevant in create, IMHO it looks
nicer in the code.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
commit d4c13988c963efe2d82222235791649f0510134f
Author: Volker Lendecke <[email protected]>
Date: Thu Nov 2 09:13:51 2023 +0100
smbd: Simplify smbd_do_qfilepathinfo()
fdos_mode(fsp) unconditionally dereferences fsp, so we can get rid of
checking for fsp!=NULL.
Signed-off-by: Volker Lendecke <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
libcli/security/sddl_conditional_ace.c | 5 +--
libcli/smb/util.c | 2 +-
python/samba/tests/smb3unix.py | 10 ++++--
source3/libnet/libnet_join.c | 3 +-
source3/script/tests/test_shadow_copy.sh | 4 +--
source3/smbd/filename.c | 1 +
source3/smbd/smb1_trans2.c | 54 +++++++++++++++-----------------
source3/smbd/smb2_trans2.c | 17 ++--------
source3/utils/ntlm_auth.c | 3 +-
source3/utils/ntlm_auth_diagnostics.c | 13 +++++---
source4/lib/samba3/smbpasswd.c | 6 +---
source4/ntvfs/ipc/ipc_rap.c | 4 +--
12 files changed, 58 insertions(+), 64 deletions(-)
Changeset truncated at 500 lines:
diff --git a/libcli/security/sddl_conditional_ace.c
b/libcli/security/sddl_conditional_ace.c
index cd39e3c4c50..62323a300a0 100644
--- a/libcli/security/sddl_conditional_ace.c
+++ b/libcli/security/sddl_conditional_ace.c
@@ -445,7 +445,6 @@ char *debug_conditional_ace(TALLOC_CTX *mem_ctx,
for (i = 0; i < program->length; i++) {
struct ace_condition_token *tok = &program->tokens[i];
struct sddl_data s = sddl_strings[tok->type];
- char hex[21];
char *utf8 = NULL;
int utf8_len;
char type;
@@ -535,7 +534,8 @@ char *debug_conditional_ace(TALLOC_CTX *mem_ctx,
type = 'u';
break;
- case CONDITIONAL_ACE_TOKEN_OCTET_STRING:
+ case CONDITIONAL_ACE_TOKEN_OCTET_STRING: {
+ char hex[21];
utf8_len = MIN(tok->data.bytes.length, 9);
hex_encode_buf(hex, tok->data.bytes.data, utf8_len);
@@ -544,6 +544,7 @@ char *debug_conditional_ace(TALLOC_CTX *mem_ctx,
nom, utf8_len * 2, hex, utf8_len);
type = 'o';
break;
+ }
case CONDITIONAL_ACE_TOKEN_SID:
utf8 = sddl_encode_sid(mem_ctx,
&tok->data.sid.sid,
diff --git a/libcli/smb/util.c b/libcli/smb/util.c
index 473b479a2ab..4861c13dd82 100644
--- a/libcli/smb/util.c
+++ b/libcli/smb/util.c
@@ -171,7 +171,7 @@ mode_t wire_perms_to_unix(uint32_t perms)
* never change.
****************************************************************************/
-static mode_t unix_filetypes[] =
+static const mode_t unix_filetypes[] =
{S_IFREG, S_IFDIR, S_IFLNK, S_IFCHR, S_IFBLK, S_IFIFO, S_IFSOCK};
mode_t wire_filetype_to_unix(uint32_t wire_type)
diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py
index 302b34776d7..df845d9e0c0 100644
--- a/python/samba/tests/smb3unix.py
+++ b/python/samba/tests/smb3unix.py
@@ -372,10 +372,13 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
posix=True)
self.assertTrue(c.have_posix())
+ wire_mode = libsmb.unix_mode_to_wire(
+ stat.S_IFREG|stat.S_IWUSR|stat.S_IRUSR)
+
f,_,cc_out = c.create_ex('\\test_create_context_basic1_file',
DesiredAccess=security.SEC_STD_ALL,
CreateDisposition=libsmb.FILE_CREATE,
- CreateContexts=[posix_context(0o600)])
+ CreateContexts=[posix_context(wire_mode)])
c.close(f)
cc = ndr_unpack(smb3posix.smb3_posix_cc_info, cc_out[0][1])
@@ -386,11 +389,14 @@ class Smb3UnixTests(samba.tests.libsmb.LibsmbTests):
self.assertEqual(cc.owner, dom_sid(self.samsid + "-1000"))
self.assertTrue(str(cc.group).startswith("S-1-22-2-"))
+ wire_mode = libsmb.unix_mode_to_wire(
+ stat.S_IFREG|stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR)
+
f,_,cc_out = c.create_ex('\\test_create_context_basic1_dir',
DesiredAccess=security.SEC_STD_ALL,
CreateDisposition=libsmb.FILE_CREATE,
CreateOptions=libsmb.FILE_DIRECTORY_FILE,
- CreateContexts=[posix_context(0o700)])
+ CreateContexts=[posix_context(wire_mode)])
c.close(f)
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 76ffe5ed2bb..fb5dfa33c90 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -893,12 +893,11 @@ static bool
libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx,
}
salt = talloc_strdup(mem_ctx, std_salt);
+ SAFE_FREE(std_salt);
if (!salt) {
return false;
}
- SAFE_FREE(std_salt);
-
/* if it's a Windows functional domain, we have to look for the UPN */
if (domain_func == DS_DOMAIN_FUNCTION_2000) {
diff --git a/source3/script/tests/test_shadow_copy.sh
b/source3/script/tests/test_shadow_copy.sh
index dd6699f2310..4f6737e0add 100755
--- a/source3/script/tests/test_shadow_copy.sh
+++ b/source3/script/tests/test_shadow_copy.sh
@@ -100,7 +100,7 @@ build_snapshots()
local prefix #prefix from snapshot dir to share root
local start #timestamp index of first snapshot
local end #timestamp index of last snapshot
- local sub #creat a snapshot of subtree of share
+ local sub #create a snapshot of subtree of share
local snapdir
local snapname
local i
@@ -221,7 +221,7 @@ test_fetch_snap_file()
-c "get ${SNAPSHOTS[$snapidx]}/$path $WORKDIR/foo"
}
-# Test fetching a previous version of a file
+# Test listing the previous version of a dir
test_fetch_snap_dir()
{
local share
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 89a5fe4f338..0c2e365c239 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -1154,6 +1154,7 @@ next:
'/',
&target);
if (ret != 0) {
+ TALLOC_FREE(symlink_err);
return map_nt_error_from_unix(ret);
}
diff --git a/source3/smbd/smb1_trans2.c b/source3/smbd/smb1_trans2.c
index 244a8740b0f..3bb957348cc 100644
--- a/source3/smbd/smb1_trans2.c
+++ b/source3/smbd/smb1_trans2.c
@@ -2527,13 +2527,13 @@ static NTSTATUS smb_q_posix_acl(
#endif
}
-static NTSTATUS smb_q_posix_symlink(
- struct connection_struct *conn,
- struct smb_request *req,
- struct files_struct *dirfsp,
- struct smb_filename *smb_fname,
- char **ppdata,
- int *ptotal_data)
+static NTSTATUS smb_q_posix_symlink(struct connection_struct *conn,
+ struct smb_request *req,
+ struct files_struct *dirfsp,
+ struct smb_filename *smb_fname,
+ struct smb_filename *smb_fname_rel,
+ char **ppdata,
+ int *ptotal_data)
{
char *target = NULL;
size_t needed, len;
@@ -2557,16 +2557,9 @@ static NTSTATUS smb_q_posix_symlink(
NULL,
&target);
} else {
- struct smb_filename smb_fname_rel = *smb_fname;
- char *slash = NULL;
-
- slash = strrchr_m(smb_fname->base_name, '/');
- if (slash != NULL) {
- smb_fname_rel.base_name = slash + 1;
- }
status = readlink_talloc(talloc_tos(),
dirfsp,
- &smb_fname_rel,
+ smb_fname_rel,
&target);
}
@@ -2613,6 +2606,7 @@ static void call_trans2qpathinfo(
char *params = *pparams;
uint16_t info_level;
struct smb_filename *smb_fname = NULL;
+ struct smb_filename *smb_fname_rel = NULL;
bool delete_pending = False;
struct timespec write_time_ts = { .tv_sec = 0, };
struct files_struct *dirfsp = NULL;
@@ -2682,13 +2676,15 @@ static void call_trans2qpathinfo(
reply_nterror(req, status);
return;
}
- status = filename_convert_dirfsp(req,
- conn,
- fname,
- ucf_flags,
- twrp,
- &dirfsp,
- &smb_fname);
+ status = filename_convert_dirfsp_rel(req,
+ conn,
+ conn->cwd_fsp,
+ fname,
+ ucf_flags,
+ twrp,
+ &dirfsp,
+ &smb_fname,
+ &smb_fname_rel);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
reply_botherror(req,
@@ -2779,13 +2775,13 @@ static void call_trans2qpathinfo(
break;
case SMB_QUERY_FILE_UNIX_LINK:
- status = smb_q_posix_symlink(
- conn,
- req,
- dirfsp,
- smb_fname,
- ppdata,
- &total_data);
+ status = smb_q_posix_symlink(conn,
+ req,
+ dirfsp,
+ smb_fname,
+ smb_fname_rel,
+ ppdata,
+ &total_data);
break;
}
diff --git a/source3/smbd/smb2_trans2.c b/source3/smbd/smb2_trans2.c
index 442515af377..4fa72f34978 100644
--- a/source3/smbd/smb2_trans2.c
+++ b/source3/smbd/smb2_trans2.c
@@ -3021,23 +3021,12 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
fsp_fnum_dbg(fsp),
info_level, max_data_bytes);
- /*
- * In case of querying a symlink in POSIX context,
- * fsp will be NULL. fdos_mode() deals with it.
- */
- if (fsp != NULL) {
- smb_fname = fsp->fsp_name;
- }
+ smb_fname = fsp->fsp_name;
mode = fdos_mode(fsp);
psbuf = &smb_fname->st;
- if (fsp != NULL) {
- base_sp = fsp->base_fsp ?
- &fsp->base_fsp->fsp_name->st :
- &fsp->fsp_name->st;
- } else {
- base_sp = &smb_fname->st;
- }
+ base_sp = (fsp->base_fsp != NULL) ? &fsp->base_fsp->fsp_name->st
+ : &fsp->fsp_name->st;
nlink = psbuf->st_ex_nlink;
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 3642df89c8d..905f33840b1 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -2455,7 +2455,7 @@ static bool check_auth_crap(void)
char user_session_key[16];
char *hex_lm_key;
char *hex_user_session_key;
- char *error_string;
+ char *error_string = NULL;
uint8_t authoritative = 1;
setbuf(stdout, NULL);
@@ -2485,6 +2485,7 @@ static bool check_auth_crap(void)
SAFE_FREE(error_string);
return False;
}
+ SAFE_FREE(error_string);
if (request_lm_key
&& (!all_zero((uint8_t *)lm_key, sizeof(lm_key)))) {
diff --git a/source3/utils/ntlm_auth_diagnostics.c
b/source3/utils/ntlm_auth_diagnostics.c
index 69034434148..1a57f7726f2 100644
--- a/source3/utils/ntlm_auth_diagnostics.c
+++ b/source3/utils/ntlm_auth_diagnostics.c
@@ -200,7 +200,7 @@ static bool test_ntlm_in_lm(bool lanman_support_expected)
uchar lm_hash[16];
uchar user_session_key[16];
DATA_BLOB chall = get_challenge();
- char *error_string;
+ char *error_string = NULL;
ZERO_STRUCT(user_session_key);
@@ -231,6 +231,7 @@ static bool test_ntlm_in_lm(bool lanman_support_expected)
SAFE_FREE(error_string);
return False;
}
+ SAFE_FREE(error_string);
/* If we are told the DC is Samba4, expect an LM key of zeros */
if (!lanman_support_expected) {
@@ -289,7 +290,7 @@ static bool test_ntlm_in_both(bool lanman_support_expected)
uint8_t user_session_key[16];
uint8_t nt_hash[16];
DATA_BLOB chall = get_challenge();
- char *error_string;
+ char *error_string = NULL;
ZERO_STRUCT(lm_key);
ZERO_STRUCT(user_session_key);
@@ -323,6 +324,7 @@ static bool test_ntlm_in_both(bool lanman_support_expected)
SAFE_FREE(error_string);
return False;
}
+ SAFE_FREE(error_string);
/* If we are told the DC is Samba4, expect an LM key of zeros */
if (!lanman_support_expected) {
@@ -375,7 +377,7 @@ static bool test_lmv2_ntlmv2_broken(enum ntlm_break
break_which)
uint8_t authoritative = 1;
uchar user_session_key[16];
DATA_BLOB chall = get_challenge();
- char *error_string;
+ char *error_string = NULL;
ZERO_STRUCT(user_session_key);
@@ -429,6 +431,8 @@ static bool test_lmv2_ntlmv2_broken(enum ntlm_break
break_which)
return break_which == BREAK_NT;
}
+ SAFE_FREE(error_string);
+
if (break_which != NO_NT && break_which != BREAK_NT &&
memcmp(ntlmv2_session_key.data, user_session_key,
sizeof(user_session_key)) != 0) {
DEBUG(1, ("USER (NTLMv2) Session Key does not match
expectations!\n"));
@@ -509,7 +513,7 @@ static bool test_plaintext(enum ntlm_break break_which)
uchar lm_key[16];
static const uchar zeros[8] = { 0, };
DATA_BLOB chall = data_blob(zeros, sizeof(zeros));
- char *error_string;
+ char *error_string = NULL;
ZERO_STRUCT(user_session_key);
@@ -583,6 +587,7 @@ static bool test_plaintext(enum ntlm_break break_which)
SAFE_FREE(error_string);
return break_which == BREAK_NT;
}
+ SAFE_FREE(error_string);
return break_which != BREAK_NT;
}
diff --git a/source4/lib/samba3/smbpasswd.c b/source4/lib/samba3/smbpasswd.c
index 6f4d832ae2b..d0b7e9dbd48 100644
--- a/source4/lib/samba3/smbpasswd.c
+++ b/source4/lib/samba3/smbpasswd.c
@@ -89,11 +89,7 @@ char *smbpasswd_sethexpwd(TALLOC_CTX *mem_ctx, struct
samr_Password *pwd, uint16
{
char *p;
if (pwd != NULL) {
- p = talloc_array(mem_ctx, char, 33);
- if (!p) {
- return NULL;
- }
- hex_encode_buf(p, pwd->hash, sizeof(pwd->hash));
+ p = hex_encode_talloc(mem_ctx, pwd->hash, sizeof(pwd->hash));
} else {
if (acb_info & ACB_PWNOTREQ)
p = talloc_strdup(mem_ctx, "NO
PASSWORDXXXXXXXXXXXXXXXXXXXXX");
diff --git a/source4/ntvfs/ipc/ipc_rap.c b/source4/ntvfs/ipc/ipc_rap.c
index 9ddde5e39d7..95be64fe7b6 100644
--- a/source4/ntvfs/ipc/ipc_rap.c
+++ b/source4/ntvfs/ipc/ipc_rap.c
@@ -253,7 +253,7 @@ static NTSTATUS rap_push_string(struct ndr_push *data_push,
static NTSTATUS _rap_netshareenum(struct rap_call *call)
{
- struct rap_NetShareEnum r;
+ struct rap_NetShareEnum r = {};
NTSTATUS result;
uint32_t offset_save = 0;
struct rap_heap_save heap_save = {0};
@@ -333,7 +333,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call)
static NTSTATUS _rap_netserverenum2(struct rap_call *call)
{
- struct rap_NetServerEnum2 r;
+ struct rap_NetServerEnum2 r = {};
NTSTATUS result;
uint32_t offset_save = 0;
struct rap_heap_save heap_save = {0};
--
Samba Shared Repository