From 30bbcea2b7a142c7e361806f5fdf0e145b915f7d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Thu, 10 Nov 2022 18:34:12 +0000 Subject: [PATCH 1/1] src/uid_wrapper.c: Avoid dclose(RTLD_NEXT) In case the libc was not found and RTLD_NEXT is used instead, we should not dlclose it, otherwise mayhem happens. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15228 Signed-off-by: Samuel Thibault Reviewed-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- src/uid_wrapper.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uid_wrapper.c b/src/uid_wrapper.c index 1b1473b..0480394 100644 --- a/src/uid_wrapper.c +++ b/src/uid_wrapper.c @@ -2512,7 +2512,11 @@ void uwrap_destructor(void) } - if (uwrap.libc.handle != NULL) { + if (uwrap.libc.handle != NULL +#ifdef RTLD_NEXT + && uwrap.libc.handle != RTLD_NEXT +#endif + ) { dlclose(uwrap.libc.handle); } -- 2.34.1