Article View: comp.bugs.2bsd
Article #44ftpd can't restart above 32kb
From: Steven M. Schultz
Date: Sun, 19 Nov 1989 23:26
Date: Sun, 19 Nov 1989 23:26
72 lines
2877 bytes
2877 bytes
Subject: RESTart in ftpd fails above 32k
Index: etc/ftpd/ftpcmd.y 2.10BSD
Description:
Attempting to RESTart a file transfer when the remote daemon
is running on a machine where "sizeof (int) != sizeof (long)"
fails when the offset/restartpoint is above 32767.
The problem is (yet another *sigh *) long vs. int one.
One would think that "sizeof (int) != sizeof (long)" would
be a more widely know fact, but alas not.
The RESTart offset should be treated as a string and converted
via atol() when needed. In fact, the "long atol()" declaration
was present in ftpcmd.y - but the function was never called.
Repeat-By:
Connect to a ftp servor on a machine (likely a pdp-11) where
"sizeof (int) != sizeof (long)" and do a "reget file" where
the starting point would be > 32767. Observe the error message
and the mangled number (result of sign extending a short to a
long.
Fix:
Apply the following patch to ftpcmd.y, recompile and install.
*** ftpcmd.y.old Wed May 10 14:13:13 1989
--- ftpcmd.y Sun Nov 19 17:52:30 1989
***************
*** 488,499 ****
}
}
}
! | REST SP byte_size CRLF
= {
long atol();
fromname = (char *) 0;
! restart_point = $3;
reply(350, "Restarting at %ld. %s", restart_point,
"Send STORE or RETRIEVE to initiate transfer.");
}
--- 488,499 ----
}
}
}
! | REST SP STRING CRLF
= {
long atol();
fromname = (char *) 0;
! restart_point = atol($3);
reply(350, "Restarting at %ld. %s", restart_point,
"Send STORE or RETRIEVE to initiate transfer.");
}
***************
*** 712,718 ****
{ "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
{ "MRCP", MRCP, STR1, 0, "(mail recipient)" },
{ "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
! { "REST", REST, ARGS, 1, "(restart command)" },
{ "RNFR", RNFR, STR1, 1, "<sp> file-name" },
{ "RNTO", RNTO, STR1, 1, "<sp> file-name" },
{ "ABOR", ABOR, ARGS, 1, "(abort operation)" },
--- 712,718 ----
{ "MRSQ", MRSQ, OSTR, 0, "(mail recipient scheme question)" },
{ "MRCP", MRCP, STR1, 0, "(mail recipient)" },
{ "ALLO", ALLO, ARGS, 1, "allocate storage (vacuously)" },
! { "REST", REST, STR1, 1, "(restart command)" },
{ "RNFR", RNFR, STR1, 1, "<sp> file-name" },
{ "RNTO", RNTO, STR1, 1, "<sp> file-name" },
{ "ABOR", ABOR, ARGS, 1, "(abort operation)" },
Technical Details
Message-ID:
<40918@wlbr.IMSD.CONTEL.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!gem.mps.ohio-state.edu!apple!voder!wlbr!smsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!gem.mps.ohio-state.edu!apple!voder!wlbr!sms From: sms@wlv.imsd.contel.com (Steven M. Schultz) Newsgroups: comp.bugs.2bsd Subject: ftpd can't restart above 32kb Message-ID: <40918@wlbr.IMSD.CONTEL.COM> Date: 19 Nov 89 23:26:47 GMT Sender: news@wlbr.IMSD.CONTEL.COM Reply-To: sms@wlv.imsd.contel.com (Steven M. Schultz) Organization: Contel Federal Systems Lines: 72