]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
libsubid: Fail on plugin loading if no subid_free provided
authorDaniel Bershatsky <d.bershatsky2@skoltech.ru>
Wed, 12 Jun 2024 17:07:23 +0000 (20:07 +0300)
committerAlejandro Colomar <alx@kernel.org>
Wed, 12 Jun 2024 19:45:31 +0000 (21:45 +0200)
lib/nss.c
tests/libsubid/04_nss/libsubid_zzz.c

index 0f414e188879681c90b590e41561ff60c820a118..dcb8160bdd2cdb89eb196d0d645c2e2dece8ab31 100644 (file)
--- a/lib/nss.c
+++ b/lib/nss.c
@@ -133,8 +133,8 @@ void nss_init(const char *nsswitch_path) {
        }
        subid_nss->free = dlsym(h, "shadow_subid_free");
        if (!subid_nss->free) {
-               // Fallback to free(3) for backward compatibility.
-               subid_nss->free = free;
+               fprintf(shadow_logfd, "%s did not provide @subid_free@\n", libname);
+               goto close_lib;
        }
        subid_nss->handle = h;
        goto done;
index 1a9de2375c2be27dfe8042900cb8841a2e1bafb8..06cb38b44bf0dcc099ddb8c93ff42dfbdae62e95 100644 (file)
@@ -138,3 +138,7 @@ enum subid_status shadow_subid_list_owner_ranges(const char *owner, enum subid_t
 
        return SUBID_STATUS_SUCCESS;
 }
+
+void shadow_subid_free(void *ptr) {
+       free(ptr);
+}