bin/72425: ftpd SITE command case sensitivity

Ryan Sommers ryans at gamersimpact.com
Thu Oct 7 21:10:31 PDT 2004


The following reply was made to PR bin/72425; it has been noted by GNATS.

From: Ryan Sommers <ryans at gamersimpact.com>
To: freebsd-gnats-submit at FreeBSD.org, drick at edigic.com
Cc:  
Subject: Re: bin/72425: ftpd SITE command case sensitivity
Date: Thu, 07 Oct 2004 23:07:54 -0500

 This is actually not a bug in ftpd:
 
 (root at blue)~:telnet 192.168.0.2 21
 Trying 192.168.0.2...
 Connected to blue.
 Escape character is '^]'.
 220 blue FTP server (Version 6.00LS) ready.
 USER ryans
 331 Password required for ryans.
 PASS **********
 230 User ryans logged in.
 pwd
 257 "/usr/home/ryans" is current directory.
 PWD
 257 "/usr/home/ryans" is current directory.
 SITE
 500 'SITE': command not understood.
 SITE CHMOD 777 dump.log
 200 CHMOD command successful.
 site chmod 777 dump.log
 200 CHMOD command successful.
 ^]
 telnet> close
 Connection closed.
 
 Instead, this is, a 'feature'(or bug), of the ftp client. The following 
 patch should fix the ftp client though. I haven't tested it, so if 
 someone imports it might want to be sure it compiles first.
 
 Index: main.c
 ===================================================================
 RCS file: /home/ncvs/src/contrib/lukemftp/src/main.c,v
 retrieving revision 1.1.1.5
 diff -u -r1.1.1.5 main.c
 --- main.c      3 Nov 2003 17:12:05 -0000       1.1.1.5
 +++ main.c      8 Oct 2004 04:06:30 -0000
 @@ -114,6 +114,7 @@
  #include <sys/types.h>
  #include <sys/socket.h>
 
 +#include <ctype.h>
  #include <err.h>
  #include <errno.h>
  #include <netdb.h>
 @@ -724,7 +725,7 @@
         nmatches = 0;
         found = 0;
         for (c = cmdtab; (p = c->c_name) != NULL; c++) {
 -               for (q = name; *q == *p++; q++)
 +               for (q = name; toupper(*q) == toupper(*p++); q++)
                         if (*q == 0)            /* exact match? */
                                 return (c);
                 if (!*q) {                      /* the name was a prefix */
 
 -- 
 Ryan Sommers
 ryans at gamersimpact.com
 


More information about the freebsd-bugs mailing list