[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Tue Jan 23 14:31:02 UTC 2024
The branch, master has been updated
via 13d98c8fa6d s3:passdb: Fix memory leak caused by recursion of get_global_sam_sid()
via dc18e2a222a s3:libads: Fix memory leaks in ads_create_machine_acct()
via 18913d384ed s3:passdb: Do not leak memory in pdb_tdb
from f05b61b4991 gp: Skip site GP list if no site is found
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 13d98c8fa6d1971adc687f2de01586a3c4739f55
Author: Andreas Schneider <asn at samba.org>
Date: Tue Jan 23 11:07:19 2024 +0100
s3:passdb: Fix memory leak caused by recursion of get_global_sam_sid()
Direct leak of 68 byte(s) in 1 object(s) allocated from:
#0 0x7f4f39cdc03f in malloc (/lib64/libasan.so.8+0xdc03f) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
#1 0x7f4f36fbe427 in malloc_ ../../source3/lib/util_malloc.c:38
#2 0x7f4f394b5e19 in pdb_generate_sam_sid ../../source3/passdb/machine_sid.c:90
#3 0x7f4f394b5e19 in get_global_sam_sid ../../source3/passdb/machine_sid.c:211
#4 0x7f4f394af366 in secrets_store_domain_sid ../../source3/passdb/machine_account_secrets.c:143
#5 0x7f4f394b5eb5 in pdb_generate_sam_sid ../../source3/passdb/machine_sid.c:110
#6 0x7f4f394b5eb5 in get_global_sam_sid ../../source3/passdb/machine_sid.c:211
#7 0x7f4f394af366 in secrets_store_domain_sid ../../source3/passdb/machine_account_secrets.c:143
#8 0x557a1f11d62c in net_setlocalsid ../../source3/utils/net.c:416
#9 0x557a1f1c9972 in net_run_function ../../source3/utils/net_util.c:464
#10 0x557a1f121129 in main ../../source3/utils/net.c:1372
#11 0x7f4f34c281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date(master): Tue Jan 23 14:30:58 UTC 2024 on atb-devel-224
commit dc18e2a222afaee8cfc9a4becb786d97d1a45d3a
Author: Andreas Schneider <asn at samba.org>
Date: Tue Oct 31 14:04:31 2023 +0100
s3:libads: Fix memory leaks in ads_create_machine_acct()
Indirect leak of 291 byte(s) in 2 object(s) allocated from:
#0 0x7fd77b6dc03f in malloc (/lib64/libasan.so.8+0xdc03f) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
#1 0x7fd77b094bc2 in __talloc_with_prefix ../../lib/talloc/talloc.c:783
#2 0x7fd77b096034 in __talloc ../../lib/talloc/talloc.c:825
#3 0x7fd77b096034 in __talloc_strlendup ../../lib/talloc/talloc.c:2454
#4 0x7fd77b096034 in talloc_strdup ../../lib/talloc/talloc.c:2470
#5 0x7fd779996633 in add_string_to_array ../../lib/util/util_strlist.c:504
#6 0x7fd77b10c754 in ads_create_machine_acct ../../source3/libads/ldap.c:2662
#7 0x7fd77b46705f in libnet_join_precreate_machine_acct ../../source3/libnet/libnet_join.c:390
#8 0x7fd77b46705f in libnet_DomainJoin ../../source3/libnet/libnet_join.c:2852
#9 0x7fd77b46705f in libnet_Join ../../source3/libnet/libnet_join.c:3036
#10 0x55fb9788d91a in net_ads_join ../../source3/utils/net_ads.c:1853
#11 0x55fb9793ab86 in net_join ../../source3/utils/net_join.c:45
#12 0x55fb9793084f in net_run_function ../../source3/utils/net_util.c:454
#13 0x55fb97889859 in main ../../source3/utils/net.c:1372
#14 0x7fd7768281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 18913d384edb8c49c69501fd6db5511312614594
Author: Andreas Schneider <asn at samba.org>
Date: Fri Oct 27 12:09:53 2023 +0200
s3:passdb: Do not leak memory in pdb_tdb
==19938==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 77 byte(s) in 1 object(s) allocated from:
#0 0x7f7d482841f8 in strdup (/lib64/libasan.so.8+0x841f8) (BuildId: 3e1694ad218c99a8b1b69231666a27df63cf19d0)
#1 0x7f7d47204846 (bin/shared/libsamba-util.so.0+0x4c846) (BuildId: 43b084eb9013442ac68eb1fc17649f142cbb0f94)
#2 0x7f7d40b1d97a in pdb_init_tdbsam ../../source3/passdb/pdb_tdb.c:1361
#3 0x7f7d4715f266 (bin/shared/libsamba-passdb.so.0+0x76266) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
#4 0x7f7d4715f57a (bin/shared/libsamba-passdb.so.0+0x7657a) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
#5 0x7f7d47163700 (bin/shared/libsamba-passdb.so.0+0x7a700) (BuildId: 13d2858e2217592a22a4ee9203fef759d52df733)
#6 0x55a9177d3853 in main ../../source3/smbd/server.c:1928
#7 0x7f7d434281af in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/libads/ldap.c | 4 ++--
source3/passdb/machine_account_secrets.c | 10 ++++++----
source3/passdb/pdb_tdb.c | 3 +++
3 files changed, 11 insertions(+), 6 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index acf558a7ab3..b5139e59cfb 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -2659,7 +2659,7 @@ ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads,
goto done;
}
- ok = add_string_to_array(spn_array,
+ ok = add_string_to_array(ctx,
spn,
&spn_array,
&num_spns);
@@ -2680,7 +2680,7 @@ ADS_STATUS ads_create_machine_acct(ADS_STRUCT *ads,
goto done;
}
- ok = add_string_to_array(spn_array,
+ ok = add_string_to_array(ctx,
spn,
&spn_array,
&num_spns);
diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c
index a80b1633892..c97b35e7e52 100644
--- a/source3/passdb/machine_account_secrets.c
+++ b/source3/passdb/machine_account_secrets.c
@@ -138,11 +138,13 @@ bool secrets_store_domain_sid(const char *domain, const struct dom_sid *sid)
&clean_sid,
sizeof(struct dom_sid));
- /* Force a re-query, in the case where we modified our domain */
+ /* Force a re-query */
if (ret) {
- if (dom_sid_equal(get_global_sam_sid(), sid) == false) {
- reset_global_sam_sid();
- }
+ /*
+ * Do not call get_global_domain_sid() here, or we will call it
+ * recursively.
+ */
+ reset_global_sam_sid();
}
return ret;
}
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 4c578f8069d..f9ba193df3b 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -1346,6 +1346,9 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc
}
pfile = tdbfile;
}
+
+ /* Do not leak memory if the init function is called more than once */
+ SAFE_FREE(tdbsam_filename);
tdbsam_filename = SMB_STRDUP(pfile);
if (!tdbsam_filename) {
return NT_STATUS_NO_MEMORY;
--
Samba Shared Repository
More information about the samba-cvs
mailing list