[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: heimdal 0.7pre2




Miroslav Ruda <ruda@ics.muni.cz> writes:

> Love Hörnquist Åstrand wrote:
>> Run "make check" before installing, I've added quite a lot of new test
>> programs, and some of them might be to restrictive.
>> Please send bug reports to heimdal-discuss so we don't get lots of
>> duplicate problems to heimdal-bugs.
>
> RSH_BUFSIZE was changed to 5*1024 to be compatible with MIT. However,
> because 0.4 version of heimdal client was using 16*1024 size, rshd is not
> able to handle large packets from older client. What about to have
> shorter RSH_BUFSIZE in client and larger in daemon?


Can you test if this solve the problem ?

Love


--- appl/rsh/rsh_locl.h
+++ appl/rsh/rsh_locl.h
@@ -160,6 +160,7 @@
 #endif
 
 #define RSH_BUFSIZ (5 * 1024) /* MIT kcmd can't handle larger buffers */
+#define RSHD_BUFSIZ (16 * 1024)
 
 #define PATH_RSH BINDIR "/rsh"
 
--- appl/rsh/rshd.c
+++ appl/rsh/rshd.c
@@ -469,6 +469,7 @@
     fd_set real_readset;
     int max_fd;
     int count = 2;
+    char *buf;
 
     if(from0 >= FD_SETSIZE || from1 >= FD_SETSIZE || from2 >= FD_SETSIZE)
 	errx (1, "fd too large");
@@ -483,10 +484,14 @@
     FD_SET(from1, &real_readset);
     FD_SET(from2, &real_readset);
     max_fd = max(from0, max(from1, from2)) + 1;
+
+    buf = malloc(max(RSHD_BUFSIZ, RSH_BUFSIZ));
+    if (buf == NULL)
+	syslog_and_die("out of memory");
+
     for (;;) {
 	int ret;
 	fd_set readset = real_readset;
-	char buf[RSH_BUFSIZ];
 
 	ret = select (max_fd, &readset, NULL, NULL, NULL);
 	if (ret < 0) {
@@ -496,7 +501,7 @@
 		syslog_and_die ("select: %m");
 	}
 	if (FD_ISSET(from0, &readset)) {
-	    ret = do_read (from0, buf, sizeof(buf), ivec_in[0]);
+	    ret = do_read (from0, buf, RSHD_BUFSIZ, ivec_in[0]);
 	    if (ret < 0)
 		syslog_and_die ("read: %m");
 	    else if (ret == 0) {
@@ -507,7 +512,7 @@
 		net_write (to0, buf, ret);
 	}
 	if (FD_ISSET(from1, &readset)) {
-	    ret = read (from1, buf, sizeof(buf));
+	    ret = read (from1, buf, RSH_BUFSIZ);
 	    if (ret < 0)
 		syslog_and_die ("read: %m");
 	    else if (ret == 0) {
@@ -520,7 +525,7 @@
 		do_write (to1, buf, ret, ivec_out[0]);
 	}
 	if (FD_ISSET(from2, &readset)) {
-	    ret = read (from2, buf, sizeof(buf));
+	    ret = read (from2, buf, RSH_BUFSIZ);
 	    if (ret < 0)
 		syslog_and_die ("read: %m");
 	    else if (ret == 0) {

PGP signature