? openssh-sigalarm.diff
Index: session.c
===================================================================
RCS file: /var/cvs/openssh/session.c,v
retrieving revision 1.311
diff -u -p -r1.311 session.c
--- session.c	20 Dec 2005 05:14:16 -0000	1.311
+++ session.c	24 Dec 2005 01:38:25 -0000
@@ -209,15 +209,6 @@ do_authenticated(Authctxt *authctxt)
 {
 	setproctitle("%s", authctxt->pw->pw_name);
 
-	/*
-	 * Cancel the alarm we set to limit the time taken for
-	 * authentication.
-	 */
-	alarm(0);
-	if (startup_pipe != -1) {
-		close(startup_pipe);
-		startup_pipe = -1;
-	}
 	/* setup the channel layer */
 	if (!no_port_forwarding_flag && options.allow_tcp_forwarding)
 		channel_permit_all_opens();
Index: sshd.c
===================================================================
RCS file: /var/cvs/openssh/sshd.c,v
retrieving revision 1.319
diff -u -p -r1.319 sshd.c
--- sshd.c	5 Nov 2005 04:15:00 -0000	1.319
+++ sshd.c	24 Dec 2005 01:38:25 -0000
@@ -637,13 +637,6 @@ privsep_postauth(Authctxt *authctxt)
 		goto skip;
 	}
 
-	/* Authentication complete */
-	alarm(0);
-	if (startup_pipe != -1) {
-		close(startup_pipe);
-		startup_pipe = -1;
-	}
-
 	/* New socket pair */
 	monitor_reinit(pmonitor);
 
@@ -1735,6 +1728,17 @@ main(int ac, char **av)
 #ifdef SSH_AUDIT_EVENTS
 	audit_event(SSH_AUTH_SUCCESS);
 #endif
+
+	/*
+	 * Cancel the alarm we set to limit the time taken for
+	 * authentication.
+	 */
+	alarm(0);
+	signal(SIGALRM, SIG_DFL);
+	if (startup_pipe != -1) {
+		close(startup_pipe);
+		startup_pipe = -1;
+	}
 
 	/*
 	 * In privilege separation, we fork another child and prepare
