[openssh-commits] [openssh] branch master updated: more diagnostics when getgrouplist fails
git+noreply at mindrot.org
git+noreply at mindrot.org
Sat Jul 12 08:37:29 AEST 2025
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
The following commit(s) were added to refs/heads/master by this push:
new 1052fa62b more diagnostics when getgrouplist fails
1052fa62b is described below
commit 1052fa62b35e0bb25b0c1efb9fdd7870e4a68ab6
Author: Damien Miller <djm at mindrot.org>
AuthorDate: Fri Jul 11 15:36:49 2025 -0700
more diagnostics when getgrouplist fails
---
groupaccess.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/groupaccess.c b/groupaccess.c
index 9d03ded0c..b85782472 100644
--- a/groupaccess.c
+++ b/groupaccess.c
@@ -50,21 +50,24 @@ int
ga_init(const char *user, gid_t base)
{
gid_t *groups_bygid;
- int i, j, retry = 0;
+ int ongroups, i, j, retry = 0;
struct group *gr;
if (ngroups > 0)
ga_free();
- ngroups = NGROUPS_MAX;
+ ongroups = ngroups = NGROUPS_MAX;
#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
- ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
+ ongroups = ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
#endif
groups_bygid = xcalloc(ngroups, sizeof(*groups_bygid));
while (getgrouplist(user, base, groups_bygid, &ngroups) == -1) {
- if (retry++ > 0)
- fatal("getgrouplist: groups list too small");
+ if (retry++ > 0) {
+ fatal("getgrouplist(\"%s\", %ld): groups list too big "
+ "(have %ld, need %ld)", user, (long)base,
+ (long)ongroups, (long)ngroups);
+ }
groups_bygid = xreallocarray(groups_bygid, ngroups,
sizeof(*groups_bygid));
}
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list