git: cc5276aed0c7 - main - libutil: Fix login_setcryptfmt()

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Wed, 06 Aug 2025 20:43:41 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=cc5276aed0c779dedfe2603c746620ed9f3e97d2

commit cc5276aed0c779dedfe2603c746620ed9f3e97d2
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-08-06 20:34:26 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-08-06 20:43:13 +0000

    libutil: Fix login_setcryptfmt()
    
    Our dummy crypt_set_format() needs to be exported, otherwise it will
    be resolved at link time instead of load time, preventing the real
    crypt_set_format() in libcrypt from replacing it when present.
    
    PR:             288677
    Fixes:          0c381b7f0570
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D51746
---
 lib/libutil/Symbol.map | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/libutil/Symbol.map b/lib/libutil/Symbol.map
index 6b8a1ec099bf..2b28456f4406 100644
--- a/lib/libutil/Symbol.map
+++ b/lib/libutil/Symbol.map
@@ -120,6 +120,14 @@ FBSD_1.8 {
 	uu_lock;
 	uu_lockerr;
 	uu_unlock;
+
+	/*
+	 * login_setcryptfmt() uses crypt_set_format() from libcrypt.  To
+	 * avoid forcing a hard dependency on libcrypt, we provide a weak
+	 * stub.  Applications that use login_setcryptfmt() should link
+	 * with libcrypt, whose crypt_set_format() will override the stub.
+	 */
+	crypt_set_format;
 };
 
 FBSDprivate_1.0 {