The branch, master has been updated
       via  d1ea929c6b9 tests: Run `dd` without any preloaded libraries
       via  b989f6e7091 s3:util: Pass a memory context to get_challenge for 
ntlm_auth tests
       via  a7d58534352 s3:utils: Use a talloc stackframe for 
diagnose_ntlm_auth()
      from  d950c739979 ctdb-tests: Don't hard code creation of 
$CTDB_BASE/events/legacy/

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d1ea929c6b994eea6315ed3bf3091b129eaf71a2
Author: Andreas Schneider <[email protected]>
Date:   Tue Oct 14 11:57:04 2025 +0200

    tests: Run `dd` without any preloaded libraries
    
    If AddressSanitizer is loaded it will detect alignment issues. The tool
    is not ours, so ignore it.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>
    
    Autobuild-User(master): Anoop C S <[email protected]>
    Autobuild-Date(master): Thu Oct 16 09:34:58 UTC 2025 on atb-devel-224

commit b989f6e7091b0adfa394ed860fc731639a42ba99
Author: Andreas Schneider <[email protected]>
Date:   Tue Oct 14 11:21:42 2025 +0200

    s3:util: Pass a memory context to get_challenge for ntlm_auth tests
    
    Fixes memory leaks detected by LeakSanitizer.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit a7d58534352f73c0bae05844fec1118b4104db03
Author: Andreas Schneider <[email protected]>
Date:   Tue Oct 14 11:20:55 2025 +0200

    s3:utils: Use a talloc stackframe for diagnose_ntlm_auth()
    
    This way we can use talloc_tos() and don't leak any memory. This will
    make LeakSanitizer happy.
    
    Signed-off-by: Andreas Schneider <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/script/tests/test_smbclient_large_file.sh       |  2 +-
 source3/script/tests/test_smbclient_tarmode.sh          |  4 ++--
 source3/script/tests/test_smbget.sh                     | 10 ++++++----
 source3/script/tests/test_zero_data.sh                  |  3 ++-
 source3/script/tests/test_zero_readsize.sh              |  2 +-
 source3/utils/ntlm_auth.c                               |  4 ++--
 source3/utils/ntlm_auth_diagnostics.c                   | 11 +++++++----
 source3/utils/ntlm_auth_proto.h                         |  2 +-
 source4/client/tests/test_cifsdd.sh                     |  2 +-
 testprogs/blackbox/test_client_etypes.sh                |  2 +-
 testprogs/blackbox/test_net_ads.sh                      |  2 +-
 testprogs/blackbox/test_net_ads_fips.sh                 |  2 +-
 testprogs/blackbox/test_net_ads_join_to_preferred_dc.sh |  2 +-
 testprogs/blackbox/test_net_offline.sh                  |  2 +-
 14 files changed, 28 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/script/tests/test_smbclient_large_file.sh 
b/source3/script/tests/test_smbclient_large_file.sh
index 80816bec10c..3a384e2c1ba 100755
--- a/source3/script/tests/test_smbclient_large_file.sh
+++ b/source3/script/tests/test_smbclient_large_file.sh
@@ -49,7 +49,7 @@ EOF
 }
 
 rm -f $PREFIX/largefile
-dd if=/dev/zero of=$PREFIX/largefile seek=$((20 * 1024 * 1024)) count=1 bs=1
+LD_PRELOAD='' dd if=/dev/zero of=$PREFIX/largefile seek=$((20 * 1024 * 1024)) 
count=1 bs=1
 
 incdir=$(dirname $0)/../../../testprogs/blackbox
 . $incdir/subunit.sh
diff --git a/source3/script/tests/test_smbclient_tarmode.sh 
b/source3/script/tests/test_smbclient_tarmode.sh
index d48e4120f7d..555c0d6980a 100755
--- a/source3/script/tests/test_smbclient_tarmode.sh
+++ b/source3/script/tests/test_smbclient_tarmode.sh
@@ -58,7 +58,7 @@ create_test_data()
        if have_command "od"; then # Use random file sizes
                local RND_COUNT
                for RND_COUNT in $(od -An -N$NUM_FILES -tu1 </dev/urandom); do
