Skip to content

Simplify FPM ACL check #13604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 12 additions & 35 deletions sapi/fpm/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,11 @@ if test "$PHP_FPM" != "no"; then
if test "$PHP_FPM_ACL" != "no" ; then
AC_CHECK_HEADERS([sys/acl.h])

AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
int main(void)
{
dnl *BSD has acl_* built into libc, macOS doesn't have user/group support.
LIBS_save="$LIBS"
AC_SEARCH_LIBS([acl_free], [acl], [
AC_MSG_CHECKING([for acl user/group permissions support])
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/acl.h>], [
acl_t acl;
acl_entry_t user, group;
acl = acl_init(1);
Expand All @@ -500,39 +502,14 @@ if test "$PHP_FPM" != "no"; then
acl_create_entry(&acl, &group);
acl_set_tag_type(user, ACL_GROUP);
acl_free(acl);
return 0;
}
]])], [
AC_CHECK_LIB(acl, acl_free,
[PHP_ADD_LIBRARY(acl)
have_fpm_acl=yes
],[
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/acl.h>
int main(void)
{
acl_t acl;
acl_entry_t user, group;
acl = acl_init(1);
acl_create_entry(&acl, &user);
acl_set_tag_type(user, ACL_USER);
acl_create_entry(&acl, &group);
acl_set_tag_type(user, ACL_GROUP);
acl_free(acl);
return 0;
}
]])],[have_fpm_acl=yes],[have_fpm_acl=no],[have_fpm_acl=no])
])
], [
have_fpm_acl=no
])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_FPM_ACL], [1], [Whether FPM has acl support])
], [
AC_MSG_RESULT([no])
LIBS="$LIBS_save"
])
])

AC_MSG_CHECKING([for acl user/group permissions support])
if test "$have_fpm_acl" = "yes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_FPM_ACL], 1, [do we have acl support?])
else
AC_MSG_RESULT([no])
fi
fi

if test "x$PHP_FPM_APPARMOR" != "xno" ; then
Expand Down