Blame ecryptfs-utils-87-fixexecgid.patch

cac1ea
diff -up ecryptfs-utils-103/src/pam_ecryptfs/pam_ecryptfs.c.fixexecgid ecryptfs-utils-103/src/pam_ecryptfs/pam_ecryptfs.c
cac1ea
--- ecryptfs-utils-103/src/pam_ecryptfs/pam_ecryptfs.c.fixexecgid	2013-01-28 17:23:15.389634398 +0100
cac1ea
+++ ecryptfs-utils-103/src/pam_ecryptfs/pam_ecryptfs.c	2013-01-28 17:23:15.392634422 +0100
cac1ea
@@ -330,8 +330,10 @@ static int private_dir(pam_handle_t *pam
538c2f
 				_exit(0);
538c2f
 			}
538c2f
 			clearenv();
538c2f
-			if (setgroups(1, &pwd->pw_gid) < 0 || setgid(pwd->pw_gid) < 0)
538c2f
+			if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) {
538c2f
+				syslog(LOG_ERR, "Unable to set user's groups : %m");
538c2f
 				_exit(255);
538c2f
+			}
538c2f
 			/* run mount.ecryptfs_private as the user */
538c2f
 			if (setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) < 0)
538c2f
 				_exit(255);
cac1ea
@@ -345,8 +347,10 @@ static int private_dir(pam_handle_t *pam
538c2f
 				_exit(0);
538c2f
 			}
538c2f
 			clearenv();
538c2f
-			if (setgroups(1, &pwd->pw_gid) < 0 || setgid(pwd->pw_gid) < 0)
538c2f
+			if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) {
538c2f
+				syslog(LOG_ERR, "Unable to set user's groups : %m");
538c2f
 				_exit(255);
538c2f
+			}
538c2f
 			/* run umount.ecryptfs_private as the user */
538c2f
 			if (setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) < 0)
538c2f
 				_exit(255);