From 701cfaf22ea4ca2e40cacb6a1fd35d7f8df01c43 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 12 Nov 2024 14:32:33 +0100 Subject: [PATCH 1/8] configure.ac, lib/: Use __has_include() instead of HAVE_CRYPT_H Signed-off-by: Alejandro Colomar --- configure.ac | 2 +- lib/defines.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6c19eedef..c82b46509 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ LT_LIB_DLLOAD dnl Checks for libraries. dnl Checks for header files. -AC_CHECK_HEADERS(crypt.h utmp.h \ +AC_CHECK_HEADERS(utmp.h \ termio.h sgtty.h sys/ioctl.h paths.h \ sys/capability.h sys/random.h \ gshadow.h lastlog.h rpc/key_prot.h acl/libacl.h \ diff --git a/lib/defines.h b/lib/defines.h index 5f9ed4d1c..89300c93c 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -41,7 +41,7 @@ * crypt(3), crypt_gensalt(3), and their * feature test macros may be defined in here. */ -#if HAVE_CRYPT_H +#if __has_include() # include #endif From 0528518fd4024c54d0de43bc54ee9a720982c946 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 12 Nov 2024 14:34:36 +0100 Subject: [PATCH 2/8] configure.ac, lib/: Use __has_include() instead of HAVE_SYS_RANDOM_H Signed-off-by: Alejandro Colomar --- configure.ac | 2 +- lib/csrand.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index c82b46509..42a0a12d2 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(utmp.h \ termio.h sgtty.h sys/ioctl.h paths.h \ - sys/capability.h sys/random.h \ + sys/capability.h \ gshadow.h lastlog.h rpc/key_prot.h acl/libacl.h \ attr/libattr.h attr/error_context.h) diff --git a/lib/csrand.c b/lib/csrand.c index 1914a3036..def32be2e 100644 --- a/lib/csrand.c +++ b/lib/csrand.c @@ -10,8 +10,8 @@ #include #include #include -#if HAVE_SYS_RANDOM_H -#include +#if __has_include() +# include #endif #include "bit.h" From 6b8b181c03b88c9391171c411486e591c944bdca Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 12 Nov 2024 14:38:10 +0100 Subject: [PATCH 3/8] lib/: Use __has_include() instead of HAVE_SECURITY_PAM_MISC_H Signed-off-by: Alejandro Colomar --- lib/pam_defs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pam_defs.h b/lib/pam_defs.h index dd016e5cc..7eeb5d621 100644 --- a/lib/pam_defs.h +++ b/lib/pam_defs.h @@ -6,8 +6,9 @@ */ #include + #include -#ifdef HAVE_SECURITY_PAM_MISC_H +#if __has_include() # include #endif #ifdef HAVE_SECURITY_OPENPAM_H From def67acb0b0a110fd83678d90004809bc996dbbd Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 12 Nov 2024 14:39:03 +0100 Subject: [PATCH 4/8] lib/: Use __has_include() instead of HAVE_SECURITY_OPENPAM_H Signed-off-by: Alejandro Colomar --- lib/pam_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pam_defs.h b/lib/pam_defs.h index 7eeb5d621..f12e7d4d8 100644 --- a/lib/pam_defs.h +++ b/lib/pam_defs.h @@ -11,7 +11,7 @@ #if __has_include() # include #endif -#ifdef HAVE_SECURITY_OPENPAM_H +#if __has_include() # include #endif From fb3ceb68004e10cae3a41cab94382dcaa7c6177a Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 12 Nov 2024 14:42:12 +0100 Subject: [PATCH 5/8] lib/idmapping.c: Unconditionally include It's a widely available header. Signed-off-by: Alejandro Colomar --- lib/idmapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/idmapping.c b/lib/idmapping.c index 89c03b101..cef73b4f4 100644 --- a/lib/idmapping.c +++ b/lib/idmapping.c @@ -12,8 +12,8 @@ #include #include #include -#if HAVE_SYS_CAPABILITY_H #include +#if HAVE_SYS_CAPABILITY_H #include #endif From d3981f3a5fff332d264ed6c6a09376efa9dd66cf Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 12 Nov 2024 14:45:08 +0100 Subject: [PATCH 6/8] configure.ac, lib/: Use __has_include() instead of HAVE_SYS_CAPABILITY_H Signed-off-by: Alejandro Colomar --- configure.ac | 1 - lib/idmapping.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 42a0a12d2..adec5065a 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,6 @@ dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(utmp.h \ termio.h sgtty.h sys/ioctl.h paths.h \ - sys/capability.h \ gshadow.h lastlog.h rpc/key_prot.h acl/libacl.h \ attr/libattr.h attr/error_context.h) diff --git a/lib/idmapping.c b/lib/idmapping.c index cef73b4f4..ef685f326 100644 --- a/lib/idmapping.c +++ b/lib/idmapping.c @@ -13,8 +13,8 @@ #include #include #include -#if HAVE_SYS_CAPABILITY_H -#include +#if __has_include() +# include #endif #include "alloc/calloc.h" @@ -86,7 +86,7 @@ get_map_ranges(int ranges, int argc, char **argv) */ #define ULONG_DIGITS (((WIDTHOF(unsigned long) + 9)/10)*3) -#if HAVE_SYS_CAPABILITY_H +#if __has_include() static inline bool maps_lower_root(int cap, int ranges, const struct map_range *mappings) { int idx; @@ -129,7 +129,7 @@ void write_mapping(int proc_dir_fd, int ranges, const struct map_range *mappings char *buf, *pos, *end; int fd; -#if HAVE_SYS_CAPABILITY_H +#if __has_include() int cap; struct __user_cap_header_struct hdr = {_LINUX_CAPABILITY_VERSION_3, 0}; struct __user_cap_data_struct data[2] = {{0}}; From fdba1d155b198beff3626b8e193b628afd91666b Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 12 Nov 2024 14:48:52 +0100 Subject: [PATCH 7/8] configure.ac: Remove unused AC_CHECK_HEADERS() checks $ grep -rE 'HAVE_(UTMP)_H' $ grep -rE 'HAVE_(TERMIO|SGTTY|SYS_IOCTL|PATHS)_H' $ grep -rE 'HAVE_(LASTLOG|RPC_KEY_PROT|ACL_LIBACL)_H' $ grep -rE 'HAVE_(ATTR_LIBATTR|ATTR_ERROR_CONTEXT)_H' $ Signed-off-by: Alejandro Colomar --- configure.ac | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index adec5065a..0cb425a25 100644 --- a/configure.ac +++ b/configure.ac @@ -37,10 +37,7 @@ LT_LIB_DLLOAD dnl Checks for libraries. dnl Checks for header files. -AC_CHECK_HEADERS(utmp.h \ - termio.h sgtty.h sys/ioctl.h paths.h \ - gshadow.h lastlog.h rpc/key_prot.h acl/libacl.h \ - attr/libattr.h attr/error_context.h) +AC_CHECK_HEADERS(gshadow.h) dnl shadow now uses the libc's shadow implementation AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])]) From d091b40b9da1852524d16c6c26252768d358a197 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 27 Jan 2025 13:23:57 +0100 Subject: [PATCH 8/8] configure.ac, lib/: Use __has_include() instead of HAVE_GSHADOW_H Signed-off-by: Alejandro Colomar --- configure.ac | 3 --- lib/gshadow.c | 2 +- lib/gshadow_.h | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 0cb425a25..c4dde3a8b 100644 --- a/configure.ac +++ b/configure.ac @@ -36,9 +36,6 @@ LT_LIB_DLLOAD dnl Checks for libraries. -dnl Checks for header files. -AC_CHECK_HEADERS(gshadow.h) - dnl shadow now uses the libc's shadow implementation AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])]) diff --git a/lib/gshadow.c b/lib/gshadow.c index d1ca70706..2725e09eb 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -9,7 +9,7 @@ #include -#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H) +#if defined(SHADOWGRP) && !__has_include() #ident "$Id$" diff --git a/lib/gshadow_.h b/lib/gshadow_.h index be1f0f1c2..2b38cb338 100644 --- a/lib/gshadow_.h +++ b/lib/gshadow_.h @@ -9,7 +9,7 @@ #define SHADOW_INCLUDE_LIB_GSHADOW__H_ -#if defined(HAVE_GSHADOW_H) +#if __has_include() # include #else @@ -41,5 +41,5 @@ int putsgent (const struct sgrp *, FILE *); #define GSHADOW "/etc/gshadow" -#endif // !HAVE_GSHADOW_H +#endif // !__has_include() #endif // include guard