-                       if ! dd if=/dev/urandom of="$DIR/file.$I" bs=$BS 
count=$RND_COUNT >/dev/null 2>&1; then
+                       if ! LD_PRELOAD='' dd if=/dev/urandom of="$DIR/file.$I" 
bs=$BS count=$RND_COUNT >/dev/null 2>&1; then
                                echo "Couldn't create test file '$DIR/file.$I' 
(random size)"
                                false
                                return
@@ -67,7 +67,7 @@ create_test_data()
                done
        else # Fallback to same file sizes
                while [ $I -le $NUM_FILES ]; do
-                       if ! dd if=/dev/urandom of="$DIR/file.$I" bs=$BS 
count=$NORND_COUNT >/dev/null 2>&1; then
+                       if ! LD_PRELOAD='' dd if=/dev/urandom of="$DIR/file.$I" 
bs=$BS count=$NORND_COUNT >/dev/null 2>&1; then
                                echo "Couldn't create test file '$DIR/file.$I' 
(static size)"
                                false
                                return
diff --git a/source3/script/tests/test_smbget.sh 
b/source3/script/tests/test_smbget.sh
index 8f8513d5b62..b8e6200fbe1 100755
--- a/source3/script/tests/test_smbget.sh
+++ b/source3/script/tests/test_smbget.sh
@@ -34,12 +34,13 @@ samba_texpect="${BINDIR}/texpect"
 create_test_data()
 {
        pushd $WORKDIR
-       dd if=/dev/urandom bs=1024 count=128 of=testfile
+       # Do not preload anything for dd
+       LD_PRELOAD='' dd if=/dev/urandom bs=1024 count=128 of=testfile
        chmod 644 testfile
        mkdir dir1
-       dd if=/dev/urandom bs=1024 count=128 of=dir1/testfile1
+       LD_PRELOAD='' dd if=/dev/urandom bs=1024 count=128 of=dir1/testfile1
        mkdir dir2
-       dd if=/dev/urandom bs=1024 count=128 of=dir2/testfile2
+       LD_PRELOAD='' dd if=/dev/urandom bs=1024 count=128 of=dir2/testfile2
        popd
 }
 
