Subject: Re: 2nd resend of ftpd bug

From: "Tim P. Starrin" <[email-masked]>
Date: Mon, 21 Oct 1996 10:45:18 -0400

> From [email-masked] Sat Oct 19 22:51:57 1996
> From: Alain Magloire <[email-masked]>
> Subject: Re: 2nd resend of ftpd bug
> To: [email-masked]
> Date: Sat, 19 Oct 1996 22:53:23 -0400 (EDT)
> Cc: [email-masked]
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> 
> The format for ASCII is NVT ASCII as describe in RFC854
> i.e.
> strings<LF> --> strings<CR><LF>
> 
> If mode is TYPE A
> The server will always send in NVT ASCII
> it's the client responsability to transfert back again
> Thus for two Unix systems it's a waste.
> 
> server will do the conversion
> strings<LF> --> strings<CR><LF>
> and send
> 
> Client will receive and convert back again
> strings<CR><LF> --> strings<LF>
> 
> ** Must new Ftp client nowadays will issue
> SYST command
> and if the answer is:
> 215 UNIX TYPE: L8 ...
> 
> they will fall back to binary.
> 
> Type A is also wastefull because the server
> will look at every byte(see the code below)
> with getc(). With binary it's done by block
> read()
> 
> [deleted]

Some vendors versions of ftpd do buffering here with vectorization and can speed
up the code as much as 10X over the getc version of ASCII mode.

> >  
> : > --- ftpd.c, excerpt from receive_data() function ---
> : >  
> 
> !!!!!!!!!!!!!!!!!!!
> I have no idea where you get this code but
> in the wu-ftpd that I have(also BSDftp)
> the function is a simple mapping:
> 
>     case TYPE_A:
>         while ((c = getc(instr)) != EOF) {
>             byte_count++;
>             if (c == '\n') {
>                 if (ferror(outstr))
>                     goto data_err;
>                 (void) putc('\r', outstr);
>             }
>             (void) putc(c, outstr);
>         }
> 
> the code you have below is not in wu-ftpd-2.4 nor
> BSDftp(at least not from my distributions ??)
> 

That is the first switch statement, try looking at your source for the same 
case in the second switch statement (line 1883 in wuftp-2.4, line 2378 in 
wu-ftpd-2.4.2-beta-11).

> : > ...
> : >  
> : >     switch (type) { 
> : > ...
> : >  
> : >     case TYPE_A:
> : >         while ((c = getc(instr)) != EOF) {
> : >             byte_count++;
> : >             if (c == '\n')
> : >                 bare_lfs++;
> : >             while (c == '\r') {
> : >                 if (ferror(outstr))
> : >                     goto data_err;
> : >                 if ((c = getc(instr)) != '\n') {
> : >                     (void) putc('\r', outstr);
> : > ------------------> if (c == '\0' || c == EOF)
> : >                         goto contin2;
> : >                 }
> : >             }
> : >             (void) putc(c, outstr);
> : >           contin2:;
> : >         }
> : >  
> : > ...
> 
> 
> --
> bonne journe'e, alain
> 

It sounds like the RFC defines no action for NULL bytes, so why is ftpd.c
coded to drop them when following ^M's?  By changing this one line in the code,
ASCII mode behaves as it does on other systems that don't exhibit the problem.
With over 2,000 users having access to our mass storage system, you can imagine
the widely-varied levels of computer literacy exhibited by them.   I would just
like to close this potential hole that some of them will fall into (despite
our efforts to educate them).  Can we call this a bug and have the line 
changed to "if (c == EOF)"?

Tim

---

From: Alain Magloire <[email-masked]>
Date: Mon, 21 Oct 1996 12:14:24 -0400 (EDT)

> case in the second switch statement (line 1883 in wuftp-2.4, line 2378 in 

noted, I was assuming, wrongly, that you were refering to function
send_data()

> changed to "if (c == EOF)"?

:-)

Maybe you should send your patch to "ftp.academ.." or who ever
maintain wu-ftpd this days(don't know the email).
They're suppose to release a beta-1? ... "real soon" :-)

Can you Cc the patch to the mailing list so I can archive .. and play :)

> Tim

regards, alain

---

From: [email-masked] (Koos van den Hout _U nix and we all_)
Date: Mon, 21 Oct 1996 18:48:50 +0200 (MET DST)

> maintain wu-ftpd this days(don't know the email).

[email-masked]

> They're suppose to release a beta-1? ... "real soon" :-)

For as far as I know, wu-ftpd is not an official project of academ.com.
Therefore things like release dates don't mean much.

Even commercial software companies don't make their release dates. Let
alone hobby project.

                                           Grtx KH

-- 
  Koos van den Hout,     Internetter, Unix freak, ISFJ and BBS SysOp at large
  [email-masked] (Home)        BBS Koos z'n Doos (+31-30-6036637 28k8)
  [email-masked] (Work)  <-- finger -l for PGPkey    (+31-30-6056619 14k4)
  http://www.hvu.nl/~koos (WWW)    Looking for a license plate with "RFC 822"
  Unix op z'n NL's : Segment overtreding - kern uitgescheten       KH106-RIPE