rpms/krb5/devel krb5-1.3.4-deadlock.patch, NONE, 1.1 krb5.spec, 1.50, 1.51 krb5-1.3.5-krsh-deadlock.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri May 13 11:36:43 UTC 2005


Author: stransky

Update of /cvs/dist/rpms/krb5/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv12524

Modified Files:
	krb5.spec 
Added Files:
	krb5-1.3.4-deadlock.patch 
Removed Files:
	krb5-1.3.5-krsh-deadlock.patch 
Log Message:
 add deadlock patch, removed old patch

krb5-1.3.4-deadlock.patch:
 defines.h |    1 
 kcmd.c    |    5 ++++
 krsh.c    |   62 +++++++++++++++++++++++++++++++++++++------------------
 krshd.c   |   69 +++++++++++++++++++++++++++++++++++++++++++-------------------
 4 files changed, 96 insertions(+), 41 deletions(-)

--- NEW FILE krb5-1.3.4-deadlock.patch ---
--- krb5-1.4.1/src/appl/bsd/kcmd.c.deadlock	2004-10-02 00:08:14.000000000 +0200
+++ krb5-1.4.1/src/appl/bsd/kcmd.c	2005-05-13 10:14:59.000000000 +0200
@@ -959,6 +959,11 @@
 }
 #endif
 
+int rcmd_stream_read_buffer_full(void)
+{
+     return(nstored);
+}
+
 int rcmd_stream_read(fd, buf, len, sec)
      int fd;
      register char *buf;
--- krb5-1.4.1/src/appl/bsd/defines.h.deadlock	2003-01-01 11:13:19.000000000 +0100
+++ krb5-1.4.1/src/appl/bsd/defines.h	2005-05-13 10:14:59.000000000 +0200
@@ -35,6 +35,7 @@
 		 );
 
 extern int rcmd_stream_read (int fd, char *buf, size_t len, int secondary);
+extern int rcmd_stream_read_buffer_full(void);
 extern int rcmd_stream_write (int fd, char *buf, size_t len, int secondary);
 extern int getport (int * /* portnum */, int * /* addrfamily */);
 
--- krb5-1.4.1/src/appl/bsd/krshd.c.deadlock	2005-04-07 23:17:25.000000000 +0200
+++ krb5-1.4.1/src/appl/bsd/krshd.c	2005-05-13 10:14:59.000000000 +0200
@@ -616,8 +616,10 @@
     int aierr;
     short port;
     int pv[2], pw[2], px[2], cc;
+    fd_set write_ready, write_to;
     fd_set ready, readfrom;
-    char buf[RCMD_BUFSIZ], sig;
+    int    rw_max;
+    char buf[PIPE_BUF], sig;
     struct sockaddr_storage localaddr;
 #ifdef POSIX_SIGNALS
     struct sigaction sa;
@@ -1231,11 +1233,30 @@
 	    
 	    FD_ZERO(&readfrom);
 	    FD_SET(f, &readfrom);
+
+            rw_max = f;
+ 
 	    if(port) {
 		FD_SET(s, &readfrom);
 		FD_SET(pv[0], &readfrom);
+
+                if(rw_max < s)
+                  rw_max = s;
+                if(rw_max < pv[0])
+                  rw_max = pv[0];
 	    }
+
 	    FD_SET(pw[0], &readfrom);
+            if(rw_max < pw[0])
+               rw_max = pw[0];
+	    
+            FD_ZERO(&write_to);
+            FD_SET(f, &write_to);
+            FD_SET(px[1], &write_to);
+
+            if(rw_max < px[1])
+               rw_max = px[1];
+
 	    
 	    /* read from f, write to px[1] -- child stdin */
 	    /* read from s, signal child */
