* lib/idpriv-droptemp.c (saved_uid): Use uid_t instead of int.
(saved_gid): Use gid_t instead of int.
(idpriv_temp_drop): Use uid_t and gid_t instead of int.
(idpriv_temp_restore): Likewise.
2024-06-25 Collin Funk <collin.funk1@gmail.com>
+ idpriv-droptemp: Handle large user and group ids.
+ * lib/idpriv-droptemp.c (saved_uid): Use uid_t instead of int.
+ (saved_gid): Use gid_t instead of int.
+ (idpriv_temp_drop): Use uid_t and gid_t instead of int.
+ (idpriv_temp_restore): Likewise.
+
idpriv-drop: Handle large user and group ids.
* lib/idpriv-drop.c (idpriv_drop): Use uid_t and gid_t instead of int.
/* The privileged uid and gid that the process had earlier. */
#if HAVE_GETUID
-static int saved_uid = -1;
+static uid_t saved_uid = -1;
#endif
#if HAVE_GETGID
-static int saved_gid = -1;
+static gid_t saved_gid = -1;
#endif
int
idpriv_temp_drop (void)
{
#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
- int uid = getuid ();
- int gid = getgid ();
+ uid_t uid = getuid ();
+ gid_t gid = getgid ();
/* Find out about the privileged uid and gid at the first call. */
if (saved_uid == -1)
idpriv_temp_restore (void)
{
#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
- int uid = getuid ();
- int gid = getgid ();
+ uid_t uid = getuid ();
+ gid_t gid = getgid ();
if (saved_uid == -1 || saved_gid == -1)
/* Caller error: idpriv_temp_drop was never invoked. */