@@ -308,7 +309,8 @@ test_resume()
 test_resume_modified()
 {
        clear_download_area
-       dd if=/dev/urandom bs=1024 count=2 of=testfile
+       # Do not preload anything for dd
+       LD_PRELOAD='' dd if=/dev/urandom bs=1024 count=2 of=testfile
        $SMBGET --verbose --resume -U${SERVER}/${USERNAME}%$PASSWORD 
smb://$SERVER_IP/smbget/testfile
        if [ $? -ne 1 ]; then
                echo 'ERROR: RC does not match, expected: 1'
diff --git a/source3/script/tests/test_zero_data.sh 
b/source3/script/tests/test_zero_data.sh
index 62ba856f34d..fd224cc48c4 100755
--- a/source3/script/tests/test_zero_data.sh
+++ b/source3/script/tests/test_zero_data.sh
@@ -26,7 +26,8 @@ TESTDIR=$LOCAL_PATH/zero_data
 mkdir -p $TESTDIR
 chmod 777 p $TESTDIR
 
-dd if=/dev/urandom of=$TESTDIR/testfile bs=1024 count=128
+# Do not preload anything for dd
+LD_PRELOAD='' dd if=/dev/urandom of=$TESTDIR/testfile bs=1024 count=128
 chmod 777 $TESTDIR/testfile
 
 alloc_kb=$(du -k $TESTDIR/testfile | sed -e 's/\t.*//')
diff --git a/source3/script/tests/test_zero_readsize.sh 
b/source3/script/tests/test_zero_readsize.sh
index f859599ba89..18866ed6929 100755
--- a/source3/script/tests/test_zero_readsize.sh
+++ b/source3/script/tests/test_zero_readsize.sh
@@ -40,7 +40,7 @@ do_setup()
 {
        rm -f "${PREFIX}/zero_read_testfile"
        rm -f "${PREFIX}/zero_read_testfile_get"
-       dd if=/dev/zero of="${PREFIX}/zero_read_testfile" bs=1024 count=1
+       LD_PRELOAD='' dd if=/dev/zero of="${PREFIX}/zero_read_testfile" bs=1024 
count=1
        global_inject_conf="$(dirname "${SERVERCONFFILE}")/global_inject.conf"
        echo "smb2 max read = 0" >"$global_inject_conf"
        ${SMBCONTROL} ${CONF} smbd reload-config
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index a424990baa8..6c2493ec1f1 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -367,13 +367,13 @@ const char *get_winbind_netbios_name(void)
 
 }
 
-DATA_BLOB get_challenge(void)
+DATA_BLOB get_challenge(TALLOC_CTX *mem_ctx)
 {
        static DATA_BLOB chal;
        if (opt_challenge.length)
                return opt_challenge;
 
-       chal = data_blob(NULL, 8);
+       chal = data_blob_talloc(mem_ctx, NULL, 8);
 
        generate_random_buffer(chal.data, chal.length);
        return chal;
diff --git a/source3/utils/ntlm_auth_diagnostics.c 
b/source3/utils/ntlm_auth_diagnostics.c
index d70c8c45883..e5a8101deac 100644
--- a/source3/utils/ntlm_auth_diagnostics.c
+++ b/source3/utils/ntlm_auth_diagnostics.c
@@ -60,7 +60,7 @@ static bool test_lm_ntlm_broken(enum ntlm_break break_which,
        uchar user_session_key[16];
        uchar lm_hash[16];
        uchar nt_hash[16];
-       DATA_BLOB chall = get_challenge();
+       DATA_BLOB chall = get_challenge(talloc_tos());
        char *error_string = NULL;
 
        ZERO_STRUCT(lm_key);
@@ -199,7 +199,7 @@ static bool test_ntlm_in_lm(bool lanman_support_expected)
        uchar lm_key[8];
        uchar lm_hash[16];
        uchar user_session_key[16];
-       DATA_BLOB chall = get_challenge();
+       DATA_BLOB chall = get_challenge(talloc_tos());
        char *error_string = NULL;
 
        ZERO_STRUCT(user_session_key);
@@ -291,7 +291,7 @@ static bool test_ntlm_in_both(bool lanman_support_expected)
        uint8_t lm_hash[16];
        uint8_t user_session_key[16];
        uint8_t nt_hash[16];
-       DATA_BLOB chall = get_challenge();
+       DATA_BLOB chall = get_challenge(talloc_tos());
        char *error_string = NULL;
 
        ZERO_STRUCT(lm_key);
@@ -380,7 +380,7 @@ static bool test_lmv2_ntlmv2_broken(enum ntlm_break 
break_which)
        DATA_BLOB names_blob = NTLMv2_generate_names_blob(NULL, 
get_winbind_netbios_name(), get_winbind_domain());
        uint8_t authoritative = 1;
        uchar user_session_key[16];
-       DATA_BLOB chall = get_challenge();
+       DATA_BLOB chall = get_challenge(talloc_tos());
        char *error_string = NULL;
 
        ZERO_STRUCT(user_session_key);
@@ -718,6 +718,7 @@ static const struct ntlm_tests {
 
 bool diagnose_ntlm_auth(bool lanman_support_expected)
 {
+       TALLOC_CTX *frame = talloc_stackframe();
        unsigned int i;
        bool pass = True;
 
@@ -737,6 +738,8 @@ bool diagnose_ntlm_auth(bool lanman_support_expected)
                }
        }
 
+       TALLOC_FREE(frame);
+
         return pass;
 }
 
diff --git a/source3/utils/ntlm_auth_proto.h b/source3/utils/ntlm_auth_proto.h
index ed6d5f44a2f..5fcc49b5064 100644
--- a/source3/utils/ntlm_auth_proto.h
+++ b/source3/utils/ntlm_auth_proto.h
@@ -28,7 +28,7 @@
 
 const char *get_winbind_domain(void);
 const char *get_winbind_netbios_name(void);
-DATA_BLOB get_challenge(void) ;
+DATA_BLOB get_challenge(TALLOC_CTX *mem_ctx) ;
 NTSTATUS contact_winbind_auth_crap(const char *username,
                                   const char *domain,
                                   const char *workstation,
diff --git a/source4/client/tests/test_cifsdd.sh 
b/source4/client/tests/test_cifsdd.sh
index 21a884061bf..80575042c63 100755
--- a/source4/client/tests/test_cifsdd.sh
+++ b/source4/client/tests/test_cifsdd.sh
@@ -42,7 +42,7 @@ destfile=tempfile.dst.$$
 destpath=${SELFTEST_TMPDIR}/$destfile
 
 # Create a source file with arbitrary contents
-dd if=$DD of=$sourcepath bs=1024 count=50 >/dev/null
+LD_PRELOAD='' dd if=$DD of=$sourcepath bs=1024 count=50 >/dev/null
 
 ls -l $sourcepath
 
diff --git a/testprogs/blackbox/test_client_etypes.sh 
b/testprogs/blackbox/test_client_etypes.sh
index 88f47199cbd..0e86ebec8b2 100755
--- a/testprogs/blackbox/test_client_etypes.sh
+++ b/testprogs/blackbox/test_client_etypes.sh
@@ -30,7 +30,7 @@ EOF
        exit 0
 fi
 
-HOSTNAME=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | sha1sum | cut -b 
1-10)
+HOSTNAME=$(LD_PRELOAD='' dd if=/dev/urandom bs=1 count=32 2>/dev/null | 
sha1sum | cut -b 1-10)
 
 RUNDIR=$(pwd)
 cd $BASEDIR
diff --git a/testprogs/blackbox/test_net_ads.sh 
b/testprogs/blackbox/test_net_ads.sh
index 5340056cc3e..c12c8318bbd 100755
--- a/testprogs/blackbox/test_net_ads.sh
+++ b/testprogs/blackbox/test_net_ads.sh
@@ -10,7 +10,7 @@ DC_USERNAME=$2
 DC_PASSWORD=$3
 BASEDIR=$4
 
-HOSTNAME=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | sha1sum | cut -b 
1-10)
+HOSTNAME=$(LD_PRELOAD='' dd if=/dev/urandom bs=1 count=32 2>/dev/null | 
sha1sum | cut -b 1-10)
 
 RUNDIR=$(pwd)
 cd $BASEDIR
diff --git a/testprogs/blackbox/test_net_ads_fips.sh 
b/testprogs/blackbox/test_net_ads_fips.sh
index cbadc514139..b19580b9002 100755
--- a/testprogs/blackbox/test_net_ads_fips.sh
+++ b/testprogs/blackbox/test_net_ads_fips.sh
@@ -10,7 +10,7 @@ DC_USERNAME=$2
 DC_PASSWORD=$3
 BASEDIR=$4
 
-HOSTNAME=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | sha1sum | cut -b 
1-10)
+HOSTNAME=$(LD_PRELOAD='' dd if=/dev/urandom bs=1 count=32 2>/dev/null | 
sha1sum | cut -b 1-10)
 
 RUNDIR=$(pwd)
 cd $BASEDIR
