Goal: Avoid terminating the PAM library in the forked child. This is done
      later in the parent after closing the PAM session.

Note: OR'ing the status with PAM_DATA_SILENT should be sufficient, but it
is not supported by some modules, and the pam_end is not strictly needed
anyway.

Fixes: #412061

Status wrt upstream: not reported yet.

Index: shadow-4.0.18.1/src/su.c
===================================================================
--- shadow-4.0.18.1.orig/src/su.c	2007-02-25 14:22:54.000000000 +0100
+++ shadow-4.0.18.1/src/su.c	2007-02-25 14:29:01.000000000 +0100
@@ -197,7 +197,12 @@
 
 	child = fork ();
 	if (child == 0) {	/* child shell */
-		pam_end (pamh, PAM_SUCCESS);
+		/*
+		 * PAM_DATA_SILENT is not supported by some modules, and
+		 * there is no strong need to clean up the process space's
+		 * memory since we will either call exec or exit.
+		pam_end (pamh, PAM_SUCCESS | PAM_DATA_SILENT);
+		 */
 
 		if (doshell)
 			(void) shell (shellstr, (char *) args[0], envp);
