Skip to content

check for duplicate ACL entries when applying listen.acl_* #18362

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ivan-u7n
Copy link

@ivan-u7n ivan-u7n commented Apr 20, 2025

otherwise FPM fails to start with Invalid argument (22)
fixes GH-18357

….acl_groups

otherwise FPM fails to start with `Invalid argument (22)`
@ivan-u7n ivan-u7n requested a review from bukka as a code owner April 20, 2025 07:19
Copy link
Member

@bukka bukka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for slight delay in review.

I think the logic makes sense (except the few mentioned issues).

It would be also good to add a test for this. We got some basic ACL tests but this might slightly more complex. If it's too hard for you, let me know I will try to come up with something.

return -1;
}
if (tagconf == ACL_USER) {
uidconf = acl_get_qualifier(entryfile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entryfile is not initialized so I assume you wanted to use entryconf here, right?

return -1;
}
} else {
gidconf = acl_get_qualifier(entryfile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@@ -300,7 +303,67 @@ int fpm_unix_set_socket_permissions(struct fpm_worker_pool_s *wp, const char *pa
return -1;
}
/* Copy the new ACL entry from config */
for (i=ACL_FIRST_ENTRY ; acl_get_entry(aclconf, i, &entryconf) ; i=ACL_NEXT_ENTRY) {
for (iconf=ACL_FIRST_ENTRY ; acl_get_entry(aclconf, iconf, &entryconf) ; iconf=ACL_NEXT_ENTRY) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: might be good to fix the CS when you are in it:

Suggested change
for (iconf=ACL_FIRST_ENTRY ; acl_get_entry(aclconf, iconf, &entryconf) ; iconf=ACL_NEXT_ENTRY) {
for (iconf = ACL_FIRST_ENTRY; acl_get_entry(aclconf, iconf, &entryconf); iconf = ACL_NEXT_ENTRY) {

return -1;
}
}
for (ifile=ACL_FIRST_ENTRY ; acl_get_entry(aclfile, ifile, &entryfile) ; ifile=ACL_NEXT_ENTRY) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: another CS style fix

Suggested change
for (ifile=ACL_FIRST_ENTRY ; acl_get_entry(aclfile, ifile, &entryfile) ; ifile=ACL_NEXT_ENTRY) {
for (ifile = ACL_FIRST_ENTRY; acl_get_entry(aclfile, ifile, &entryfile); ifile = ACL_NEXT_ENTRY) {

@bukka
Copy link
Member

bukka commented Jun 12, 2025

btw. this was just an initial look (needed to also spent a bit time to get myself a bit more familiar with ACL) so will need check it out more and do some testing later to see if it all works fine. Well, ideally we want to have a working test for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

php-fpm listen.acl_users and listen.acl_groups not checking for duplicate ACL entries causing Invalid argument (22)
2 participants