Blame ecryptfs-utils-87-fixpamfork.patch

9471b7
diff -up ecryptfs-utils-108/src/pam_ecryptfs/pam_ecryptfs.c.fixpamfork ecryptfs-utils-108/src/pam_ecryptfs/pam_ecryptfs.c
9471b7
--- ecryptfs-utils-108/src/pam_ecryptfs/pam_ecryptfs.c.fixpamfork	2015-08-11 14:43:58.438825091 +0200
9471b7
+++ ecryptfs-utils-108/src/pam_ecryptfs/pam_ecryptfs.c	2015-08-11 14:43:58.439825089 +0200
0d13c9
@@ -253,7 +253,7 @@ PAM_EXTERN int pam_sm_authenticate(pam_h
bbbcbd
 		}
bbbcbd
 out_child:
bbbcbd
 		free(auth_tok_sig);
bbbcbd
-		exit(0);
bbbcbd
+		_exit(0);
bbbcbd
 	}
bbbcbd
 	tmp_pid = waitpid(child_pid, NULL, 0);
bbbcbd
 	if (tmp_pid == -1)
0d13c9
@@ -349,7 +349,7 @@ static int private_dir(pam_handle_t *pam
7731a0
 			    "%s/.ecryptfs/.wrapped-passphrase.recorded",
bbbcbd
 			    pwd->pw_dir) < 0) || recorded == NULL) {
7731a0
 				syslog(LOG_ERR, "pam_ecryptfs: Error allocating memory for recorded name");
6154d2
-				exit(1);
bbbcbd
+				_exit(255);
bbbcbd
 			}
bbbcbd
 			if (stat(recorded, &s) != 0 && stat("/usr/share/ecryptfs-utils/ecryptfs-record-passphrase", &s) == 0) {
bbbcbd
 				/* User has not recorded their passphrase */
0d13c9
@@ -362,33 +362,35 @@ static int private_dir(pam_handle_t *pam
7731a0
 			if (stat(autofile, &s) != 0) {
bbbcbd
 				/* User does not want to auto-mount */
7731a0
 				syslog(LOG_DEBUG, "pam_ecryptfs: Skipping automatic eCryptfs mount");
6154d2
-				exit(0);
bbbcbd
+				_exit(0);
bbbcbd
 			}
538c2f
 			clearenv();
538c2f
 			if (setgroups(1, &pwd->pw_gid) < 0 || setgid(pwd->pw_gid) < 0)
0d13c9
-				exit(-1);
0d13c9
+				_exit(-1);
bbbcbd
 			/* run mount.ecryptfs_private as the user */
538c2f
 			if (setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) < 0)
0d13c9
-				exit(-1);
0d13c9
+				_exit(-1);
bbbcbd
 			execl("/sbin/mount.ecryptfs_private",
bbbcbd
 			      "mount.ecryptfs_private", NULL);
0d13c9
+			syslog(LOG_ERR, "unable to execute mount.ecryptfs_private : %m");
bbbcbd
 		} else {
bbbcbd
 			if (stat(autofile, &s) != 0) {
bbbcbd
 				/* User does not want to auto-unmount */
7731a0
 				syslog(LOG_DEBUG, "pam_ecryptfs: Skipping automatic eCryptfs unmount");
6154d2
-				exit(0);
bbbcbd
+				_exit(0);
bbbcbd
 			}
538c2f
 			clearenv();
538c2f
 			if (setgroups(1, &pwd->pw_gid) < 0 || setgid(pwd->pw_gid) < 0)
0d13c9
-				exit(-1);
0d13c9
+				_exit(-1);
bbbcbd
 			/* run umount.ecryptfs_private as the user */
538c2f
 			if (setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) < 0)
0d13c9
-				exit(-1);
0d13c9
+				_exit(-1);
bbbcbd
 			execl("/sbin/umount.ecryptfs_private",
9471b7
 			      "umount.ecryptfs_private", "-d", NULL);
6154d2
-			exit(1);
0d13c9
+			syslog(LOG_ERR, "unable to execute umount.ecryptfs_private : %m");
9471b7
+			_exit(1);
bbbcbd
 		}
6154d2
-		exit(1);
9471b7
+		_exit(1);
bbbcbd
 	} else {
be2a3c
 		waitpid(pid, &rc, 0);
6154d2
 	}
0d13c9
@@ -536,7 +538,7 @@ PAM_EXTERN int pam_sm_chauthtok(pam_hand
bbbcbd
 			goto out_child;
bbbcbd
 		}
bbbcbd
 out_child:
bbbcbd
-		exit(0);
bbbcbd
+		_exit(0);
bbbcbd
 	}
bbbcbd
 	if ((tmp_pid = waitpid(child_pid, NULL, 0)) == -1)
7731a0
 		syslog(LOG_WARNING, "pam_ecryptfs: waitpid() returned with error condition\n");