Blame SOURCES/nfs-utils-1.3.0-rpcgssd-16bits.patch

64c563
commit 2a6b8307fa4243a7921270aedf8ce6506e31569a
64c563
Author: Steve Dickson <steved@redhat.com>
64c563
Date:   Tue Jul 17 15:09:37 2018 -0400
64c563
64c563
    rpc.gssd: truncates 32-bit UIDs/GIDs to 16 bits architectures.
64c563
    
64c563
    utils/gssd_proc.c uses SYS_setresuid and SYS_setresgid in
64c563
    change_identity when it should use SYS_setresuid32 and
64c563
    SYS_setresgid32 instead. This causes it to truncate
64c563
    UIDs/GIDs > 65536.
64c563
    
64c563
    Fixes: https://bugs.launchpad.net/ubuntu/+source/nfs-utils/+bug/1779962
64c563
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1595927
64c563
    
64c563
    Tested-by: James Ettle <theholyettlz@googlemail.com>
64c563
    Tested-by: Sree <Sree@gmail.com>
64c563
    Signed-off-by: Steve Dickson <steved@redhat.com>
64c563
64c563
diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
64c563
index 8767e26..7a57c4e 100644
64c563
--- a/utils/gssd/gssd_proc.c
64c563
+++ b/utils/gssd/gssd_proc.c
64c563
@@ -434,6 +434,7 @@ static int
64c563
 change_identity(uid_t uid)
64c563
 {
64c563
 	struct passwd	*pw;
64c563
+	int res;
64c563
 
64c563
 	/* drop list of supplimentary groups first */
64c563
 	if (syscall(SYS_setgroups, 0, 0) != 0) {
64c563
@@ -459,14 +460,23 @@ change_identity(uid_t uid)
64c563
 	 * send a signal to all other threads to synchronize the uid in all
64c563
 	 * other threads. To bypass this, we have to call syscall() directly.
64c563
 	 */
64c563
-	if (syscall(SYS_setresgid, pw->pw_gid, pw->pw_gid, pw->pw_gid) != 0) {
64c563
+#ifdef __NR_setresuid32
64c563
+	res = syscall(SYS_setresgid32, pw->pw_gid, pw->pw_gid, pw->pw_gid);
64c563
+#else 
64c563
+	res = syscall(SYS_setresgid, pw->pw_gid, pw->pw_gid, pw->pw_gid);
64c563
+#endif
64c563
+	if (res != 0) {
64c563
 		printerr(0, "WARNING: failed to set gid to %u!\n", pw->pw_gid);
64c563
 		return errno;
64c563
 	}
64c563
 
64c563
-	if (syscall(SYS_setresuid, uid, uid, uid) != 0) {
64c563
-		printerr(0, "WARNING: Failed to setuid for user with uid %u\n",
64c563
-				uid);
64c563
+#ifdef __NR_setresuid32
64c563
+	res = syscall(SYS_setresuid32, uid, uid, uid);
64c563
+#else 
64c563
+	res = syscall(SYS_setresuid, uid, uid, uid);
64c563
+#endif
64c563
+	if (res != 0) {
64c563
+		printerr(0, "WARNING: Failed to setuid for user with uid %u\n", uid);
64c563
 		return errno;
64c563
 	}
64c563