Change #238069
Category | curl |
Changed by | Viktor Szakats <commit | @vsz.me>
Changed at | Tue 01 Jul 2025 00:17:15 |
Repository | https://github.com/curl/curl.git |
Project | curl |
Branch | master |
Revision | 73840836a51c443e6b5d385014ce1c8f5be3e02b |
Comments
tests: move GSS-API dynamic stub into debug-mode libcurl Replace the `libstubgss.so`-based overload solution with one built into libcurl at compile-time. The previous, `LD_PRELOAD`-based, solution was non-portable, allowlisted for Linux, BSD and Solaris. It also required non-debug builds, which turned out to be an accidental condition: 7d342c723c5ae8e9312210936287810741f40bc5. It also required a curl tool built against a shared libcurl. Detecting this condition wasn't always accurate, e.g. with certain cmake configurations. The overload solution also didn't work on macOS, though it theoretically should have: - #17653 - #2394 Experiments on making the overload solution work in more envs: - #17759 That revealed that it also did not work on NetBSD, in CI. The replacement solution is overloading the necessary GSS-API functions for test 2056 and 2057 at compile time. It requires a debug-enabled curl build (due to its insecure nature). This makes these tests run on all platforms. Including most GSS jobs in CI, that are running tests. (the exception is old-linux, non-debug jobs, where it felt overkill to enable debug for this.) The refactored GSS stub code needs to overload less than before because it's free to use the official GSS API. (This didn't work with the overload solution on Alpine for example). It can also use libcurl functions, allowing to replace `snprintf()` with `msnprintf()`. OS/400 is also overloading GSS API functions. I haven't tested how this works after this PR. In theory it should, because this PR doesn't rely on preprocessor overrides. Note that for future GSS tests, it may be necessary to stub these GSS API functions: `gss_inquire_context()`, `gss_unwrap()`, `gss_wrap()`. They are on codepaths not (yet) touched by tests. Also: - stub-gss: check for token buffer overrun. - stub-gss: replace size macros with `sizeof()`. - GHA: enable debug for some jobs with GSS. - GHA/linux: ignore results for 2056 and 2057 in the valgrind job. They leak the same way as seen with 2077 and 2078. Ref: 7020ba797961d38c3bf24539f9bb407e0586274d #17462 Ref: 146759716cbacfd453b9fb13d1096f0595424a6c #14430 - GHA/linux: fix to ignore `gss_import_name()` leaks in valgrind builds. only. - lib/vauth/krb5_gssapi: reduce variable scope. - lib/vauth/spnego_gssapi: reduce variable scope. - tests/libtest: drop code and build logic dealing with `libstubgss`. - runtests: - drop `ld_preload` feature. - drop special handling of `LD_PRELOAD` env in tests. - drop logic dealing with shared curl tool detection. - drop `LD_PRELOAD` envs from tests. Follow-up to 56d949d31ad182a22bd3bad25b1a902b635d549d #1687 Closes #17752
Changed files
- .github/workflows/linux.yml
- .github/workflows/macos.yml
- docs/tests/FILEFORMAT.md
- lib/curl_gssapi.c
- lib/curl_gssapi.h
- lib/krb5.c
- lib/socks_gssapi.c
- lib/vauth/krb5_gssapi.c
- lib/vauth/spnego_gssapi.c
- tests/data/test2056
- tests/data/test2057
- tests/globalconfig.pm
- tests/libtest/CMakeLists.txt
- tests/libtest/Makefile.am
- tests/libtest/Makefile.inc
- tests/libtest/stub_gssapi.c
- tests/libtest/stub_gssapi.h
- tests/runner.pm
- tests/runtests.pl