INN commit: trunk (configure.ac frontends/inews.c)
INN Commit
rra at isc.org
Wed Jul 27 19:47:58 UTC 2011
Date: Wednesday, July 27, 2011 @ 12:47:58
Author: iulius
Revision: 9292
fix issues with calls to getgroups()
Properly check that the getgroups() functions exists and works before
trying to use it.
Also use GETGROUPS_T set by configure to be whichever of gid_t or int is
the base type of the array argument to getgroups().
Modified:
trunk/configure.ac
trunk/frontends/inews.c
-------------------+
configure.ac | 1 +
frontends/inews.c | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
Modified: configure.ac
===================================================================
--- configure.ac 2011-07-27 18:27:54 UTC (rev 9291)
+++ configure.ac 2011-07-27 19:47:58 UTC (rev 9292)
@@ -420,6 +420,7 @@
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
+AC_FUNC_GETGROUPS
AC_TYPE_UID_T
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_TYPES([sig_atomic_t], , ,
Modified: frontends/inews.c
===================================================================
--- frontends/inews.c 2011-07-27 18:27:54 UTC (rev 9291)
+++ frontends/inews.c 2011-07-27 19:47:58 UTC (rev 9292)
@@ -351,23 +351,25 @@
/* See if we are in the right group and examine process
* supplementary groups, rather than the group(5) file entry.
*/
+#ifdef HAVE_GETGROUPS
{
int ngroups = getgroups(0, 0);
- gid_t *groups, *gp;
+ GETGROUPS_T *groups, *gp;
int rv;
int rest;
- groups = (gid_t *) xmalloc(ngroups * sizeof(*groups));
+ groups = (GETGROUPS_T *) xmalloc(ngroups * sizeof(GETGROUPS_T));
if ((rv = getgroups(ngroups, groups)) < 0) {
/* Silent failure; client doesn't have the group. */
return false;
}
for (rest = ngroups, gp = groups; rest > 0; rest--, gp++) {
- if (*gp == news_gid)
+ if (*gp == (GETGROUPS_T) news_gid)
return true;
}
}
-
+#endif
+
return false;
}
More information about the inn-committers
mailing list