-
-
Notifications
You must be signed in to change notification settings - Fork 750
Keepalived fails to resolve script group names when group have large numbers of members. #2605
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
Comments
@awalls-cx18 I don't particularly like the code at https://tomlee.co/2012/10/problems-with-large-linux-unix-groups-and-getgrgid_r-getgrnam_r/. The first example doesn't even compile, since there is an extraneous I think a reasonable assumption is that the size of the list of usernames returned as members of the group cannot exceed the size of the /etc/group file itself. Would you be happy with the following patch?
This has the advantage of avoiding a loop repeatedly calling |
Commit d9c5f4b should resolve this. |
The solution looks fine to me. Thanks! |
Describe the bug
Keepalived fails to resolve script group names when group have large numbers of members.
The call to
getgrnam_r()
inlib/notify.c
returns witherrno
ERANGE
, indicating the provided buffer is not large enough.To Reproduce
Have a group
foogroup
in/etc/group
with many members, so that the list of all the names exceeds ~1024 bytes, the glibc default forsysconf(_SC_GETGR_R_SIZE_MAX)
on many systems. (This is just a glibc hard coded suggested default for the buffersize for thegetgrnam_r()
call).In the
keepalived.conf
fileglobal_defs
section setscript_user baruser foogroup
. That will be enough forkeepalived
to emitUnable to resolve default script group name ...
message, griping about the group name, even though it exists in the/etc/group
file.Expected behavior
keepalived
allows setting script group to a group with a large number of member without error.Keepalived version
Distro (please complete the following information):
Did keepalived coredump?
No.
Additional context
The proper way to deal with
getgrnam_r()
returning with anerrno
ofERANGE
is to resize/reallocate the buffer to a larger buffer and try the call togetgrnam_r()
again.See this blog post:
https://tomlee.co/2012/10/problems-with-large-linux-unix-groups-and-getgrgid_r-getgrnam_r/
The text was updated successfully, but these errors were encountered: