From eaf5b83a5b36f05ca67c85e32f940c816c5d561a Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Mon, 16 Feb 2026 15:36:37 -0500 Subject: [PATCH] configure.ac: fix detection of secure_getenv lib/defines.h was looking for HAVE_SECURE_GETENV instead of of HAS_SECURE_GETENV as defined in configure. This resulted in shadow_getenv always being defined to getenv. AC_CHECK_FUNC is linker test; it does not check for declarations. Replace this with AC_CHECK_DECLS/HAVE_DECL_SECURE_GETENV. Fixes: 3d921155e0a7 (2019-03-31; "gettime: Use secure_getenv over getenv.") Signed-off-by: Mike Gilbert --- configure.ac | 4 +--- lib/defines.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index a5030b028..5341d36bf 100644 --- a/configure.ac +++ b/configure.ac @@ -68,9 +68,7 @@ AC_REPLACE_FUNCS([putgrent putpwent putspent]) AC_REPLACE_FUNCS([sgetgrent sgetpwent sgetspent]) AC_CHECK_FUNC([setpgrp]) -AC_CHECK_FUNC([secure_getenv], - [AC_DEFINE([HAS_SECURE_GETENV],[1],[Defined to 1 if you have the declaration of 'secure_getenv'])] -) +AC_CHECK_DECLS([secure_getenv]) AC_CACHE_CHECK([location of shared mail directory], [shadow_cv_maildir], [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do diff --git a/lib/defines.h b/lib/defines.h index 09c0965a0..3277dfeb3 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -174,7 +174,7 @@ /* Maximum length of passwd entry */ #define PASSWD_ENTRY_MAX_LENGTH 32768 -#ifdef HAVE_SECURE_GETENV +#if HAVE_DECL_SECURE_GETENV # define shadow_getenv(name) secure_getenv(name) # else # define shadow_getenv(name) getenv(name) -- 2.47.3