diff --git a/testprogs/blackbox/test_net_ads_join_to_preferred_dc.sh 
b/testprogs/blackbox/test_net_ads_join_to_preferred_dc.sh
index 1bebc2f4dbe..129836c50dd 100755
--- a/testprogs/blackbox/test_net_ads_join_to_preferred_dc.sh
+++ b/testprogs/blackbox/test_net_ads_join_to_preferred_dc.sh
@@ -10,7 +10,7 @@ DC_USERNAME=$2
 DC_PASSWORD=$3
 BASEDIR=$4
 
-HOSTNAME=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | sha1sum | cut -b 
1-10)
+HOSTNAME=$(LD_PRELOAD='' dd if=/dev/urandom bs=1 count=32 2>/dev/null | 
sha1sum | cut -b 1-10)
 
 RUNDIR=$(pwd)
 cd $BASEDIR
diff --git a/testprogs/blackbox/test_net_offline.sh 
b/testprogs/blackbox/test_net_offline.sh
index df0c73fa21c..a62963a695b 100755
--- a/testprogs/blackbox/test_net_offline.sh
+++ b/testprogs/blackbox/test_net_offline.sh
@@ -10,7 +10,7 @@ DC_USERNAME=$2
 DC_PASSWORD=$3
 BASEDIR=$4
 
-HOSTNAME=$(dd if=/dev/urandom bs=1 count=32 2>/dev/null | sha1sum | cut -b 
1-10)
+HOSTNAME=$(LD_PRELOAD='' dd if=/dev/urandom bs=1 count=32 2>/dev/null | 
sha1sum | cut -b 1-10)
 
 RUNDIR=$(pwd)
 cd $BASEDIR


-- 
Samba Shared Repository

Reply via email to