src/uid_wrapper.c: Avoid dclose(RTLD_NEXT)
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Thu, 10 Nov 2022 18:34:12 +0000 (18:34 +0000)
committerAndreas Schneider <asn@samba.org>
Tue, 17 Jan 2023 13:25:46 +0000 (14:25 +0100)
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 <samuel.thibault@ens-lyon.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
src/uid_wrapper.c

index 1b1473be345fbcd628b6386a4dac7ec58684f595..0480394bcb51e7cbb0fb98fb69ad7c6e8dec95fa 100644 (file)
@@ -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);
        }