]> Savannah Git Hosting - gnulib.git/commitdiff
idpriv-droptemp: Handle large user and group ids.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 26 Jun 2024 04:39:50 +0000 (21:39 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 26 Jun 2024 04:39:50 +0000 (21:39 -0700)
* 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.

ChangeLog
lib/idpriv-droptemp.c

index f10e0edb436035f2dc92b7c9daf912eea139827b..05bec51810e71abc79baa206e93ff2c723a55856 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 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.
 
index eb882dea6d93f873153898e79ad2c9a6f1949a14..15337cdd9e4e686502c499c1fa8443fee67c1fd1 100644 (file)
 
 /* 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)
@@ -124,8 +124,8 @@ int
 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.  */