don't. */
#undef HAVE_DECL_LLONG_MIN
-/* Define to 1 if you have the declaration of `OPEN_MAX', and to 0 if you
- don't. */
-#undef HAVE_DECL_OPEN_MAX
-
/* Define to 1 if you have the declaration of `PATH_MAX', and to 0 if you
don't. */
#undef HAVE_DECL_PATH_MAX
/* Define to 1 if your struct stat uses an st__tim union. */
#undef HAVE_ST__TIM
-/* Define to 1 if you have the `sysconf' function. */
-#undef HAVE_SYSCONF
-
/* Define to 1 if you have the `sysctl' function. */
#undef HAVE_SYSCTL
as_fn_append ac_func_list " killpg"
as_fn_append ac_func_list " nl_langinfo"
as_fn_append ac_func_list " strftime"
-as_fn_append ac_func_list " sysconf"
as_fn_append ac_func_list " tzset"
as_fn_append ac_func_list " seteuid"
# Check that the precious variables saved in the cache have kept the same
-
-
for ac_func in getgrouplist
do :
ac_fn_c_check_func "$LINENO" "getgrouplist" "ac_cv_func_getgrouplist"
_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $OSDEFS"
-ac_fn_c_check_decl "$LINENO" "OPEN_MAX" "ac_cv_have_decl_OPEN_MAX" "
-#include <sys/types.h>
-#include <limits.h>
-
-"
-if test "x$ac_cv_have_decl_OPEN_MAX" = xyes; then :
- ac_have_decl=1
-else
- ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_OPEN_MAX $ac_have_decl
-_ACEOF
ac_fn_c_check_decl "$LINENO" "LLONG_MAX" "ac_cv_have_decl_LLONG_MAX" "
#include <sys/types.h>
#include <limits.h>
dnl Function checks
dnl
AC_FUNC_GETGROUPS
-AC_CHECK_FUNCS_ONCE([killpg nl_langinfo strftime sysconf tzset])
+AC_CHECK_FUNCS_ONCE([killpg nl_langinfo strftime tzset])
AC_CHECK_FUNCS([getgrouplist], [], [
case "$host_os" in
aix*)
dnl
_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $OSDEFS"
-AC_CHECK_DECLS([OPEN_MAX, LLONG_MAX, LLONG_MIN, ULLONG_MAX, PATH_MAX, HOST_NAME_MAX], [], [], [
+AC_CHECK_DECLS([LLONG_MAX, LLONG_MIN, ULLONG_MAX, PATH_MAX, HOST_NAME_MAX], [], [], [
#include <sys/types.h>
#include <limits.h>
])
/*
* Some systems lack full limit definitions.
*/
-#if defined(HAVE_DECL_OPEN_MAX) && !HAVE_DECL_OPEN_MAX
-# define OPEN_MAX 256
-#endif
-
#if defined(HAVE_DECL_LLONG_MAX) && !HAVE_DECL_LLONG_MAX
# if defined(HAVE_DECL_QUAD_MAX) && HAVE_DECL_QUAD_MAX
# define LLONG_MAX QUAD_MAX
/*
- * Copyright (c) 2004-2005, 2007, 2010, 2012-2014
+ * Copyright (c) 2004-2005, 2007, 2010, 2012-2015
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
#include "sudo_compat.h"
+#ifndef _POSIX_OPEN_MAX
+# define _POSIX_OPEN_MAX 20
+#endif
+
#if defined(HAVE_FCNTL_CLOSEM) && !defined(HAVE_DIRFD)
# define sudo_closefrom closefrom_fallback
#endif
long fd, maxfd;
/*
- * Fall back on sysconf() or getdtablesize(). We avoid checking
+ * Fall back on sysconf(_SC_OPEN_MAX). We avoid checking
* resource limits since it is possible to open a file descriptor
* and then drop the rlimit such that it is below the open fd.
*/
-#ifdef HAVE_SYSCONF
maxfd = sysconf(_SC_OPEN_MAX);
-#else
- maxfd = getdtablesize();
-#endif /* HAVE_SYSCONF */
if (maxfd < 0)
- maxfd = OPEN_MAX;
+ maxfd = _POSIX_OPEN_MAX;
for (fd = lowfd; fd < maxfd; fd++) {
#ifdef __APPLE__
rval = setgroups(ngids, (GETGROUPS_T *)gids);
if (rval == -1 && errno == EINVAL) {
/* Too many groups, try again with fewer. */
-#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
maxgids = (int)sysconf(_SC_NGROUPS_MAX);
if (maxgids == -1)
-#endif
maxgids = NGROUPS_MAX;
if (ngids > maxgids)
rval = setgroups(maxgids, (GETGROUPS_T *)gids);
gids = sudo_emallocarray(ngids, sizeof(GETGROUPS_T));
(void)getgrouplist(pw->pw_name, pw->pw_gid, gids, &ngids);
} else {
-#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
ngids = (int)sysconf(_SC_NGROUPS_MAX) * 2;
if (ngids < 0)
-#endif
ngids = NGROUPS_MAX * 2;
gids = sudo_emallocarray(ngids, sizeof(GETGROUPS_T));
if (getgrouplist(pw->pw_name, pw->pw_gid, gids, &ngids) == -1) {
aix_setauthdb((char *) pw->pw_name);
#endif
-#if defined(HAVE_SYSCONF) && defined(_SC_LOGIN_NAME_MAX)
+#ifdef _SC_LOGIN_NAME_MAX
groupname_len = MAX((int)sysconf(_SC_LOGIN_NAME_MAX), 32);
#else
groupname_len = MAX(LOGIN_NAME_MAX, 32);
int i, len, maxgroups, group_source;
debug_decl(get_user_groups, SUDO_DEBUG_UTIL)
-#if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
maxgroups = (int)sysconf(_SC_NGROUPS_MAX);
if (maxgroups < 0)
-#endif
maxgroups = NGROUPS_MAX;
ud->groups = NULL;