The Samba-Bugzilla – Attachment 17904 Details for
Bug 15382
cli_list loops 100% CPU against pre-lanman2 servers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.17 and 4.18
bug-15382.txt (text/plain), 5.82 KB, created by
Volker Lendecke
on 2023-06-02 07:43:38 UTC
(
hide
)
Description:
Patch for 4.17 and 4.18
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2023-06-02 07:43:38 UTC
Size:
5.82 KB
patch
obsolete
>From 5bdb54f7ee12d3082763bcd9a29a062f5a4a58c1 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Thu, 1 Jun 2023 16:39:21 +0200 >Subject: [PATCH 1/3] tests: Make timelimit available to test scripts > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=15382 > >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 4804d6b89a9146f1fc5270de158cd25254505f61) >--- > selftest/selftesthelpers.py | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/selftest/selftesthelpers.py b/selftest/selftesthelpers.py >index 0320008faf9..1af8f5f837c 100644 >--- a/selftest/selftesthelpers.py >+++ b/selftest/selftesthelpers.py >@@ -226,3 +226,4 @@ rpcclient = binpath('rpcclient') > smbcacls = binpath('smbcacls') > smbcontrol = binpath('smbcontrol') > smbstatus = binpath('smbstatus') >+timelimit = binpath('timelimit') >-- >2.30.2 > > >From 6841eba2bed6bc4107b9ba804371cee68f0fa268 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Thu, 1 Jun 2023 16:41:37 +0200 >Subject: [PATCH 2/3] tests: Show that we 100% loop in cli_list_old_recv() > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=15382 > >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit e86234f3d61c62e4365e1ea105bdd29feaf7ccbe) >--- > selftest/knownfail.d/old-dirlist | 1 + > source3/script/tests/test_old_dirlisting.sh | 28 +++++++++++++++++++++ > source3/selftest/tests.py | 6 +++++ > 3 files changed, 35 insertions(+) > create mode 100644 selftest/knownfail.d/old-dirlist > create mode 100755 source3/script/tests/test_old_dirlisting.sh > >diff --git a/selftest/knownfail.d/old-dirlist b/selftest/knownfail.d/old-dirlist >new file mode 100644 >index 00000000000..0c1066a48c4 >--- /dev/null >+++ b/selftest/knownfail.d/old-dirlist >@@ -0,0 +1 @@ >+^samba3.blackbox.smbclient_old_dir.* >diff --git a/source3/script/tests/test_old_dirlisting.sh b/source3/script/tests/test_old_dirlisting.sh >new file mode 100755 >index 00000000000..f50a4742b1a >--- /dev/null >+++ b/source3/script/tests/test_old_dirlisting.sh >@@ -0,0 +1,28 @@ >+#!/bin/sh >+# This tests listing directories using the SMBSearch call family >+ >+if [ $# -lt 2 ]; then >+ cat <<EOF >+Usage: $0 TIMELIMIT SMBCLIENT >+EOF >+ exit 1 >+fi >+ >+TIMELIMIT="$1" >+shift >+SMBCLIENT="$VALGRIND $1" >+shift >+ >+incdir=$(dirname $0)/../../../testprogs/blackbox >+. $incdir/subunit.sh >+ >+# Make sure we don't loop 100% CPU. A normal dir listing should return >+# in less than 3 seconds. At the point of this commit smbclient -c dir >+# | wc returns 43 lines, so checking for 100 lines should be well >+# enough. >+ >+count=$($TIMELIMIT 3 $SMBCLIENT //"$SERVER_IP"/tmpguest -m LANMAN1 -U% \ >+ -c dir | wc -l) >+ >+testit "listing shares with LANMAN1" test ${count} -le 100 || >+ failed=$((failed + 1)) >diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py >index 2c5ae8cff4f..04349c1f1f7 100755 >--- a/source3/selftest/tests.py >+++ b/source3/selftest/tests.py >@@ -33,6 +33,7 @@ from selftesthelpers import valgrindify, smbtorture4_testsuites > from selftesthelpers import smbtorture4_options > from selftesthelpers import smbcontrol > from selftesthelpers import smbstatus >+from selftesthelpers import timelimit > smbtorture4_options.extend([ > '--option=torture:sharedelay=100000', > '--option=torture:writetimeupdatedelay=500000', >@@ -690,6 +691,11 @@ for env in ["fileserver"]: > '$SERVER', 'fruit_resource_stream', '$USERNAME', '$PASSWORD', > '$LOCAL_PATH/fruit_resource_stream', smbclient3]) > >+plantestsuite("samba3.blackbox.smbclient_old_dir", "fileserver_smb1", >+ [os.path.join(samba3srcdir, >+ "script/tests/test_old_dirlisting.sh"), >+ timelimit, smbclient3]) >+ > for env in ["fileserver:local"]: > plantestsuite("samba3.blackbox.net_usershare", env, [os.path.join(samba3srcdir, "script/tests/test_net_usershare.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbclient3]) > >-- >2.30.2 > > >From 3eddc63aea0d9332086b5b75d4dba9b0255bbf57 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Thu, 1 Jun 2023 15:57:26 +0200 >Subject: [PATCH 3/3] libsmb: Fix directory listing against old servers > >cli_list_trans_recv() can be called multiple times. When it's done, it >return NT_STATUS_OK and set *finfo to NULL. cli_list_old_recv() did >not do the NULL part, so smbclient would endlessly loop. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=15382 > >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Thu Jun 1 21:54:42 UTC 2023 on atb-devel-224 > >(cherry picked from commit f30f5793ad592e193546586b765837c0ac9f5647) >--- > selftest/knownfail.d/old-dirlist | 1 - > source3/libsmb/clilist.c | 6 ++++++ > 2 files changed, 6 insertions(+), 1 deletion(-) > delete mode 100644 selftest/knownfail.d/old-dirlist > >diff --git a/selftest/knownfail.d/old-dirlist b/selftest/knownfail.d/old-dirlist >deleted file mode 100644 >index 0c1066a48c4..00000000000 >--- a/selftest/knownfail.d/old-dirlist >+++ /dev/null >@@ -1 +0,0 @@ >-^samba3.blackbox.smbclient_old_dir.* >diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c >index 25040438d9e..460b2963f88 100644 >--- a/source3/libsmb/clilist.c >+++ b/source3/libsmb/clilist.c >@@ -537,6 +537,11 @@ static NTSTATUS cli_list_old_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, > return status; > } > >+ if (state->dirlist == NULL) { >+ *pfinfo = NULL; >+ return NT_STATUS_OK; >+ } >+ > num_received = talloc_array_length(state->dirlist) / DIR_STRUCT_SIZE; > > finfo = talloc_array(mem_ctx, struct file_info, num_received); >@@ -563,6 +568,7 @@ static NTSTATUS cli_list_old_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, > return status; > } > } >+ TALLOC_FREE(state->dirlist); > *pfinfo = finfo; > return NT_STATUS_OK; > } >-- >2.30.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
slow
:
review+
Actions:
View
Attachments on
bug 15382
: 17904