2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

Sudo assumes that a uid_t can be cast to unsigned int without problems.

Add a configure check and error out if sizeof(uid_t) > 4.
This commit is contained in:
Todd C. Miller 2023-09-20 11:25:48 -06:00
parent f4acc43663
commit 0c67456923
3 changed files with 46 additions and 0 deletions

View File

@ -1306,6 +1306,9 @@
/* The size of 'time_t', as computed by sizeof. */ /* The size of 'time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T #undef SIZEOF_TIME_T
/* The size of 'uid_t', as computed by sizeof. */
#undef SIZEOF_UID_T
/* Define to 1 to compile the sudoers plugin statically into the sudo binary. /* Define to 1 to compile the sudoers plugin statically into the sudo binary.
*/ */
#undef STATIC_SUDOERS_PLUGIN #undef STATIC_SUDOERS_PLUGIN

40
configure vendored
View File

@ -21011,6 +21011,46 @@ printf "%s\n" "$ac_cv_sizeof_time_t" >&6; }
printf "%s\n" "#define SIZEOF_TIME_T $ac_cv_sizeof_time_t" >>confdefs.h printf "%s\n" "#define SIZEOF_TIME_T $ac_cv_sizeof_time_t" >>confdefs.h
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of uid_t" >&5
printf %s "checking size of uid_t... " >&6; }
if test ${ac_cv_sizeof_uid_t+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (uid_t))" "ac_cv_sizeof_uid_t" "$ac_includes_default"
then :
else case e in #(
e) if test "$ac_cv_type_uid_t" = yes; then
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5
printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (uid_t)
See 'config.log' for more details" "$LINENO" 5; }
else
ac_cv_sizeof_uid_t=0
fi ;;
esac
fi
;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_uid_t" >&5
printf "%s\n" "$ac_cv_sizeof_uid_t" >&6; }
printf "%s\n" "#define SIZEOF_UID_T $ac_cv_sizeof_uid_t" >>confdefs.h
# sudo current assumes uid_t can be cast to unsigned int without problems
if test $ac_cv_sizeof_uid_t -gt 4
then :
as_fn_error $? "sudo does not support systems where uid_t is larger than 32-bit" "$LINENO" 5
fi
if test X"$ac_cv_header_utmps_h" = X"yes" if test X"$ac_cv_header_utmps_h" = X"yes"
then : then :

View File

@ -2507,6 +2507,9 @@ AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long]) AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([id_t]) AC_CHECK_SIZEOF([id_t])
AC_CHECK_SIZEOF([time_t]) AC_CHECK_SIZEOF([time_t])
AC_CHECK_SIZEOF([uid_t])
# sudo current assumes uid_t can be cast to unsigned int without problems
AS_IF([test $ac_cv_sizeof_uid_t -gt 4], [AC_MSG_ERROR([sudo does not support systems where uid_t is larger than 32-bit])])
AS_IF([test X"$ac_cv_header_utmps_h" = X"yes"], [ AS_IF([test X"$ac_cv_header_utmps_h" = X"yes"], [
SUDO_CHECK_UTMP_MEMBERS([utmps]) SUDO_CHECK_UTMP_MEMBERS([utmps])
], [test X"$ac_cv_header_utmpx_h" = X"yes"], [ ], [test X"$ac_cv_header_utmpx_h" = X"yes"], [