Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > 8104c6e5600a8fbbbb44d47f9febbc59 > files > 59

krb5-1.6.1-25.el5.src.rpm

In reusing the ignore_signals() function to avoid signal races with syslog(),
the second call actually kills processes which may still be running as part
of the shell's process group, which doesn't look to have been an intended
change in behavior.

--- krb5-1.6.1/src/appl/bsd/krshd.c	2007-06-25 01:45:58.000000000 -0400
+++ krb5-1.6.1/src/appl/bsd/krshd.c	2007-06-25 01:47:37.000000000 -0400
@@ -552,6 +552,7 @@ KTEXT		v4_ticket;
 #endif
 
 int auth_sys = 0;	/* Which version of Kerberos used to authenticate */
+volatile int term_tasks = 1; 	/* By default, on ignore_signal / cleanup, terminate */
 
 #define KRB5_RECVAUTH_V4	4
 #define KRB5_RECVAUTH_V5	5
@@ -570,7 +571,7 @@ ignore_signals()
     (void)sigaction(SIGTERM, &sa, (struct sigaction *)0);
     (void)sigaction(SIGPIPE, &sa, (struct sigaction *)0);
     (void)sigaction(SIGHUP, &sa, (struct sigaction *)0);
-
+if (term_tasks)
     (void)kill(-pid, SIGTERM);
 #else
     signal(SIGINT, SIG_IGN);
@@ -578,7 +579,7 @@ ignore_signals()
     signal(SIGTERM, SIG_IGN);
     signal(SIGPIPE, SIG_IGN);
     signal(SIGHUP, SIG_IGN);
-    
+if (term_tasks)    
     killpg(pid, SIGTERM);
 #endif
 }
@@ -1398,6 +1399,8 @@ void doit(f, fromp)
 		     (port&&FD_ISSET(s, &writeto)) ||
 		     FD_ISSET(f, &writeto) ||
 		     FD_ISSET(px[1], &writeto));
+	    /* do not terminate any task at this point. */
+	    term_tasks = 0;
 	    ignore_signals();
 #ifdef KERBEROS
 	    syslog(LOG_INFO ,