Skip to content

Conversation

@martin-dorey-hv
Copy link
Contributor

The first of the five commits here fixes #440. The next two commits are for build issues that I suffered on Debian Buster, so perhaps minority interest things. I needed the fourth to be able to run the libsmb2 test suite on that platform but I think it's a generic Linux fix. The fifth adds a test to that suite, one which often reproduces the issue when run against an unfixed build of libsmb2 and hasn't reproduced the issue against a fixed build.

martindorey and others added 5 commits November 3, 2025 13:16
lib/socket.c: The credit_charge field was reserved in SMB2_VERSION_0202, hence set to zero, but [MS-SMB2] 3.2.4.1.3 effectively requires a credit of one per PDU anyway.
configure.ac: Do we really need autoconf 2.71?  It seems to work for me on Debian Buster with 2.69.
configure.ac: This was Google's synthetic stupidity's prescription for:

/usr/bin/ld: prog_ls.o: undefined reference to symbol 'dlsym@@GLIBC_2.2.5'

... seen on Debian Buster in the tests/ directory.
tests/prog_ls.c: Apparently Linux's dlsym uses calloc in its implementation, presenting a challenge for anyone hoping to shim calloc using dlsym.  https://stackoverflow.com/questions/7910666/problems-with-ld-preload-and-calloc-interposition-for-certain-executables doesn't just tell us that, though, it tells us that we can safely return NULL to dlsym to break the recursion.  I haven't verified that we still take the expected paths with the alloc_fail cleverness but this gets prog_ls up and working.
tests/metastat-0202-censored.c: Amit Brahmbhatt's reproducer with just two changes from the original:
* the SMB2 dialect hard-coded to 2.0.2, for ease of testing particularly against the likes of Windows Server 2008 R2, where I know of no documented interface for changing that on the Windows end
* the useful local example credentials elided for teh security

tests/test_0400_overdrawn_0202.sh: A driver script for the most recent evolution of the invocation of that.  H/T https://stackoverflow.com/a/356154/18096 for the way to collect the exit statuses, which looks like Bash to me.  Having joined battle with prog_ls, I use that to find a filename on the server to stat against, making the assumption that there is one.

When I ran this standalone just now against Windows Server 2008 R2, it passed 10 out of 10 attempts with the suggested fix and failed 8 out of 10 attempts without the fix.

tests/Makefile.am: I need to add that to the list of programs needing compilation.  I like my Makefile lists to have one thing per line, in alphabetical order, to ease navigation of the history.
@sahlberg sahlberg merged commit 9f64a45 into sahlberg:master Nov 24, 2025
16 checks passed
@sahlberg
Copy link
Owner

Merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

overdrawn credit with SMB2_VERSION_0202

3 participants