🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Steven M. Schultz Sun, 19 Nov 1989 23:26
ftpd can't restart above 32kb
#44
Author: Steven M. Schultz
Date: Sun, 19 Nov 1989 23:26
72 lines
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)" },
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads