Blob Blame History Raw
diff -up ecryptfs-utils-87/src/pam_ecryptfs/pam_ecryptfs.c.fixexecgid ecryptfs-utils-87/src/pam_ecryptfs/pam_ecryptfs.c
--- ecryptfs-utils-87/src/pam_ecryptfs/pam_ecryptfs.c.fixexecgid	2011-07-25 16:38:48.040555555 +0200
+++ ecryptfs-utils-87/src/pam_ecryptfs/pam_ecryptfs.c	2011-07-25 16:52:22.751025667 +0200
@@ -33,6 +33,7 @@
 #include <errno.h>
 #include <syslog.h>
 #include <pwd.h>
+#include <grp.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/types.h>
@@ -303,6 +304,12 @@ static int private_dir(pam_handle_t *pam
 		return 1;
 	}
 	if (pid == 0) {
+		/* set user's groups, we may need ecryptfs group for (u)mount */
+		if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) {
+			syslog(LOG_ERR, "Unable to set user's groups : %m");
+			_exit(255);
+		}
+
 		if (mount == 1) {
 		        if ((asprintf(&recorded,
 			    "%s/.ecryptfs/.wrapped-passphrase.recorded",