diff --git a/ChangeLog b/ChangeLog index 73f74824..de1f02bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-08-13 Nicolas François + + * configure.in: Check if sizeof uid_t and gid_t is larger than 32 + bit to support subordinate IDs. + 2013-08-13 Nicolas François * lib/subordinateio.c: Avoid dead branches. diff --git a/configure.in b/configure.in index d11a3649..1a3f8418 100644 --- a/configure.in +++ b/configure.in @@ -244,7 +244,7 @@ AC_ARG_ENABLE(subordinate-ids, [AC_HELP_STRING([--enable-subordinate-ids], [support subordinate ids @<:@default=yes@:>@])], [enable_subids="${enableval}"], - [enable_subids="yes"] + [enable_subids="maybe"] ) AC_ARG_WITH(audit, @@ -331,12 +331,28 @@ if test "$enable_man" = "yes"; then fi AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno") -if test "$enable_subids" = "yes"; then +if test "$enable_subids" != "no"; then dnl dnl FIXME: check if 32 bit UIDs/GIDs are supported by libc dnl - AC_DEFINE(ENABLE_SUBIDS, 1, [Define to support the subordinate IDs.]) - enable_subids="yes" + AC_RUN_IFELSE([AC_LANG_SOURCE([ +#include +int main(void) { + uid_t u; + gid_t g; + return (sizeof u < 4) || (sizeof g < 4); +} + ])], [id32bit="yes"], [id32bit="no"]) + + if test "x$id32bit" = "xyes"; then + AC_DEFINE(ENABLE_SUBIDS, 1, [Define to support the subordinate IDs.]) + enable_subids="yes" + else + if test "x$enable_subids" = "xyes"; then + AC_MSG_ERROR([Cannot enable support the subordinate IDs on systems where gid_t or uid_t has less than 32 bits]) + fi + enable_subids="no" + fi fi AM_CONDITIONAL(ENABLE_SUBIDS, test "x$enable_subids" != "xno")