@@ -1244,7 +1265,9 @@
 
 	    do {
 		ready = readfrom;
-		if (select(8*sizeof(ready), &ready, (fd_set *)0,
+		write_ready = write_to;
+		
+		if (select(rw_max+1, &ready, &write_ready,
 			   (fd_set *)0, (struct timeval *)0) < 0) {
 		    if (errno == EINTR) {
 			continue;
@@ -1264,7 +1287,7 @@
 			(void) rcmd_stream_write(s, buf, (unsigned) cc, 1);
 		    }
 		}
-		if (FD_ISSET(pw[0], &ready)) {
+		if (FD_ISSET(pw[0], &ready) && FD_ISSET(f, &write_ready)) {
 		    /* read from the child stdout, write to the net */
 		    errno = 0;
 		    cc = read(pw[0], buf, sizeof (buf));
@@ -1290,26 +1313,30 @@
 #endif
 		    }
 		}
-		if (FD_ISSET(f, &ready)) {
+		if (FD_ISSET(f, &ready) && FD_ISSET(px[1], &write_ready)) {
 		    /* read from the net, write to child stdin */
-		    errno = 0;
-		    cc = rcmd_stream_read(f, buf, sizeof(buf), 0);
-		    if (cc <= 0) {
-			(void) close(px[1]);
-			FD_CLR(f, &readfrom);
-		    } else {
-		        int wcc;
-		        wcc = write(px[1], buf, (unsigned) cc);
-			if (wcc == -1) {
-			  /* pipe closed, don't read any more */
-			  /* might check for EPIPE */
-			  (void) close(px[1]);
-			  FD_CLR(f, &readfrom);
-			} else if (wcc != cc) {
-			  syslog(LOG_INFO, "only wrote %d/%d to child", 
+                    do {
+  		        errno = 0;
+		        cc = rcmd_stream_read(f, buf, sizeof(buf), 0);
+		        if (cc <= 0) {
+			   (void) close(px[1]);
+			   FD_CLR(f, &readfrom);
+                           break;
+		        } else {
+		           int wcc;
+		           wcc = write(px[1], buf, (unsigned) cc);
+			   if (wcc == -1) {
+			      /* pipe closed, don't read any more */
+			      /* might check for EPIPE */
+			      (void) close(px[1]);
+			      FD_CLR(f, &readfrom);
+                              break;
+			    } else if (wcc != cc) {
+			      syslog(LOG_INFO, "only wrote %d/%d to child", 
 				 wcc, cc);
-			}
-		    }
+			    }
+		        }
+                    } while(rcmd_stream_read_buffer_full());
 		}
 	    } while ((port&&FD_ISSET(s, &readfrom)) ||
 		     FD_ISSET(f, &readfrom) ||
--- krb5-1.4.1/src/appl/bsd/krsh.c.deadlock	2005-05-13 10:14:59.000000000 +0200
+++ krb5-1.4.1/src/appl/bsd/krsh.c	2005-05-13 11:08:06.000000000 +0200
@@ -128,10 +128,12 @@
      char **argv0;
 {
     int rem, pid = 0;
-    char *host=0, *cp, **ap, buf[RCMD_BUFSIZ], *args, **argv = argv0, *user = 0;
+    char *host=0, *cp, **ap, buf[PIPE_BUF], *args, **argv = argv0, *user = 0;
     register int cc;
     struct passwd *pwd;
     fd_set readfrom, ready;
+    fd_set write_to, ready_wr;
+    int    read_from_max;
     int one = 1;
     struct servent *sp;
     struct servent defaultservent;
@@ -512,7 +514,7 @@
       rewrite:
 	FD_ZERO(&rembits);
 	FD_SET(rem, &rembits);
-	if (select(8*sizeof(rembits), 0, &rembits, 0, 0) < 0) {
+	if (select(rem+1, 0, &rembits, 0, 0) < 0) {
 	    if (errno != EINTR) {
 		perror("select");
 		exit(1);
@@ -548,32 +550,52 @@
     FD_ZERO(&readfrom);
     FD_SET(rfd2, &readfrom);
     FD_SET(rem, &readfrom);
+
+    FD_ZERO(&write_to);
+    FD_SET(1, &write_to);
+    FD_SET(2, &write_to);
+
+    read_from_max = rfd2;
+    if(read_from_max < rem)
+       read_from_max = rem;
+
     do {
 	ready = readfrom;
-	if (select(8*sizeof(ready), &ready, 0, 0, 0) < 0) {
+        ready_wr = write_to;
+        if (select(read_from_max+1, &ready, &ready_wr, 0, 0) < 0) {
 	    if (errno != EINTR) {
 		perror("select");
 		exit(1);
 	    }
 	    continue;
 	}
-	if (FD_ISSET(rfd2, &ready)) {
-	    errno = 0;
-	    cc = rcmd_stream_read(rfd2, buf, sizeof buf, 1);
-	    if (cc <= 0) {
-		if ((errno != EWOULDBLOCK) && (errno != EAGAIN))
-		    FD_CLR(rfd2, &readfrom);
-	    } else
-	      (void) write(2, buf, (unsigned) cc);
-	}
-	if (FD_ISSET(rem, &ready)) {
-	    errno = 0;
-	    cc = rcmd_stream_read(rem, buf, sizeof buf, 0);
-	    if (cc <= 0) {
-		if ((errno != EWOULDBLOCK) && (errno != EAGAIN))
-		    FD_CLR(rem, &readfrom);
-	    } else
-	      (void) write(1, buf, (unsigned) cc);
+        if (FD_ISSET(rfd2, &ready) && FD_ISSET(2, &ready_wr)) {
+            do {
+		errno = 0;
+	    	cc = rcmd_stream_read(rfd2, buf, sizeof buf, 1);
+	    	if (cc <= 0) {
+		    if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
+		       FD_CLR(rfd2, &readfrom);
+                       break;
+                    }
+	    	} else {
+	            (void) write(2, buf, (unsigned) cc);
+                }
+            } while(rcmd_stream_read_buffer_full());
+	}
+        if (FD_ISSET(rem, &ready) && FD_ISSET(1, &ready_wr)) {
+            do {
+     	        errno = 0;
+	        cc = rcmd_stream_read(rem, buf, sizeof buf, 0);
+	        if (cc <= 0) {
+		   if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) {
+		      FD_CLR(rem, &readfrom);
+                      break;
+                   }
+	        } else {
+	           (void) write(1, buf, (unsigned) cc);
+                }
+            } while(rcmd_stream_read_buffer_full());
 	}
     } while (FD_ISSET(rem, &readfrom) || FD_ISSET(rfd2, &readfrom));
     if (nflag == 0)


Index: krb5.spec
===================================================================
RCS file: /cvs/dist/rpms/krb5/devel/krb5.spec,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- krb5.spec	6 May 2005 20:16:06 -0000	1.50
+++ krb5.spec	13 May 2005 11:36:41 -0000	1.51
@@ -7,7 +7,7 @@
 Summary: The Kerberos network authentication system.
 Name: krb5
 Version: 1.4.1
-Release: 1
+Release: 2
 # Maybe we should explode from the now-available-to-everybody tarball instead?
 # http://web.mit.edu/kerberos/dist/krb5/1.4/krb5-1.4.1-signed.tar
 Source0: krb5-%{version}.tar.gz
@@ -60,6 +60,7 @@
 Patch29: krb5-1.3.5-kprop-mktemp.patch
 Patch30: krb5-1.3.4-send-pr-tempfile.patch
 Patch32: krb5-1.4-ncurses.patch
+Patch33: krb5-1.3.4-deadlock.patch
 License: MIT, freely distributable.
 URL: http://web.mit.edu/kerberos/www/
 Group: System Environment/Libraries
@@ -124,6 +125,9 @@
 workstation.
 
 %changelog
+* Fri May 13 2005 Martin Stransky <stransky at redhat.com> 1.4.1-2
+- add deadlock patch, removed old patch
+
 * Fri May  6 2005 Nalin Dahyabhai <nalin at redhat.com> 1.4.1-1
 - update to 1.4.1, incorporating fixes for CAN-2005-0468 and CAN-2005-0469
 - when starting the KDC or kadmind, if KRB5REALM is set via the /etc/sysconfig
@@ -818,6 +822,7 @@
 %patch29 -p1 -b .kprop-mktemp
 %patch30 -p1 -b .send-pr-tempfile
 %patch32 -p1 -b .ncurses
+%patch33 -p1 -b .deadlock
 cp src/krb524/README README.krb524
 find . -type f -name "*.info-dir" -exec rm -fv "{}" ";"
 gzip doc/*.ps


--- krb5-1.3.5-krsh-deadlock.patch DELETED ---




More information about the fedora-cvs-commits mailing list